1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 12:43:36 +01:00
llvm-mirror/test/Transforms/LoopVectorize/novect-lcssa-cfg-invalidation.ll
Max Kazantsev 864078facb [LoopVectorize] Preserve CFG analyses if CFG wasn't modified
One of transforms the loop vectorizer makes is LCSSA formation. In some cases it
is the only transform it makes. We should not drop CFG analyzes if only LCSSA was
formed and no actual CFG changes was made.

We should think of expanding this logic to other passes as well, and maybe make
it a part of PM framework.

Reviewed By: Florian Hahn
Differential Revision: https://reviews.llvm.org/D78360
2020-04-24 17:22:24 +07:00

45 lines
1.7 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(i32* %p) {
; CHECK: Running pass: LoopVectorizePass on novect
; CHECK: Invalidating all non-preserved analyses for: novect
; CHECK: Clearing all analysis results for: <possibly invalidated loop>
; CHECK: 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: Invalidating analysis: MemorySSAAnalysis 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, i32* %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, i32* %p
%iv.next = add i32 %iv, 1
%cond = icmp slt i32 %iv, 1000
br i1 %cond, label %exit, label %middle
exit:
ret i32 %x
}