[llvm] [Instcombine] Fold away shift in or reduction chain. (PR #137875)
David Green via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 30 12:09:55 PDT 2025
================
@@ -7742,6 +7765,11 @@ Instruction *InstCombinerImpl::visitICmpInst(ICmpInst &I) {
}
}
+ // icmp eq/ne or(shl(a), b), 0 -> icmp eq/ne or(a, b)
+ if (I.isEquality() && match(Op1, m_Zero()) && isa<Instruction>(Op0))
----------------
davemgreen wrote:
Thanks - I wasn't sure which of foldICmpEquality, foldICmpBinOp, foldICmpWithZero, foldICmpWithConstant or.. foldICmpInstWithConstant (?) it would live best in. I've moved it to the end of foldICmpWithZero (and had to move the function earlier in the file).
https://github.com/llvm/llvm-project/pull/137875
More information about the llvm-commits
mailing list