[llvm] ValueTracking: Use SimplifyQuery for computeConstantRange (PR #191726)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 12 09:41:59 PDT 2026


================
@@ -1317,8 +1317,10 @@ AliasResult BasicAAResult::aliasGEP(
     else
       GCD = APIntOps::GreatestCommonDivisor(GCD, ScaleForGCD.abs());
 
-    ConstantRange CR = computeConstantRange(Index.Val.V, /* ForSigned */ false,
-                                            true, &AC, Index.CxtI);
+    ConstantRange CR =
----------------
dtcxzyw wrote:

> I also don't know why computeConstantRange doesn't just fall back on computeKnownBits and computeConstantRangeIncludingKnownBits is separate

`computeConstantRange` was designed to be non-recursive (see `setLimitsForBinOp`). So it is expected to be much cheaper than `computeKnownBits`. For those transformations relying on precise range information, they should be implemented in CVP/SCCP.


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


More information about the llvm-commits mailing list