Skip to content

Commit

Permalink
[LV] Preserve LAA in LoopVectorize (NFCI).
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
fhahn committed Jul 5, 2024
1 parent c2fbc70 commit ac03ae3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit ac03ae3

Please sign in to comment.