1 ; Test that the loop PM infrastructure is invalidated appropriately.
3 ; Check that we always nuke the LPM stuff when the loops themselves are
5 ; RUN: opt -disable-output -disable-verify -verify-cfg-preserved=0 -debug-pass-manager -aa-pipeline= %s 2>&1 \
6 ; RUN: -passes='loop(no-op-loop),invalidate<loops>,loop(no-op-loop)' \
7 ; RUN: | FileCheck %s --check-prefix=CHECK-LOOP-INV
9 ; If we ended up building the standard analyses, their invalidation should nuke
11 ; RUN: opt -disable-output -disable-verify -verify-cfg-preserved=0 -debug-pass-manager %s -aa-pipeline= 2>&1 \
12 ; RUN: -passes='loop(no-op-loop),invalidate<scalar-evolution>,loop(no-op-loop)' \
13 ; RUN: | FileCheck %s --check-prefix=CHECK-SCEV-INV
15 ; Also provide a test that can delete loops after populating analyses for them.
16 ; RUN: opt -disable-output -disable-verify -verify-cfg-preserved=0 -debug-pass-manager %s -aa-pipeline= 2>&1 \
17 ; RUN: -passes='loop(no-op-loop,loop-deletion),invalidate<scalar-evolution>,loop(no-op-loop)' \
18 ; RUN: | FileCheck %s --check-prefix=CHECK-SCEV-INV-AFTER-DELETE
20 define void @no_loops() {
21 ; CHECK-LOOP-INV: Running pass: LoopSimplifyPass
22 ; CHECK-LOOP-INV-NEXT: Running analysis: LoopAnalysis
23 ; CHECK-LOOP-INV-NEXT: Running analysis: DominatorTreeAnalysis
24 ; CHECK-LOOP-INV-NEXT: Running analysis: AssumptionAnalysis
25 ; CHECK-LOOP-INV-NEXT: Running pass: LCSSAPass
26 ; CHECK-LOOP-INV-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}LoopAnalysis
27 ; CHECK-LOOP-INV-NEXT: Invalidating analysis: LoopAnalysis
28 ; CHECK-LOOP-INV-NEXT: Running pass: LoopSimplifyPass
29 ; CHECK-LOOP-INV-NEXT: Running analysis: LoopAnalysis
30 ; CHECK-LOOP-INV-NEXT: Running pass: LCSSAPass
32 ; CHECK-SCEV-INV: Running pass: LoopSimplifyPass
33 ; CHECK-SCEV-INV-NEXT: Running analysis: LoopAnalysis
34 ; CHECK-SCEV-INV-NEXT: Running analysis: DominatorTreeAnalysis
35 ; CHECK-SCEV-INV-NEXT: Running analysis: AssumptionAnalysis
36 ; CHECK-SCEV-INV-NEXT: Running pass: LCSSAPass
37 ; CHECK-SCEV-INV-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}ScalarEvolutionAnalysis
38 ; CHECK-SCEV-INV-NEXT: Running pass: LoopSimplifyPass
39 ; CHECK-SCEV-INV-NEXT: Running pass: LCSSAPass
45 define void @one_loop(i1* %ptr) {
46 ; CHECK-LOOP-INV: Running pass: LoopSimplifyPass
47 ; CHECK-LOOP-INV-NEXT: Running analysis: LoopAnalysis
48 ; CHECK-LOOP-INV-NEXT: Running analysis: DominatorTreeAnalysis
49 ; CHECK-LOOP-INV-NEXT: Running analysis: AssumptionAnalysis
50 ; CHECK-LOOP-INV-NEXT: Running pass: LCSSAPass
51 ; CHECK-LOOP-INV-NEXT: Running analysis: AAManager
52 ; CHECK-LOOP-INV-NEXT: Running analysis: TargetLibraryAnalysis
53 ; CHECK-LOOP-INV-NEXT: Running analysis: ScalarEvolutionAnalysis
54 ; CHECK-LOOP-INV-NEXT: Running analysis: TargetIRAnalysis
55 ; CHECK-LOOP-INV-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Loop
56 ; CHECK-LOOP-INV-NEXT: Running pass: NoOpLoopPass
57 ; CHECK-LOOP-INV-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}LoopAnalysis
58 ; CHECK-LOOP-INV-NEXT: Clearing all analysis results for: <possibly invalidated loop>
59 ; CHECK-LOOP-INV-NEXT: Invalidating analysis: LoopAnalysis
60 ; CHECK-LOOP-INV-NEXT: Invalidating analysis: ScalarEvolutionAnalysis
61 ; CHECK-LOOP-INV-NEXT: Invalidating analysis: InnerAnalysisManagerProxy<{{.*}}Loop
62 ; CHECK-LOOP-INV-NEXT: Running pass: LoopSimplifyPass
63 ; CHECK-LOOP-INV-NEXT: Running analysis: LoopAnalysis
64 ; CHECK-LOOP-INV-NEXT: Running pass: LCSSAPass
65 ; CHECK-LOOP-INV-NEXT: Running analysis: ScalarEvolutionAnalysis
66 ; CHECK-LOOP-INV-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Loop
67 ; CHECK-LOOP-INV-NEXT: Running pass: NoOpLoopPass
69 ; CHECK-SCEV-INV-NEXT: Running pass: LoopSimplifyPass
70 ; CHECK-SCEV-INV-NEXT: Running analysis: LoopAnalysis
71 ; CHECK-SCEV-INV-NEXT: Running analysis: DominatorTreeAnalysis
72 ; CHECK-SCEV-INV-NEXT: Running analysis: AssumptionAnalysis
73 ; CHECK-SCEV-INV-NEXT: Running pass: LCSSAPass
74 ; CHECK-SCEV-INV-NEXT: Running analysis: AAManager
75 ; CHECK-SCEV-INV-NEXT: Running analysis: TargetLibraryAnalysis
76 ; CHECK-SCEV-INV-NEXT: Running analysis: ScalarEvolutionAnalysis
77 ; CHECK-SCEV-INV-NEXT: Running analysis: TargetIRAnalysis
78 ; CHECK-SCEV-INV-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Loop
79 ; CHECK-SCEV-INV-NEXT: Running pass: NoOpLoopPass
80 ; CHECK-SCEV-INV-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}ScalarEvolutionAnalysis
81 ; CHECK-SCEV-INV-NEXT: Clearing all analysis results for: <possibly invalidated loop>
82 ; CHECK-SCEV-INV-NEXT: Invalidating analysis: ScalarEvolutionAnalysis
83 ; CHECK-SCEV-INV-NEXT: Invalidating analysis: InnerAnalysisManagerProxy<{{.*}}Loop
84 ; CHECK-SCEV-INV-NEXT: Running pass: LoopSimplifyPass
85 ; CHECK-SCEV-INV-NEXT: Running pass: LCSSAPass
86 ; CHECK-SCEV-INV-NEXT: Running analysis: ScalarEvolutionAnalysis
87 ; CHECK-SCEV-INV-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Loop
88 ; CHECK-SCEV-INV-NEXT: Running pass: NoOpLoopPass
94 %flag0 = load volatile i1, i1* %ptr
95 br i1 %flag0, label %l0.header, label %exit
101 define void @nested_loops(i1* %ptr) {
102 ; CHECK-LOOP-INV: Running pass: LoopSimplifyPass
103 ; CHECK-LOOP-INV-NEXT: Running analysis: LoopAnalysis
104 ; CHECK-LOOP-INV-NEXT: Running analysis: DominatorTreeAnalysis
105 ; CHECK-LOOP-INV-NEXT: Running analysis: AssumptionAnalysis
106 ; CHECK-LOOP-INV-NEXT: Running pass: LCSSAPass
107 ; CHECK-LOOP-INV-NEXT: Running analysis: AAManager
108 ; CHECK-LOOP-INV-NEXT: Running analysis: TargetLibraryAnalysis
109 ; CHECK-LOOP-INV-NEXT: Running analysis: ScalarEvolutionAnalysis
110 ; CHECK-LOOP-INV-NEXT: Running analysis: TargetIRAnalysis
111 ; CHECK-LOOP-INV-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Loop
112 ; CHECK-LOOP-INV-NEXT: Running pass: NoOpLoopPass
113 ; CHECK-LOOP-INV-NEXT: Running pass: NoOpLoopPass
114 ; CHECK-LOOP-INV-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}LoopAnalysis
115 ; CHECK-LOOP-INV-NEXT: Clearing all analysis results for: <possibly invalidated loop>
116 ; CHECK-LOOP-INV-NEXT: Clearing all analysis results for: <possibly invalidated loop>
117 ; CHECK-LOOP-INV-NEXT: Invalidating analysis: LoopAnalysis
118 ; CHECK-LOOP-INV-NEXT: Invalidating analysis: ScalarEvolutionAnalysis
119 ; CHECK-LOOP-INV-NEXT: Invalidating analysis: InnerAnalysisManagerProxy<{{.*}}Loop
120 ; CHECK-LOOP-INV-NEXT: Running pass: LoopSimplifyPass
121 ; CHECK-LOOP-INV-NEXT: Running analysis: LoopAnalysis
122 ; CHECK-LOOP-INV-NEXT: Running pass: LCSSAPass
123 ; CHECK-LOOP-INV-NEXT: Running analysis: ScalarEvolutionAnalysis
124 ; CHECK-LOOP-INV-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Loop
125 ; CHECK-LOOP-INV-NEXT: Running pass: NoOpLoopPass
126 ; CHECK-LOOP-INV-NEXT: Running pass: NoOpLoopPass
128 ; CHECK-SCEV-INV: Running pass: LoopSimplifyPass
129 ; CHECK-SCEV-INV-NEXT: Running analysis: LoopAnalysis
130 ; CHECK-SCEV-INV-NEXT: Running analysis: DominatorTreeAnalysis
131 ; CHECK-SCEV-INV-NEXT: Running analysis: AssumptionAnalysis
132 ; CHECK-SCEV-INV-NEXT: Running pass: LCSSAPass
133 ; CHECK-SCEV-INV-NEXT: Running analysis: AAManager
134 ; CHECK-SCEV-INV-NEXT: Running analysis: TargetLibraryAnalysis
135 ; CHECK-SCEV-INV-NEXT: Running analysis: ScalarEvolutionAnalysis
136 ; CHECK-SCEV-INV-NEXT: Running analysis: TargetIRAnalysis
137 ; CHECK-SCEV-INV-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Loop
138 ; CHECK-SCEV-INV-NEXT: Running pass: NoOpLoopPass
139 ; CHECK-SCEV-INV-NEXT: Running pass: NoOpLoopPass
140 ; CHECK-SCEV-INV-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}ScalarEvolutionAnalysis
141 ; CHECK-SCEV-INV-NEXT: Clearing all analysis results for: <possibly invalidated loop>
142 ; CHECK-SCEV-INV-NEXT: Clearing all analysis results for: <possibly invalidated loop>
143 ; CHECK-SCEV-INV-NEXT: Invalidating analysis: ScalarEvolutionAnalysis
144 ; CHECK-SCEV-INV-NEXT: Invalidating analysis: InnerAnalysisManagerProxy<{{.*}}Loop
145 ; CHECK-SCEV-INV-NEXT: Running pass: LoopSimplifyPass
146 ; CHECK-SCEV-INV-NEXT: Running pass: LCSSAPass
147 ; CHECK-SCEV-INV-NEXT: Running analysis: ScalarEvolutionAnalysis
148 ; CHECK-SCEV-INV-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Loop
149 ; CHECK-SCEV-INV-NEXT: Running pass: NoOpLoopPass
150 ; CHECK-SCEV-INV-NEXT: Running pass: NoOpLoopPass
156 br label %l.0.0.header
159 %flag.0.0 = load volatile i1, i1* %ptr
160 br i1 %flag.0.0, label %l.0.0.header, label %l.0.latch
163 %flag.0 = load volatile i1, i1* %ptr
164 br i1 %flag.0, label %l.0.header, label %exit
170 define void @dead_loop() {
171 ; CHECK-LOOP-INV: Running pass: LoopSimplifyPass
172 ; CHECK-LOOP-INV-NEXT: Running analysis: LoopAnalysis
173 ; CHECK-LOOP-INV-NEXT: Running analysis: DominatorTreeAnalysis
174 ; CHECK-LOOP-INV-NEXT: Running analysis: AssumptionAnalysis
175 ; CHECK-LOOP-INV-NEXT: Running pass: LCSSAPass
176 ; CHECK-LOOP-INV-NEXT: Running analysis: AAManager
177 ; CHECK-LOOP-INV-NEXT: Running analysis: TargetLibraryAnalysis
178 ; CHECK-LOOP-INV-NEXT: Running analysis: ScalarEvolutionAnalysis
179 ; CHECK-LOOP-INV-NEXT: Running analysis: TargetIRAnalysis
180 ; CHECK-LOOP-INV-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Loop
181 ; CHECK-LOOP-INV-NEXT: Running pass: NoOpLoopPass
182 ; CHECK-LOOP-INV-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}LoopAnalysis
183 ; CHECK-LOOP-INV-NEXT: Clearing all analysis results for: <possibly invalidated loop>
184 ; CHECK-LOOP-INV-NEXT: Invalidating analysis: LoopAnalysis
185 ; CHECK-LOOP-INV-NEXT: Invalidating analysis: ScalarEvolutionAnalysis
186 ; CHECK-LOOP-INV-NEXT: Invalidating analysis: InnerAnalysisManagerProxy<{{.*}}Loop
187 ; CHECK-LOOP-INV-NEXT: Running pass: LoopSimplifyPass
188 ; CHECK-LOOP-INV-NEXT: Running analysis: LoopAnalysis
189 ; CHECK-LOOP-INV-NEXT: Running pass: LCSSAPass
190 ; CHECK-LOOP-INV-NEXT: Running analysis: ScalarEvolutionAnalysis
191 ; CHECK-LOOP-INV-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Loop
192 ; CHECK-LOOP-INV-NEXT: Running pass: NoOpLoopPass
194 ; CHECK-SCEV-INV: Running pass: LoopSimplifyPass
195 ; CHECK-SCEV-INV-NEXT: Running analysis: LoopAnalysis
196 ; CHECK-SCEV-INV-NEXT: Running analysis: DominatorTreeAnalysis
197 ; CHECK-SCEV-INV-NEXT: Running analysis: AssumptionAnalysis
198 ; CHECK-SCEV-INV-NEXT: Running pass: LCSSAPass
199 ; CHECK-SCEV-INV-NEXT: Running analysis: AAManager
200 ; CHECK-SCEV-INV-NEXT: Running analysis: TargetLibraryAnalysis
201 ; CHECK-SCEV-INV-NEXT: Running analysis: ScalarEvolutionAnalysis
202 ; CHECK-SCEV-INV-NEXT: Running analysis: TargetIRAnalysis
203 ; CHECK-SCEV-INV-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Loop
204 ; CHECK-SCEV-INV-NEXT: Running pass: NoOpLoopPass
205 ; CHECK-SCEV-INV-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}ScalarEvolutionAnalysis
206 ; CHECK-SCEV-INV-NEXT: Clearing all analysis results for: <possibly invalidated loop>
207 ; CHECK-SCEV-INV-NEXT: Invalidating analysis: ScalarEvolutionAnalysis
208 ; CHECK-SCEV-INV-NEXT: Invalidating analysis: InnerAnalysisManagerProxy<{{.*}}Loop
209 ; CHECK-SCEV-INV-NEXT: Running pass: LoopSimplifyPass
210 ; CHECK-SCEV-INV-NEXT: Running pass: LCSSAPass
211 ; CHECK-SCEV-INV-NEXT: Running analysis: ScalarEvolutionAnalysis
212 ; CHECK-SCEV-INV-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Loop
213 ; CHECK-SCEV-INV-NEXT: Running pass: NoOpLoopPass
215 ; CHECK-SCEV-INV-AFTER-DELETE-LABEL: Running pass: LoopSimplifyPass on dead_loop
216 ; CHECK-SCEV-INV-AFTER-DELETE-NEXT: Running analysis: LoopAnalysis
217 ; CHECK-SCEV-INV-AFTER-DELETE-NEXT: Running analysis: DominatorTreeAnalysis
218 ; CHECK-SCEV-INV-AFTER-DELETE-NEXT: Running analysis: AssumptionAnalysis
219 ; CHECK-SCEV-INV-AFTER-DELETE-NEXT: Running pass: LCSSAPass
220 ; CHECK-SCEV-INV-AFTER-DELETE-NEXT: Running analysis: AAManager
221 ; CHECK-SCEV-INV-AFTER-DELETE-NEXT: Running analysis: TargetLibraryAnalysis
222 ; CHECK-SCEV-INV-AFTER-DELETE-NEXT: Running analysis: ScalarEvolutionAnalysis
223 ; CHECK-SCEV-INV-AFTER-DELETE-NEXT: Running analysis: TargetIRAnalysis
224 ; CHECK-SCEV-INV-AFTER-DELETE-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Loop
225 ; CHECK-SCEV-INV-AFTER-DELETE-NEXT: Running pass: NoOpLoopPass
226 ; CHECK-SCEV-INV-AFTER-DELETE-NEXT: Running pass: LoopDeletionPass
227 ; CHECK-SCEV-INV-AFTER-DELETE-NEXT: Clearing all analysis results for:
228 ; CHECK-SCEV-INV-AFTER-DELETE-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}ScalarEvolutionAnalysis
229 ; CHECK-SCEV-INV-AFTER-DELETE-NEXT: Invalidating analysis: ScalarEvolutionAnalysis
230 ; CHECK-SCEV-INV-AFTER-DELETE-NEXT: Invalidating analysis: InnerAnalysisManagerProxy<{{.*}}Loop
231 ; CHECK-SCEV-INV-AFTER-DELETE-NEXT: Running pass: LoopSimplifyPass
232 ; CHECK-SCEV-INV-AFTER-DELETE-NEXT: Running pass: LCSSAPass
238 br i1 false, label %l0.header, label %exit