[llvm] [SCEV] Collect loop guards once in getSmallConstantTripMultiple (NFC). (PR #219722)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 31 01:54:35 PDT 2026


================
@@ -8437,6 +8443,14 @@ unsigned ScalarEvolution::getSmallConstantTripMultiple(const Loop *L,
              : (unsigned)Multiple.getZExtValue();
 }
 
+unsigned ScalarEvolution::getSmallConstantTripMultiple(const Loop *L,
+                                                       const SCEV *ExitCount) {
+  if (isa<SCEVCouldNotCompute>(ExitCount))
+    return 1;
+
+  return getSmallConstantTripMultiple(ExitCount, LoopGuards::collect(L, *this));
+}
----------------
fhahn wrote:

I am not sure I follow; this change should be transparent, and retains the original behavior for callers that call `getSmallConstantTripMultiple` with an exit count directly.

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


More information about the llvm-commits mailing list