[llvm] [WIP][ScalarEvolution] Replace getSCEV call with computeConstantRange (PR #152769)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 8 12:43:28 PDT 2025


================
@@ -6945,7 +6945,16 @@ const ConstantRange &ScalarEvolution::getRangeRef(
         ConstantRange RangeFromOps(BitWidth, /*isFullSet=*/false);
 
         for (const auto &Op : Phi->operands()) {
-          auto OpRange = getRangeRef(getSCEV(Op), SignHint, Depth + 1);
+          ConstantRange OpRange = RangeFromOps;
+          if (auto *S = getExistingSCEV(Op)) {
+            OpRange = getRangeRef(S, SignHint, Depth + 1);
+          } else {
+            if (!Op->getType()->isIntOrIntVectorTy())
+              break;
+            SimplifyQuery SQ(DL, &DT, &AC, Phi, true);
----------------
nikic wrote:

This patch currently fails to bootstrap clang. Might be because of the wrong context... or some other problem.

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


More information about the llvm-commits mailing list