[llvm] [LV] Compute SCEV for memcheck before unlinking (PR #160326)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 29 01:48:03 PDT 2025


================
@@ -2083,6 +2086,20 @@ Value *llvm::addRuntimeChecks(
           "stride.check");
       IsConflict = ChkBuilder.CreateOr(IsConflict, IsNegativeStride);
     }
+
+    if (AllChecksHoisted) {
+      AllChecksHoisted &= SE->isLoopInvariant(SE->getSCEV(A.Start), OuterLoop);
----------------
fhahn wrote:

Can we avoid going from IR value -> SCEV and just check the entries in `PointerChecks` for invariance?

Constructing SCEVs here for values that may be removed later may leave dangling IR value entries in the SCEV expression cache?

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


More information about the llvm-commits mailing list