[llvm] [LAA] Catch load/store to invariant address in dependency checker. (PR #187023)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 20 08:58:47 PDT 2026
================
@@ -2833,6 +2844,25 @@ bool LoopAccessInfo::analyzeLoop(AAResults *AA, const LoopInfo *LI,
}
}
+ // Update the invariant address dependence flags based on dependences found
+ // by the dep checker. Even if dependences were not recorded (too many to
+ // track), any InvariantUnsafe dep would still have set the status to Unsafe
+ if (const auto *Deps = DepChecker->getDependences()) {
+ for (const auto &Dep : *Deps) {
+ if (Dep.Type != MemoryDepChecker::Dependence::InvariantUnsafe)
+ continue;
+ Instruction *Src = Dep.getSource(*DepChecker);
+ Instruction *Dst = Dep.getDestination(*DepChecker);
+ if (isa<LoadInst>(Src) != isa<LoadInst>(Dst))
+ HasLoadStoreDependenceInvolvingLoopInvariantAddress = true;
+ else {
+ assert(isa<StoreInst>(Src) && isa<StoreInst>(Dst) &&
+ "Expected both to be stores");
+ HasStoreStoreDependenceInvolvingLoopInvariantAddress = true;
+ }
+ }
+ }
----------------
artagnon wrote:
It would be nice if we could unify this code with code above that sets the two variables as @lukel97 also mentioned, but if you want to do it as a follow-up, could you add a TODO/FIXME here?
https://github.com/llvm/llvm-project/pull/187023
More information about the llvm-commits
mailing list