aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineScheduler.cpp
diff options
context:
space:
mode:
authormskamp <msk@posteo.org>2024-08-04 09:32:40 +0200
committerGitHub <noreply@github.com>2024-08-04 09:32:40 +0200
commit533190acdb9d2ed774f96a998b5c03be3df4f857 (patch)
treef4c3770826361ce7ea8b5c0a139c9bb720fb6b34 /llvm/lib/CodeGen/MachineScheduler.cpp
parent4aff3f6967eba11aced705e2772f3ad86f2adeef (diff)
downloadllvm-533190acdb9d2ed774f96a998b5c03be3df4f857.zip
llvm-533190acdb9d2ed774f96a998b5c03be3df4f857.tar.gz
llvm-533190acdb9d2ed774f96a998b5c03be3df4f857.tar.bz2
[InstCombine] Canonicalize Bit Testing by Shifting to Bit 0 (#101838)
Implement a new transformation that fold the bit-testing expression (icmp ne (and (lshr V B) 1) 0) to (icmp ne (and V (shl 1 B)) 0) for constant V. This rule already existed for non-constant V and constants other than 1; this restriction to non-constant V has been added in commit c3b2111d975a39d19f0c5d635e2961a4449c5a71 to fix an infinite loop. Avoid the infinite loop by allowing constant V only if the shift instruction is an lshr and the constant is 1. Also fold the negated variant of the LHS. This transformation necessitates an adaption of existing tests in `icmp-and-shift.ll` and `load-cmp.ll`. One test in `icmp-and-shift.ll`, which previously was a negative test, now gets folded. Rename it to indicate that it is a positive test. Alive proof: https://alive2.llvm.org/ce/z/vcJJTx Relates to issue #86813.
Diffstat (limited to 'llvm/lib/CodeGen/MachineScheduler.cpp')
0 files changed, 0 insertions, 0 deletions