[llvm] [loop-idiom] Forget outer loop scev when loop-idiom introduces memset… (PR #150916)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 29 03:36:37 PDT 2025
================
@@ -7421,6 +7422,13 @@ ScalarEvolution::getLoopProperties(const Loop *L) {
if (auto *SI = dyn_cast<StoreInst>(I))
return !SI->isSimple();
+ // 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;
+ }
+
return I->mayThrow() || I->mayWriteToMemory();
----------------
nikic wrote:
mayThrow() needs to be checked first, otherwise the early exit may bypass it.
https://github.com/llvm/llvm-project/pull/150916
More information about the llvm-commits
mailing list