[llvm] [ValueTracking] Convert `isKnownNonZero` to use SimplifyQuery (PR #85863)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 21 06:24:40 PDT 2024


================
@@ -1771,11 +1771,14 @@ Instruction *InstCombinerImpl::foldICmpAndConstConst(ICmpInst &Cmp,
       return new ICmpInst(NewPred, X, Zero);
     }
 
-    APInt NewC2 = *C2;
     KnownBits Know = computeKnownBits(And->getOperand(0), 0, And);
+    if (Know.One.intersects(*C2))
+      return replaceInstUsesWith(
+          Cmp, ConstantInt::getBool(Cmp.getType(), isICMP_NE));
----------------
dtcxzyw wrote:

Fixed by converting `isKnownZero` to use SimplifyQuery.

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


More information about the llvm-commits mailing list