[llvm] [InstCombine] canonicalize sign bit checks (PR #122962)

Jacob Young via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 15 10:00:13 PST 2025


================
@@ -3133,7 +3133,9 @@ Instruction *InstCombinerImpl::foldICmpAddConstant(ICmpInst &Cmp,
 
   if (ICmpInst::isUnsigned(Pred) && Add->hasNoSignedWrap() &&
       C.isNonNegative() && (C - *C2).isNonNegative() &&
-      computeConstantRange(X, /*ForSigned=*/true).add(*C2).isAllNonNegative())
+      computeConstantRange(X, Add, /*ForSigned=*/true)
----------------
jacobly0 wrote:

Actually, I can just call the normal function with the arguments passed, the member doesn't actually improve anything.

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


More information about the llvm-commits mailing list