Files
clang-p2996/llvm/test/Transforms/LoopVectorize/novect-lcssa-cfg-invalidation.ll
Florian Hahn ac03ae30cf [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.
2024-07-05 21:41:31 +01:00

43 lines
1.5 KiB
LLVM

; RUN: opt -S -passes="loop-vectorize,jump-threading" -debug-pass-manager < %s 2>&1 | FileCheck %s
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
; Checks what analyses are invalidated after Loop Vectorization when no actual
; vectorization happens, and the only change LV makes is LCSSA formation.
define i32 @novect(ptr %p) {
; CHECK: Running pass: LoopVectorizePass on novect
; CHECK-NOT: Invalidating analysis: ScalarEvolutionAnalysis on novect
; CHECK-NOT: Invalidating analysis: BranchProbabilityAnalysis on novect
; CHECK-NOT: Invalidating analysis: BlockFrequencyAnalysis on novect
; CHECK: Invalidating analysis: DemandedBitsAnalysis on novect
; CHECK-NOT: Invalidating analysis: LoopAccessAnalysis on novect
; CHECK: Running pass: JumpThreadingPass on novect
; CHECK: entry:
; CHECK: br label %middle
; CHECK: middle:
; CHECK: %iv = phi i32 [ 0, %entry ], [ %iv.next, %middle ]
; CHECK: %x = load volatile i32, ptr %p
; CHECK: %iv.next = add i32 %iv, 1
; CHECK: %cond = icmp slt i32 %iv, 1000
; CHECK: br i1 %cond, label %exit, label %middle
; CHECK: exit:
; CHECK: %x.lcssa = phi i32 [ %x, %middle ]
; CHECK: ret i32 %x.lcssa
entry:
br label %middle
middle:
%iv = phi i32 [0, %entry], [%iv.next, %middle]
%x = load volatile i32, ptr %p
%iv.next = add i32 %iv, 1
%cond = icmp slt i32 %iv, 1000
br i1 %cond, label %exit, label %middle
exit:
ret i32 %x
}