[llvm] [InstCombine] Generalizing icmp ne X, 0 to trunc X to i1 IIF X in range (0,2] (PR #184182)

Andreas Jonson via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 2 14:52:08 PST 2026


================
@@ -7088,6 +7084,12 @@ Instruction *InstCombinerImpl::foldICmpUsingKnownBits(ICmpInst &I) {
           *LHSC != Op0KnownZeroInverted)
         LHS = Op0;
 
+      if (Pred == CmpInst::ICMP_NE && Ty->isIntOrIntVectorTy() &&
+          Op0Known.getMaxValue() == 1)
+        return replaceInstUsesWith(I,
----------------
andjo403 wrote:

I do not understand what context you are talking about here

https://github.com/llvm/llvm-project/pull/184182


More information about the llvm-commits mailing list