aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/LoopAccessAnalysis.cpp
diff options
context:
space:
mode:
authorFlorian Hahn <flo@fhahn.com>2024-08-21 08:28:52 +0100
committerFlorian Hahn <flo@fhahn.com>2024-08-21 08:28:52 +0100
commitd7c84d7b71fc5ea89b87480ff5d727496288799c (patch)
tree11ce65abea2edd02ae0a1c6adc130fd9091ef900 /llvm/lib/Analysis/LoopAccessAnalysis.cpp
parent89b1468345a74d2095616a8be2306cf0b08fa43a (diff)
downloadllvm-d7c84d7b71fc5ea89b87480ff5d727496288799c.zip
llvm-d7c84d7b71fc5ea89b87480ff5d727496288799c.tar.gz
llvm-d7c84d7b71fc5ea89b87480ff5d727496288799c.tar.bz2
[LAA] Collect loop guards only once in MemoryDepChecker (NFCI).
This on its own gives small compile-time improvements in some configs and enables using loop guards at more places in the future while keeping compile-time impact low. https://llvm-compile-time-tracker.com/compare.php?from=c44202574ff9a8c0632aba30c2765b134557435f&to=55ffc3dd920fa9af439fd39f8f9cc13509531420&stat=instructions:u
Diffstat (limited to 'llvm/lib/Analysis/LoopAccessAnalysis.cpp')
-rw-r--r--llvm/lib/Analysis/LoopAccessAnalysis.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
index 872bc52..980f142 100644
--- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp
+++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
@@ -2054,8 +2054,12 @@ MemoryDepChecker::isDependent(const MemAccessInfo &A, unsigned AIdx,
LLVM_DEBUG(dbgs() << "LAA: Strided accesses are independent\n");
return Dependence::NoDep;
}
- } else
- Dist = SE.applyLoopGuards(Dist, InnermostLoop);
+ } else {
+ if (!LoopGuards)
+ LoopGuards.emplace(
+ ScalarEvolution::LoopGuards::collect(InnermostLoop, SE));
+ Dist = SE.applyLoopGuards(Dist, *LoopGuards);
+ }
// Negative distances are not plausible dependencies.
if (SE.isKnownNonPositive(Dist)) {