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-analysis-invalidation=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-analysis-invalidation=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-analysis-invalidation=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 analysis: TargetIRAnalysis
26 ; CHECK-LOOP-INV-NEXT: Running pass: LCSSAPass
27 ; CHECK-LOOP-INV-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}LoopAnalysis
28 ; CHECK-LOOP-INV-NEXT: Invalidating analysis: LoopAnalysis
29 ; CHECK-LOOP-INV-NEXT: Running pass: LoopSimplifyPass
30 ; CHECK-LOOP-INV-NEXT: Running analysis: LoopAnalysis
31 ; CHECK-LOOP-INV-NEXT: Running pass: LCSSAPass
33 ; CHECK-SCEV-INV: Running pass: LoopSimplifyPass
34 ; CHECK-SCEV-INV-NEXT: Running analysis: LoopAnalysis
35 ; CHECK-SCEV-INV-NEXT: Running analysis: DominatorTreeAnalysis
36 ; CHECK-SCEV-INV-NEXT: Running analysis: AssumptionAnalysis
37 ; CHECK-SCEV-INV-NEXT: Running analysis: TargetIRAnalysis
38 ; CHECK-SCEV-INV-NEXT: Running pass: LCSSAPass
39 ; CHECK-SCEV-INV-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}ScalarEvolutionAnalysis
40 ; CHECK-SCEV-INV-NEXT: Running pass: LoopSimplifyPass
41 ; CHECK-SCEV-INV-NEXT: Running pass: LCSSAPass
47 define void @one_loop(ptr %ptr) {
48 ; CHECK-LOOP-INV: Running pass: LoopSimplifyPass
49 ; CHECK-LOOP-INV-NEXT: Running analysis: LoopAnalysis
50 ; CHECK-LOOP-INV-NEXT: Running analysis: DominatorTreeAnalysis
51 ; CHECK-LOOP-INV-NEXT: Running analysis: AssumptionAnalysis
52 ; CHECK-LOOP-INV-NEXT: Running analysis: TargetIRAnalysis
53 ; CHECK-LOOP-INV-NEXT: Running pass: LCSSAPass
54 ; CHECK-LOOP-INV-NEXT: Running analysis: AAManager
55 ; CHECK-LOOP-INV-NEXT: Running analysis: TargetLibraryAnalysis
56 ; CHECK-LOOP-INV-NEXT: Running analysis: ScalarEvolutionAnalysis
57 ; CHECK-LOOP-INV-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Loop
58 ; CHECK-LOOP-INV-NEXT: Running pass: NoOpLoopPass
59 ; CHECK-LOOP-INV-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}LoopAnalysis
60 ; CHECK-LOOP-INV-NEXT: Clearing all analysis results for: <possibly invalidated loop>
61 ; CHECK-LOOP-INV-NEXT: Invalidating analysis: LoopAnalysis
62 ; CHECK-LOOP-INV-NEXT: Invalidating analysis: ScalarEvolutionAnalysis
63 ; CHECK-LOOP-INV-NEXT: Invalidating analysis: InnerAnalysisManagerProxy<{{.*}}Loop
64 ; CHECK-LOOP-INV-NEXT: Running pass: LoopSimplifyPass
65 ; CHECK-LOOP-INV-NEXT: Running analysis: LoopAnalysis
66 ; CHECK-LOOP-INV-NEXT: Running pass: LCSSAPass
67 ; CHECK-LOOP-INV-NEXT: Running analysis: ScalarEvolutionAnalysis
68 ; CHECK-LOOP-INV-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Loop
69 ; CHECK-LOOP-INV-NEXT: Running pass: NoOpLoopPass
71 ; CHECK-SCEV-INV-NEXT: Running pass: LoopSimplifyPass
72 ; CHECK-SCEV-INV-NEXT: Running analysis: LoopAnalysis
73 ; CHECK-SCEV-INV-NEXT: Running analysis: DominatorTreeAnalysis
74 ; CHECK-SCEV-INV-NEXT: Running analysis: AssumptionAnalysis
75 ; CHECK-SCEV-INV-NEXT: Running analysis: TargetIRAnalysis
76 ; CHECK-SCEV-INV-NEXT: Running pass: LCSSAPass
77 ; CHECK-SCEV-INV-NEXT: Running analysis: AAManager
78 ; CHECK-SCEV-INV-NEXT: Running analysis: TargetLibraryAnalysis
79 ; CHECK-SCEV-INV-NEXT: Running analysis: ScalarEvolutionAnalysis
80 ; CHECK-SCEV-INV-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Loop
81 ; CHECK-SCEV-INV-NEXT: Running pass: NoOpLoopPass
82 ; CHECK-SCEV-INV-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}ScalarEvolutionAnalysis
83 ; CHECK-SCEV-INV-NEXT: Clearing all analysis results for: <possibly invalidated loop>
84 ; CHECK-SCEV-INV-NEXT: Invalidating analysis: ScalarEvolutionAnalysis
85 ; CHECK-SCEV-INV-NEXT: Invalidating analysis: InnerAnalysisManagerProxy<{{.*}}Loop
86 ; CHECK-SCEV-INV-NEXT: Running pass: LoopSimplifyPass
87 ; CHECK-SCEV-INV-NEXT: Running pass: LCSSAPass
88 ; CHECK-SCEV-INV-NEXT: Running analysis: ScalarEvolutionAnalysis
89 ; CHECK-SCEV-INV-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Loop
90 ; CHECK-SCEV-INV-NEXT: Running pass: NoOpLoopPass
96 %flag0 = load volatile i1, ptr %ptr
97 br i1 %flag0, label %l0.header, label %exit
103 define void @nested_loops(ptr %ptr) {
104 ; CHECK-LOOP-INV: Running pass: LoopSimplifyPass
105 ; CHECK-LOOP-INV-NEXT: Running analysis: LoopAnalysis
106 ; CHECK-LOOP-INV-NEXT: Running analysis: DominatorTreeAnalysis
107 ; CHECK-LOOP-INV-NEXT: Running analysis: AssumptionAnalysis
108 ; CHECK-LOOP-INV-NEXT: Running analysis: TargetIRAnalysis
109 ; CHECK-LOOP-INV-NEXT: Running pass: LCSSAPass
110 ; CHECK-LOOP-INV-NEXT: Running analysis: AAManager
111 ; CHECK-LOOP-INV-NEXT: Running analysis: TargetLibraryAnalysis
112 ; CHECK-LOOP-INV-NEXT: Running analysis: ScalarEvolutionAnalysis
113 ; CHECK-LOOP-INV-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Loop
114 ; CHECK-LOOP-INV-NEXT: Running pass: NoOpLoopPass
115 ; CHECK-LOOP-INV-NEXT: Running pass: NoOpLoopPass
116 ; CHECK-LOOP-INV-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}LoopAnalysis
117 ; CHECK-LOOP-INV-NEXT: Clearing all analysis results for: <possibly invalidated loop>
118 ; CHECK-LOOP-INV-NEXT: Clearing all analysis results for: <possibly invalidated loop>
119 ; CHECK-LOOP-INV-NEXT: Invalidating analysis: LoopAnalysis
120 ; CHECK-LOOP-INV-NEXT: Invalidating analysis: ScalarEvolutionAnalysis
121 ; CHECK-LOOP-INV-NEXT: Invalidating analysis: InnerAnalysisManagerProxy<{{.*}}Loop
122 ; CHECK-LOOP-INV-NEXT: Running pass: LoopSimplifyPass
123 ; CHECK-LOOP-INV-NEXT: Running analysis: LoopAnalysis
124 ; CHECK-LOOP-INV-NEXT: Running pass: LCSSAPass
125 ; CHECK-LOOP-INV-NEXT: Running analysis: ScalarEvolutionAnalysis
126 ; CHECK-LOOP-INV-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Loop
127 ; CHECK-LOOP-INV-NEXT: Running pass: NoOpLoopPass
128 ; CHECK-LOOP-INV-NEXT: Running pass: NoOpLoopPass
130 ; CHECK-SCEV-INV: Running pass: LoopSimplifyPass
131 ; CHECK-SCEV-INV-NEXT: Running analysis: LoopAnalysis
132 ; CHECK-SCEV-INV-NEXT: Running analysis: DominatorTreeAnalysis
133 ; CHECK-SCEV-INV-NEXT: Running analysis: AssumptionAnalysis
134 ; CHECK-SCEV-INV-NEXT: Running analysis: TargetIRAnalysis
135 ; CHECK-SCEV-INV-NEXT: Running pass: LCSSAPass
136 ; CHECK-SCEV-INV-NEXT: Running analysis: AAManager
137 ; CHECK-SCEV-INV-NEXT: Running analysis: TargetLibraryAnalysis
138 ; CHECK-SCEV-INV-NEXT: Running analysis: ScalarEvolutionAnalysis
139 ; CHECK-SCEV-INV-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Loop
140 ; CHECK-SCEV-INV-NEXT: Running pass: NoOpLoopPass
141 ; CHECK-SCEV-INV-NEXT: Running pass: NoOpLoopPass
142 ; CHECK-SCEV-INV-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}ScalarEvolutionAnalysis
143 ; CHECK-SCEV-INV-NEXT: Clearing all analysis results for: <possibly invalidated loop>
144 ; CHECK-SCEV-INV-NEXT: Clearing all analysis results for: <possibly invalidated loop>
145 ; CHECK-SCEV-INV-NEXT: Invalidating analysis: ScalarEvolutionAnalysis
146 ; CHECK-SCEV-INV-NEXT: Invalidating analysis: InnerAnalysisManagerProxy<{{.*}}Loop
147 ; CHECK-SCEV-INV-NEXT: Running pass: LoopSimplifyPass
148 ; CHECK-SCEV-INV-NEXT: Running pass: LCSSAPass
149 ; CHECK-SCEV-INV-NEXT: Running analysis: ScalarEvolutionAnalysis
150 ; CHECK-SCEV-INV-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Loop
151 ; CHECK-SCEV-INV-NEXT: Running pass: NoOpLoopPass
152 ; CHECK-SCEV-INV-NEXT: Running pass: NoOpLoopPass
158 br label %l.0.0.header
161 %flag.0.0 = load volatile i1, ptr %ptr
162 br i1 %flag.0.0, label %l.0.0.header, label %l.0.latch
165 %flag.0 = load volatile i1, ptr %ptr
166 br i1 %flag.0, label %l.0.header, label %exit
172 define void @dead_loop() {
173 ; CHECK-LOOP-INV: Running pass: LoopSimplifyPass
174 ; CHECK-LOOP-INV-NEXT: Running analysis: LoopAnalysis
175 ; CHECK-LOOP-INV-NEXT: Running analysis: DominatorTreeAnalysis
176 ; CHECK-LOOP-INV-NEXT: Running analysis: AssumptionAnalysis
177 ; CHECK-LOOP-INV-NEXT: Running analysis: TargetIRAnalysis
178 ; CHECK-LOOP-INV-NEXT: Running pass: LCSSAPass
179 ; CHECK-LOOP-INV-NEXT: Running analysis: AAManager
180 ; CHECK-LOOP-INV-NEXT: Running analysis: TargetLibraryAnalysis
181 ; CHECK-LOOP-INV-NEXT: Running analysis: ScalarEvolutionAnalysis
182 ; CHECK-LOOP-INV-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Loop
183 ; CHECK-LOOP-INV-NEXT: Running pass: NoOpLoopPass
184 ; CHECK-LOOP-INV-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}LoopAnalysis
185 ; CHECK-LOOP-INV-NEXT: Clearing all analysis results for: <possibly invalidated loop>
186 ; CHECK-LOOP-INV-NEXT: Invalidating analysis: LoopAnalysis
187 ; CHECK-LOOP-INV-NEXT: Invalidating analysis: ScalarEvolutionAnalysis
188 ; CHECK-LOOP-INV-NEXT: Invalidating analysis: InnerAnalysisManagerProxy<{{.*}}Loop
189 ; CHECK-LOOP-INV-NEXT: Running pass: LoopSimplifyPass
190 ; CHECK-LOOP-INV-NEXT: Running analysis: LoopAnalysis
191 ; CHECK-LOOP-INV-NEXT: Running pass: LCSSAPass
192 ; CHECK-LOOP-INV-NEXT: Running analysis: ScalarEvolutionAnalysis
193 ; CHECK-LOOP-INV-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Loop
194 ; CHECK-LOOP-INV-NEXT: Running pass: NoOpLoopPass
196 ; CHECK-SCEV-INV: Running pass: LoopSimplifyPass
197 ; CHECK-SCEV-INV-NEXT: Running analysis: LoopAnalysis
198 ; CHECK-SCEV-INV-NEXT: Running analysis: DominatorTreeAnalysis
199 ; CHECK-SCEV-INV-NEXT: Running analysis: AssumptionAnalysis
200 ; CHECK-SCEV-INV-NEXT: Running analysis: TargetIRAnalysis
201 ; CHECK-SCEV-INV-NEXT: Running pass: LCSSAPass
202 ; CHECK-SCEV-INV-NEXT: Running analysis: AAManager
203 ; CHECK-SCEV-INV-NEXT: Running analysis: TargetLibraryAnalysis
204 ; CHECK-SCEV-INV-NEXT: Running analysis: ScalarEvolutionAnalysis
205 ; CHECK-SCEV-INV-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Loop
206 ; CHECK-SCEV-INV-NEXT: Running pass: NoOpLoopPass
207 ; CHECK-SCEV-INV-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}ScalarEvolutionAnalysis
208 ; CHECK-SCEV-INV-NEXT: Clearing all analysis results for: <possibly invalidated loop>
209 ; CHECK-SCEV-INV-NEXT: Invalidating analysis: ScalarEvolutionAnalysis
210 ; CHECK-SCEV-INV-NEXT: Invalidating analysis: InnerAnalysisManagerProxy<{{.*}}Loop
211 ; CHECK-SCEV-INV-NEXT: Running pass: LoopSimplifyPass
212 ; CHECK-SCEV-INV-NEXT: Running pass: LCSSAPass
213 ; CHECK-SCEV-INV-NEXT: Running analysis: ScalarEvolutionAnalysis
214 ; CHECK-SCEV-INV-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Loop
215 ; CHECK-SCEV-INV-NEXT: Running pass: NoOpLoopPass
217 ; CHECK-SCEV-INV-AFTER-DELETE-LABEL: Running pass: LoopSimplifyPass on dead_loop
218 ; CHECK-SCEV-INV-AFTER-DELETE-NEXT: Running analysis: LoopAnalysis
219 ; CHECK-SCEV-INV-AFTER-DELETE-NEXT: Running analysis: DominatorTreeAnalysis
220 ; CHECK-SCEV-INV-AFTER-DELETE-NEXT: Running analysis: AssumptionAnalysis
221 ; CHECK-SCEV-INV-AFTER-DELETE-NEXT: Running analysis: TargetIRAnalysis
222 ; CHECK-SCEV-INV-AFTER-DELETE-NEXT: Running pass: LCSSAPass
223 ; CHECK-SCEV-INV-AFTER-DELETE-NEXT: Running analysis: AAManager
224 ; CHECK-SCEV-INV-AFTER-DELETE-NEXT: Running analysis: TargetLibraryAnalysis
225 ; CHECK-SCEV-INV-AFTER-DELETE-NEXT: Running analysis: ScalarEvolutionAnalysis
226 ; CHECK-SCEV-INV-AFTER-DELETE-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Loop
227 ; CHECK-SCEV-INV-AFTER-DELETE-NEXT: Running pass: NoOpLoopPass
228 ; CHECK-SCEV-INV-AFTER-DELETE-NEXT: Running pass: LoopDeletionPass
229 ; CHECK-SCEV-INV-AFTER-DELETE-NEXT: Clearing all analysis results for:
230 ; CHECK-SCEV-INV-AFTER-DELETE-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}ScalarEvolutionAnalysis
231 ; CHECK-SCEV-INV-AFTER-DELETE-NEXT: Invalidating analysis: ScalarEvolutionAnalysis
232 ; CHECK-SCEV-INV-AFTER-DELETE-NEXT: Invalidating analysis: InnerAnalysisManagerProxy<{{.*}}Loop
233 ; CHECK-SCEV-INV-AFTER-DELETE-NEXT: Running pass: LoopSimplifyPass
234 ; CHECK-SCEV-INV-AFTER-DELETE-NEXT: Running pass: LCSSAPass
240 br i1 false, label %l0.header, label %exit