[llvm] [InstCombine] fold `(a == 1 && b != 0) || (a != 0 && b == 0))` to `(a ==0) != (b == 0)` (PR #94915)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 19 01:03:00 PDT 2024
================
@@ -3421,6 +3421,42 @@ Value *InstCombinerImpl::foldAndOrOfICmps(ICmpInst *LHS, ICmpInst *RHS,
return foldAndOrOfICmpsUsingRanges(LHS, RHS, IsAnd);
}
+Value *foldAorBZero(BinaryOperator &I, InstCombiner::BuilderTy &Builder) {
+ Value *Op0 = I.getOperand(0);
+ Value *Op1 = I.getOperand(1);
+ if (!Op0->hasOneUse() || !Op1->hasOneUse())
----------------
nikic wrote:
Wrap matchers below with `m_OneUse()` instead.
https://github.com/llvm/llvm-project/pull/94915
More information about the llvm-commits
mailing list