Optimize a pattern where a sequence of 8/16 or 32 bits is tested for zero: LLVM normalizes this towards and AND with mask which is usually good, but does not work well on X86 when the mask does not fit into a 64bit register. This DagToDAG peephole transforms sequences like:
movabsq $562941363486720, %rax # imm = 0x1FFFE00000000 testq %rax, %rdi
to
shrq $33, %rdi testw %di, %di
the result has a shorter encoding and saves a register if the tested value isn't used otherwise.
clang-format: please reformat the code
3 diff lines are omitted. See full path.