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

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 11 08:46:55 PDT 2024


================
@@ -2821,11 +2819,10 @@ static Constant *computePointerICmp(CmpInst::Predicate Pred, Value *LHS,
     // the other operand can not be based on the alloc - if it were, then
     // the cmp itself would be a capture.
     Value *MI = nullptr;
-    if (isAllocLikeFn(LHS, TLI) &&
-        llvm::isKnownNonZero(RHS, DL, 0, nullptr, CxtI, DT))
+    if (isAllocLikeFn(LHS, TLI) && llvm::isKnownNonZero(RHS, /*Depth=*/0, Q))
       MI = LHS;
     else if (isAllocLikeFn(RHS, TLI) &&
-             llvm::isKnownNonZero(LHS, DL, 0, nullptr, CxtI, DT))
+             llvm::isKnownNonZero(LHS, /*Depth=*/0, Q))
----------------
dtcxzyw wrote:

See https://reviews.llvm.org/D19549. We didn't have AssumptionCache at that time.

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


More information about the llvm-commits mailing list