aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Hahn <flo@fhahn.com>2024-07-05 21:41:30 +0100
committerFlorian Hahn <flo@fhahn.com>2024-07-05 21:41:31 +0100
commitac03ae30cf2b6465ea8f117dfa74ba6f670f6258 (patch)
tree8f13cef2e9bb8c3cc23304a6039afa5d812e2f20
parentc2fbc701aaf826e2015a5dcab36e3ba792e7da7f (diff)
downloadllvm-ac03ae30cf2b6465ea8f117dfa74ba6f670f6258.zip
llvm-ac03ae30cf2b6465ea8f117dfa74ba6f670f6258.tar.gz
llvm-ac03ae30cf2b6465ea8f117dfa74ba6f670f6258.tar.bz2
[LV] Preserve LAA in LoopVectorize (NFCI).
LoopVectorize already always preserves DT, LI and SCEV. If any changes get made to the CFG, cached LAA info for loops are cleared. LoopAccessAnalysis also implements ::invalidate to clear the analysis if SE, DT or LI gets invalidated. Hence it should be safe to preserve LAA and save a small amount of compile-time.
-rw-r--r--llvm/lib/Transforms/Vectorize/LoopVectorize.cpp1
-rw-r--r--llvm/test/Transforms/LoopVectorize/novect-lcssa-cfg-invalidation.ll2
2 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 56fb8a1..1423deb 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -10258,6 +10258,7 @@ PreservedAnalyses LoopVectorizePass::run(Function &F,
PA.preserve<LoopAnalysis>();
PA.preserve<DominatorTreeAnalysis>();
PA.preserve<ScalarEvolutionAnalysis>();
+ PA.preserve<LoopAccessAnalysis>();
if (Result.MadeCFGChange) {
// Making CFG changes likely means a loop got vectorized. Indicate that
diff --git a/llvm/test/Transforms/LoopVectorize/novect-lcssa-cfg-invalidation.ll b/llvm/test/Transforms/LoopVectorize/novect-lcssa-cfg-invalidation.ll
index c78e005..48fa1986 100644
--- a/llvm/test/Transforms/LoopVectorize/novect-lcssa-cfg-invalidation.ll
+++ b/llvm/test/Transforms/LoopVectorize/novect-lcssa-cfg-invalidation.ll
@@ -12,7 +12,7 @@ define i32 @novect(ptr %p) {
; CHECK-NOT: Invalidating analysis: BranchProbabilityAnalysis on novect
; CHECK-NOT: Invalidating analysis: BlockFrequencyAnalysis on novect
; CHECK: Invalidating analysis: DemandedBitsAnalysis on novect
-; CHECK: Invalidating analysis: LoopAccessAnalysis on novect
+; CHECK-NOT: Invalidating analysis: LoopAccessAnalysis on novect
; CHECK: Running pass: JumpThreadingPass on novect
; CHECK: entry: