1 ;RUN: opt %s -passes='adce,loop(rotate),adce' -S -debug-pass-manager -debug-only=loop-rotate 2>&1 | FileCheck %s
2 ;RUN: opt %s -passes='adce,loop-mssa(rotate),adce' -S -debug-pass-manager -debug-only=loop-rotate -verify-memoryssa 2>&1 | FileCheck %s --check-prefix=MSSA
5 ; This test is to make sure we invalidate the post dominator pass after loop rotate simplifies the loop latch.
6 ; The adce passes are here to make sure post dominator analysis is required.
8 ; CHECK: Starting llvm::Function pass manager run.
9 ; CHECK-NEXT: Running pass: ADCEPass on f
10 ; CHECK-NEXT: Running analysis: PostDominatorTreeAnalysis on f
11 ; CHECK-NEXT: Running pass: FunctionToLoopPassAdaptor{{.*}} on f
12 ; CHECK-NEXT: Starting llvm::Function pass manager run.
13 ; CHECK-NEXT: Running pass: LoopSimplifyPass on f
14 ; CHECK-NEXT: Running analysis: LoopAnalysis on f
15 ; CHECK-NEXT: Running analysis: DominatorTreeAnalysis on f
16 ; CHECK-NEXT: Running analysis: AssumptionAnalysis on f
17 ; CHECK-NEXT: Running pass: LCSSAPass on f
18 ; CHECK-NEXT: Finished llvm::Function pass manager run.
19 ; CHECK-NEXT: Running analysis: AAManager on f
20 ; CHECK-NEXT: Running analysis: TargetLibraryAnalysis on f
21 ; CHECK-NEXT: Running analysis: ScalarEvolutionAnalysis on f
22 ; CHECK-NEXT: Running analysis: TargetIRAnalysis on f
23 ; CHECK-NEXT: Running analysis: InnerAnalysisManagerProxy{{.*}} on f
24 ; CHECK-NEXT: Starting Loop pass manager run.
25 ; CHECK-NEXT: Running analysis: PassInstrumentationAnalysis on bb
26 ; CHECK-NEXT: Running pass: LoopRotatePass on Loop at depth 1 containing: %bb<header><exiting>,%bb4<latch>
27 ; CHECK-NEXT: Folding loop latch bb4 into bb
28 ; CHECK-NEXT: Invalidating all non-preserved analyses for: bb
29 ; CHECK-NEXT: Finished Loop pass manager run.
30 ; CHECK-NEXT: Invalidating all non-preserved analyses for: f
31 ; CHECK-NEXT: Invalidating analysis: PostDominatorTreeAnalysis on f
32 ; CHECK-NEXT: Running pass: ADCEPass on f
33 ; CHECK-NEXT: Running analysis: PostDominatorTreeAnalysis on f
34 ; CHECK-NEXT: Finished llvm::Function pass manager run.
36 ; MSSA: Starting llvm::Function pass manager run.
37 ; MSSA-NEXT: Running pass: ADCEPass on f
38 ; MSSA-NEXT: Running analysis: PostDominatorTreeAnalysis on f
39 ; MSSA-NEXT: Running pass: FunctionToLoopPassAdaptor{{.*}} on f
40 ; MSSA-NEXT: Starting llvm::Function pass manager run.
41 ; MSSA-NEXT: Running pass: LoopSimplifyPass on f
42 ; MSSA-NEXT: Running analysis: LoopAnalysis on f
43 ; MSSA-NEXT: Running analysis: DominatorTreeAnalysis on f
44 ; MSSA-NEXT: Running analysis: AssumptionAnalysis on f
45 ; MSSA-NEXT: Running pass: LCSSAPass on f
46 ; MSSA-NEXT: Finished llvm::Function pass manager run.
47 ; MSSA-NEXT: Running analysis: MemorySSAAnalysis on f
48 ; MSSA-NEXT: Running analysis: AAManager on f
49 ; MSSA-NEXT: Running analysis: TargetLibraryAnalysis on f
50 ; MSSA-NEXT: Running analysis: ScalarEvolutionAnalysis on f
51 ; MSSA-NEXT: Running analysis: TargetIRAnalysis on f
52 ; MSSA-NEXT: Running analysis: InnerAnalysisManagerProxy{{.*}} on f
53 ; MSSA-NEXT: Starting Loop pass manager run.
54 ; MSSA-NEXT: Running analysis: PassInstrumentationAnalysis on bb
55 ; MSSA-NEXT: Running pass: LoopRotatePass on Loop at depth 1 containing: %bb<header><exiting>,%bb4<latch>
56 ; MSSA-NEXT: Folding loop latch bb4 into bb
57 ; MSSA-NEXT: Invalidating all non-preserved analyses for: bb
58 ; MSSA-NEXT: Finished Loop pass manager run.
59 ; MSSA-NEXT: Invalidating all non-preserved analyses for: f
60 ; MSSA-NEXT: Invalidating analysis: PostDominatorTreeAnalysis on f
61 ; MSSA-NEXT: Running pass: ADCEPass on f
62 ; MSSA-NEXT: Running analysis: PostDominatorTreeAnalysis on f
63 ; MSSA-NEXT: Finished llvm::Function pass manager run.
66 ; CHECK-LABEL: define i8 @f() {
68 ; CHECK-NEXT : br label %bb
70 ; CHECK-NEXT : bb: ; preds = %bb, %entry
71 ; CHECK-NEXT : %mode.0 = phi i8 [ 0, %entry ], [ %indvar.next, %bb ]
72 ; CHECK-NEXT : %tmp5 = icmp eq i8 %mode.0, 1
73 ; CHECK-NEXT : %indvar.next = add i8 %mode.0, 1
74 ; CHECK-NEXT : br i1 %tmp5, label %bb5, label %bb
76 ; CHECK-NEXT : bb5: ; preds = %bb
77 ; CHECK-NEXT : tail call void @raise_exception() #0
78 ; CHECK-NEXT : unreachable
81 ; CHECK-NEXT : ; Function Attrs: noreturn
82 ; CHECK-NEXT : declare void @raise_exception() #0
84 ; CHECK-NEXT : attributes #0 = { noreturn }
86 ; MSSA-LABEL: define i8 @f() {
88 ; MSSA-NEXT : br label %bb
90 ; MSSA-NEXT : bb: ; preds = %bb, %entry
91 ; MSSA-NEXT : %mode.0 = phi i8 [ 0, %entry ], [ %indvar.next, %bb ]
92 ; MSSA-NEXT : %tmp5 = icmp eq i8 %mode.0, 1
93 ; MSSA-NEXT : %indvar.next = add i8 %mode.0, 1
94 ; MSSA-NEXT : br i1 %tmp5, label %bb5, label %bb
96 ; MSSA-NEXT : bb5: ; preds = %bb
97 ; MSSA-NEXT : tail call void @raise_exception() #0
98 ; MSSA-NEXT : unreachable
101 ; MSSA-NEXT : ; Function Attrs: noreturn
102 ; MSSA-NEXT : declare void @raise_exception() #0
104 ; MSSA-NEXT : attributes #0 = { noreturn }
110 bb: ; preds = %bb4, %entry
111 %mode.0 = phi i8 [ 0, %entry ], [ %indvar.next, %bb4 ]
112 %tmp5 = icmp eq i8 %mode.0, 1
113 br i1 %tmp5, label %bb5, label %bb4
116 %indvar.next = add i8 %mode.0, 1
120 tail call void @raise_exception() #0
124 ; Function Attrs: noreturn
125 declare void @raise_exception() #0
127 attributes #0 = { noreturn }