[llvm] [InstCombine] Fold `(icmp eq/ne (or (select cond, 0/NZ, 0/NZ), X), 0)` (PR #88183)
via llvm-commits
llvm-commits at lists.llvm.org
Fri May 10 22:35:47 PDT 2024
================
@@ -3483,6 +3483,56 @@ Instruction *InstCombinerImpl::foldICmpBinOpEqualityWithConstant(
Value *And = Builder.CreateAnd(BOp0, NotBOC);
return new ICmpInst(Pred, And, NotBOC);
}
+ // (icmp eq (or (select cond, 0, NonZero), Other))
+ // -> (and cond, (icmp eq Other, 0))
+ // (icmp ne (or (select cond, NonZero, 0), Other))
+ // -> (or cond, (icmp ne Other, 0))
+ // (icmp ne (or (select cond, 0, NonZero), Other))
+ // -> (or (not cond), (icmp ne Other, 0))
+ // (icmp eq (or (select cond, NonZero, 0), Other))
+ // -> (and (not cond), (icmp eq Other, 0))
----------------
goldsteinn wrote:
I'm not seeing this diff here...
https://github.com/llvm/llvm-project/pull/88183
More information about the llvm-commits
mailing list