[llvm] [InstCombine] Canonicalize Bit Testing (PR #101822)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 3 08:26:26 PDT 2024
================
@@ -1725,7 +1725,8 @@ Instruction *InstCombinerImpl::foldICmpAndShift(ICmpInst &Cmp,
// preferable because it allows the C2 << Y expression to be hoisted out of a
// loop if Y is invariant and X is not.
if (Shift->hasOneUse() && C1.isZero() && Cmp.isEquality() &&
- !Shift->isArithmeticShift() && !isa<Constant>(Shift->getOperand(0))) {
+ !Shift->isArithmeticShift() &&
+ ((!IsShl && C2.isOne()) || !isa<Constant>(Shift->getOperand(0)))) {
----------------
dtcxzyw wrote:
Can you split this change and corresponding tests into a separate PR?
https://github.com/llvm/llvm-project/pull/101822
More information about the llvm-commits
mailing list