[llvm] [loop-idiom] Forget outer loop scev when loop-idiom introduces memset… (PR #150916)

Sushant Gokhale via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 5 04:33:28 PDT 2025


================
@@ -7421,7 +7422,17 @@ ScalarEvolution::getLoopProperties(const Loop *L) {
       if (auto *SI = dyn_cast<StoreInst>(I))
         return !SI->isSimple();
 
-      return I->mayThrow() || I->mayWriteToMemory();
+      if (I->mayThrow())
+        return true;
+
+      // Check if the function accesses inaccessible memory.
+      if (auto *CI = dyn_cast<CallInst>(I)) {
+        auto ME = CI->getMemoryEffects();
+        if (!isModSet(ME.getModRef(IRMemLocation::InaccessibleMem)))
+          return false;
+      }
----------------
sushgokh wrote:

done

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


More information about the llvm-commits mailing list