[llvm] [LoopSink] check conflicting preheader memory access before sink (PR #195510)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Sun May 3 10:30:13 PDT 2026
================
@@ -179,6 +179,25 @@ findBBsToSinkInto(const Loop &L, const SmallPtrSetImpl<BasicBlock *> &UseBBs,
return BBsToSinkInto;
}
+/// Returns true when an \p I from the \p PreheaderBB has conflicting memory
+/// access over the later preheader instructions.
+static bool hasConflictingPreheaderMemoryAccess(Instruction &I, AAResults *AA,
+ BasicBlock *PreheaderBB) {
+ if (!I.mayReadOrWriteMemory())
+ return false;
+
+ for (Instruction &OtherI : make_range(I.getIterator(), PreheaderBB->end())) {
+ if (!OtherI.mayReadOrWriteMemory())
+ continue;
+ if (!I.mayWriteToMemory() && !OtherI.mayWriteToMemory())
+ continue;
+ if (!AA || isModOrRefSet(AA->getModRefInfo(&I, &OtherI)))
----------------
nikic wrote:
Arguments are the wrong way around.
https://github.com/llvm/llvm-project/pull/195510
More information about the llvm-commits
mailing list