1 ; The IR below was crafted so as:
2 ; 1) To have a loop, so we create a loop pass manager
3 ; 2) To be "immutable" in the sense that no pass in the standard
4 ; pipeline will modify it.
5 ; Since no transformations take place, we don't expect any analyses
7 ; Any invalidation that shows up here is a bug, unless we started modifying
8 ; the IR, in which case we need to make it immutable harder.
10 ; RUN: opt -disable-verify -debug-pass-manager \
11 ; RUN: -passes='default<O1>' -S %s 2>&1 \
12 ; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O1
13 ; RUN: opt -disable-verify -debug-pass-manager \
14 ; RUN: -passes='default<O2>' -S %s 2>&1 \
15 ; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O2
16 ; RUN: opt -disable-verify -debug-pass-manager \
17 ; RUN: -passes='default<O3>' -S %s 2>&1 \
18 ; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O3
19 ; RUN: opt -disable-verify -debug-pass-manager \
20 ; RUN: -passes='default<Os>' -S %s 2>&1 \
21 ; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-Os
22 ; RUN: opt -disable-verify -debug-pass-manager \
23 ; RUN: -passes='default<Oz>' -S %s 2>&1 \
24 ; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-Oz
25 ; RUN: opt -disable-verify -debug-pass-manager \
26 ; RUN: -passes='lto-pre-link<O2>' -S %s 2>&1 \
27 ; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O2 \
28 ; RUN: --check-prefix=CHECK-O2-LTO
30 ; RUN: opt -disable-verify -debug-pass-manager \
31 ; RUN: -passes-ep-peephole='no-op-function' \
32 ; RUN: -passes='default<O3>' -S %s 2>&1 \
33 ; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O3 \
34 ; RUN: --check-prefix=CHECK-EP-PEEPHOLE
35 ; RUN: opt -disable-verify -debug-pass-manager \
36 ; RUN: -passes-ep-late-loop-optimizations='no-op-loop' \
37 ; RUN: -passes='default<O3>' -S %s 2>&1 \
38 ; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O3 \
39 ; RUN: --check-prefix=CHECK-EP-LOOP-LATE
40 ; RUN: opt -disable-verify -debug-pass-manager \
41 ; RUN: -passes-ep-loop-optimizer-end='no-op-loop' \
42 ; RUN: -passes='default<O3>' -S %s 2>&1 \
43 ; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O3 \
44 ; RUN: --check-prefix=CHECK-EP-LOOP-END
45 ; RUN: opt -disable-verify -debug-pass-manager \
46 ; RUN: -passes-ep-scalar-optimizer-late='no-op-function' \
47 ; RUN: -passes='default<O3>' -S %s 2>&1 \
48 ; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O3 \
49 ; RUN: --check-prefix=CHECK-EP-SCALAR-LATE
50 ; RUN: opt -disable-verify -debug-pass-manager \
51 ; RUN: -passes-ep-cgscc-optimizer-late='no-op-cgscc' \
52 ; RUN: -passes='default<O3>' -S %s 2>&1 \
53 ; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O3 \
54 ; RUN: --check-prefix=CHECK-EP-CGSCC-LATE
55 ; RUN: opt -disable-verify -debug-pass-manager \
56 ; RUN: -passes-ep-vectorizer-start='no-op-function' \
57 ; RUN: -passes='default<O3>' -S %s 2>&1 \
58 ; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O3 \
59 ; RUN: --check-prefix=CHECK-EP-VECTORIZER-START
60 ; RUN: opt -disable-verify -debug-pass-manager \
61 ; RUN: -passes-ep-pipeline-start='no-op-module' \
62 ; RUN: -passes='default<O3>' -S %s 2>&1 \
63 ; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O3 \
64 ; RUN: --check-prefix=CHECK-EP-PIPELINE-START
65 ; RUN: opt -disable-verify -debug-pass-manager \
66 ; RUN: -passes-ep-pipeline-start='no-op-module' \
67 ; RUN: -passes='lto-pre-link<O3>' -S %s 2>&1 \
68 ; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O3 \
69 ; RUN: --check-prefix=CHECK-EP-PIPELINE-START
70 ; RUN: opt -disable-verify -debug-pass-manager \
71 ; RUN: -passes-ep-optimizer-last='no-op-function' \
72 ; RUN: -passes='default<O3>' -S %s 2>&1 \
73 ; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O3 \
74 ; RUN: --check-prefix=CHECK-EP-OPTIMIZER-LAST
76 ; CHECK-O: Running analysis: PassInstrumentationAnalysis
77 ; CHECK-O-NEXT: Starting llvm::Module pass manager run.
78 ; CHECK-O-NEXT: Running pass: PassManager<{{.*}}Module{{.*}}>
79 ; CHECK-O-NEXT: Starting llvm::Module pass manager run.
80 ; CHECK-O-NEXT: Running pass: ForceFunctionAttrsPass
81 ; CHECK-EP-PIPELINE-START-NEXT: Running pass: NoOpModulePass
82 ; CHECK-O-NEXT: Running pass: PassManager<{{.*}}Module{{.*}}>
83 ; CHECK-O-NEXT: Starting llvm::Module pass manager run.
84 ; CHECK-O-NEXT: Running pass: InferFunctionAttrsPass
85 ; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy
86 ; CHECK-O-NEXT: Running analysis: TargetLibraryAnalysis
87 ; CHECK-O-NEXT: Running analysis: PassInstrumentationAnalysis
88 ; CHECK-O-NEXT: Running pass: ModuleToFunctionPassAdaptor<{{.*}}PassManager{{.*}}>
89 ; CHECK-O-NEXT: Running analysis: PassInstrumentationAnalysis
90 ; CHECK-O-NEXT: Starting llvm::Function pass manager run.
91 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
92 ; CHECK-O-NEXT: Running analysis: TargetIRAnalysis
93 ; CHECK-O-NEXT: Running analysis: AssumptionAnalysis
94 ; CHECK-O-NEXT: Running pass: SROA
95 ; CHECK-O-NEXT: Running analysis: DominatorTreeAnalysis
96 ; CHECK-O-NEXT: Running pass: EarlyCSEPass
97 ; CHECK-O-NEXT: Running analysis: TargetLibraryAnalysis
98 ; CHECK-O-NEXT: Running pass: LowerExpectIntrinsicPass
99 ; CHECK-O3-NEXT: Running pass: CallSiteSplittingPass
100 ; CHECK-O-NEXT: Finished llvm::Function pass manager run.
101 ; CHECK-O-NEXT: Running pass: IPSCCPPass
102 ; CHECK-O-NEXT: Running pass: CalledValuePropagationPass
103 ; CHECK-O-NEXT: Running pass: GlobalOptPass
104 ; CHECK-O-NEXT: Running pass: ModuleToFunctionPassAdaptor<{{.*}}PromotePass>
105 ; CHECK-O-NEXT: Running pass: DeadArgumentEliminationPass
106 ; CHECK-O-NEXT: Running pass: ModuleToFunctionPassAdaptor<{{.*}}PassManager{{.*}}>
107 ; CHECK-O-NEXT: Starting llvm::Function pass manager run.
108 ; CHECK-O-NEXT: Running pass: InstCombinePass
109 ; CHECK-O-NEXT: Running analysis: OptimizationRemarkEmitterAnalysis
110 ; CHECK-O-NEXT: Running analysis: AAManager
111 ; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy
112 ; CHECK-EP-PEEPHOLE-NEXT: Running pass: NoOpFunctionPass
113 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
114 ; CHECK-O-NEXT: Finished llvm::Function pass manager run.
115 ; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}GlobalsAA
116 ; CHECK-O-NEXT: Running analysis: GlobalsAA
117 ; CHECK-O-NEXT: Running analysis: CallGraphAnalysis
118 ; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}ProfileSummaryAnalysis
119 ; CHECK-O-NEXT: Running analysis: ProfileSummaryAnalysis
120 ; CHECK-O-NEXT: Running pass: ModuleToPostOrderCGSCCPassAdaptor<{{.*}}LazyCallGraph{{.*}}>
121 ; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy
122 ; CHECK-O-NEXT: Running analysis: LazyCallGraphAnalysis
123 ; CHECK-O-NEXT: Running analysis: FunctionAnalysisManagerCGSCCProxy
124 ; CHECK-O-NEXT: Running analysis: PassInstrumentationAnalysis
125 ; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy<{{.*}}LazyCallGraph::SCC{{.*}}>
126 ; CHECK-O-NEXT: Starting CGSCC pass manager run.
127 ; CHECK-O-NEXT: Running pass: InlinerPass
128 ; CHECK-O-NEXT: Running pass: PostOrderFunctionAttrsPass
129 ; CHECK-O3-NEXT: Running pass: ArgumentPromotionPass
130 ; CHECK-O-NEXT: Running pass: CGSCCToFunctionPassAdaptor<{{.*}}PassManager{{.*}}>
131 ; CHECK-O-NEXT: Starting llvm::Function pass manager run.
132 ; CHECK-O-NEXT: Running pass: SROA
133 ; CHECK-O-NEXT: Running pass: EarlyCSEPass
134 ; CHECK-O-NEXT: Running analysis: MemorySSAAnalysis
135 ; CHECK-O-NEXT: Running pass: SpeculativeExecutionPass
136 ; CHECK-O-NEXT: Running pass: JumpThreadingPass
137 ; CHECK-O-NEXT: Running analysis: LazyValueAnalysis
138 ; CHECK-O-NEXT: Running pass: CorrelatedValuePropagationPass
139 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
140 ; CHECK-O3-NEXT: AggressiveInstCombinePass
141 ; CHECK-O-NEXT: Running pass: InstCombinePass
142 ; CHECK-O1-NEXT: Running pass: LibCallsShrinkWrapPass
143 ; CHECK-O2-NEXT: Running pass: LibCallsShrinkWrapPass
144 ; CHECK-O3-NEXT: Running pass: LibCallsShrinkWrapPass
145 ; CHECK-EP-PEEPHOLE-NEXT: Running pass: NoOpFunctionPass
146 ; CHECK-O-NEXT: Running pass: TailCallElimPass
147 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
148 ; CHECK-O-NEXT: Running pass: ReassociatePass
149 ; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}OptimizationRemarkEmitterAnalysis
150 ; CHECK-O-NEXT: Running pass: FunctionToLoopPassAdaptor<{{.*}}LoopStandardAnalysisResults{{.*}}>
151 ; CHECK-O-NEXT: Starting llvm::Function pass manager run.
152 ; CHECK-O-NEXT: Running pass: LoopSimplifyPass
153 ; CHECK-O-NEXT: Running analysis: LoopAnalysis
154 ; CHECK-O-NEXT: Running pass: LCSSAPass
155 ; CHECK-O-NEXT: Finished llvm::Function pass manager run.
156 ; CHECK-O-NEXT: Running analysis: ScalarEvolutionAnalysis
157 ; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy
158 ; CHECK-O-NEXT: Starting Loop pass manager run.
159 ; CHECK-O-NEXT: Running analysis: PassInstrumentationAnalysis
160 ; CHECK-O-NEXT: Running pass: LoopInstSimplifyPass
161 ; CHECK-O-NEXT: Running pass: LoopSimplifyCFGPass
162 ; CHECK-O-NEXT: Running pass: LoopRotatePass
163 ; CHECK-O-NEXT: Running pass: LICM
164 ; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy
165 ; CHECK-O-NEXT: Running pass: SimpleLoopUnswitchPass
166 ; CHECK-O-NEXT: Finished Loop pass manager run.
167 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
168 ; CHECK-O-NEXT: Running pass: InstCombinePass
169 ; CHECK-O-NEXT: Running pass: FunctionToLoopPassAdaptor<{{.*}}LoopStandardAnalysisResults{{.*}}>
170 ; CHECK-O-NEXT: Starting llvm::Function pass manager run.
171 ; CHECK-O-NEXT: Running pass: LoopSimplifyPass
172 ; CHECK-O-NEXT: Running pass: LCSSAPass
173 ; CHECK-O-NEXT: Finished llvm::Function pass manager run.
174 ; CHECK-O-NEXT: Starting Loop pass manager run.
175 ; CHECK-O-NEXT: Running pass: IndVarSimplifyPass
176 ; CHECK-O-NEXT: Running pass: LoopIdiomRecognizePass
177 ; CHECK-EP-LOOP-LATE-NEXT: Running pass: NoOpLoopPass
178 ; CHECK-O-NEXT: Running pass: LoopDeletionPass
179 ; CHECK-O-NEXT: Running pass: LoopFullUnrollPass
180 ; CHECK-EP-LOOP-END-NEXT: Running pass: NoOpLoopPass
181 ; CHECK-O-NEXT: Finished Loop pass manager run.
182 ; CHECK-Os-NEXT: Running pass: MergedLoadStoreMotionPass
183 ; CHECK-Os-NEXT: Running pass: GVN
184 ; CHECK-Os-NEXT: Running analysis: MemoryDependenceAnalysis
185 ; CHECK-Os-NEXT: Running analysis: PhiValuesAnalysis
186 ; CHECK-Oz-NEXT: Running pass: MergedLoadStoreMotionPass
187 ; CHECK-Oz-NEXT: Running pass: GVN
188 ; CHECK-Oz-NEXT: Running analysis: MemoryDependenceAnalysis
189 ; CHECK-Oz-NEXT: Running analysis: PhiValuesAnalysis
190 ; CHECK-O2-NEXT: Running pass: MergedLoadStoreMotionPass
191 ; CHECK-O2-NEXT: Running pass: GVN
192 ; CHECK-O2-NEXT: Running analysis: MemoryDependenceAnalysis
193 ; CHECK-O2-NEXT: Running analysis: PhiValuesAnalysis
194 ; CHECK-O3-NEXT: Running pass: MergedLoadStoreMotionPass
195 ; CHECK-O3-NEXT: Running pass: GVN
196 ; CHECK-O3-NEXT: Running analysis: MemoryDependenceAnalysis
197 ; CHECK-O3-NEXT: Running analysis: PhiValuesAnalysis
198 ; CHECK-O-NEXT: Running pass: MemCpyOptPass
199 ; CHECK-O1-NEXT: Running analysis: MemoryDependenceAnalysis
200 ; CHECK-O1-NEXT: Running analysis: PhiValuesAnalysis
201 ; CHECK-O-NEXT: Running pass: SCCPPass
202 ; CHECK-O-NEXT: Running pass: BDCEPass
203 ; CHECK-O-NEXT: Running analysis: DemandedBitsAnalysis
204 ; CHECK-O-NEXT: Running pass: InstCombinePass
205 ; CHECK-EP-PEEPHOLE-NEXT: Running pass: NoOpFunctionPass
206 ; CHECK-O-NEXT: Running pass: JumpThreadingPass
207 ; CHECK-O-NEXT: Running pass: CorrelatedValuePropagationPass
208 ; CHECK-O-NEXT: Running pass: DSEPass
209 ; CHECK-O-NEXT: Running pass: FunctionToLoopPassAdaptor<{{.*}}LICMPass{{.*}}>
210 ; CHECK-O-NEXT: Starting llvm::Function pass manager run.
211 ; CHECK-O-NEXT: Running pass: LoopSimplifyPass
212 ; CHECK-O-NEXT: Running pass: LCSSAPass
213 ; CHECK-O-NEXT: Finished llvm::Function pass manager run.
214 ; CHECK-EP-SCALAR-LATE-NEXT: Running pass: NoOpFunctionPass
215 ; CHECK-O-NEXT: Running pass: ADCEPass
216 ; CHECK-O-NEXT: Running analysis: PostDominatorTreeAnalysis
217 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
218 ; CHECK-O-NEXT: Running pass: InstCombinePass
219 ; CHECK-EP-PEEPHOLE-NEXT: Running pass: NoOpFunctionPass
220 ; CHECK-O-NEXT: Finished llvm::Function pass manager run.
221 ; CHECK-EP-CGSCC-LATE-NEXT: Running pass: NoOpCGSCCPass
222 ; CHECK-O-NEXT: Finished CGSCC pass manager run.
223 ; CHECK-O-NEXT: Finished llvm::Module pass manager run.
224 ; CHECK-O-NEXT: Running pass: PassManager<{{.*}}Module{{.*}}>
225 ; CHECK-O-NEXT: Starting llvm::Module pass manager run.
226 ; CHECK-O-NEXT: Running pass: GlobalOptPass
227 ; CHECK-O-NEXT: Running pass: GlobalDCEPass
228 ; CHECK-O2-LTO-NOT: Running pass: EliminateAvailableExternallyPass
229 ; CHECK-O: Running pass: ReversePostOrderFunctionAttrsPass
230 ; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}GlobalsAA
231 ; CHECK-O-NEXT: Running pass: ModuleToFunctionPassAdaptor<{{.*}}PassManager{{.*}}>
232 ; CHECK-O-NEXT: Starting llvm::Function pass manager run.
233 ; CHECK-O-NEXT: Running pass: Float2IntPass
234 ; CHECK-O-NEXT: Running pass: LowerConstantIntrinsicsPass on foo
235 ; CHECK-EP-VECTORIZER-START-NEXT: Running pass: NoOpFunctionPass
236 ; CHECK-O-NEXT: Running pass: FunctionToLoopPassAdaptor<{{.*}}LoopRotatePass
237 ; CHECK-O-NEXT: Starting llvm::Function pass manager run.
238 ; CHECK-O-NEXT: Running pass: LoopSimplifyPass
239 ; CHECK-O-NEXT: Running pass: LCSSAPass
240 ; CHECK-O-NEXT: Finished llvm::Function pass manager run.
241 ; CHECK-O-NEXT: Running pass: LoopDistributePass
242 ; CHECK-O-NEXT: Running pass: LoopVectorizePass
243 ; CHECK-O-NEXT: Running analysis: BlockFrequencyAnalysis
244 ; CHECK-O-NEXT: Running analysis: BranchProbabilityAnalysis
245 ; CHECK-O-NEXT: Running pass: LoopLoadEliminationPass
246 ; CHECK-O-NEXT: Running analysis: LoopAccessAnalysis
247 ; CHECK-O-NEXT: Running pass: InstCombinePass
248 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
249 ; CHECK-O-NEXT: Running pass: InstCombinePass
250 ; CHECK-O-NEXT: Running pass: LoopUnrollPass
251 ; CHECK-O-NEXT: Running pass: WarnMissedTransformationsPass
252 ; CHECK-O-NEXT: Running pass: InstCombinePass
253 ; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}OptimizationRemarkEmitterAnalysis
254 ; CHECK-O-NEXT: Running pass: FunctionToLoopPassAdaptor<{{.*}}LICMPass
255 ; CHECK-O-NEXT: Starting llvm::Function pass manager run.
256 ; CHECK-O-NEXT: Running pass: LoopSimplifyPass
257 ; CHECK-O-NEXT: Running pass: LCSSAPass
258 ; CHECK-O-NEXT: Finished llvm::Function pass manager run.
259 ; CHECK-O-NEXT: Running pass: AlignmentFromAssumptionsPass
260 ; CHECK-O-NEXT: Running pass: LoopSinkPass
261 ; CHECK-O-NEXT: Running pass: InstSimplifyPass
262 ; CHECK-O-NEXT: Running pass: DivRemPairsPass
263 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
264 ; CHECK-O-NEXT: Running pass: SpeculateAroundPHIsPass
265 ; CHECK-EP-OPTIMIZER-LAST: Running pass: NoOpFunctionPass
266 ; CHECK-O-NEXT: Finished llvm::Function pass manager run.
267 ; CHECK-O-NEXT: Running pass: CGProfilePass
268 ; CHECK-O-NEXT: Running pass: GlobalDCEPass
269 ; CHECK-O-NEXT: Running pass: ConstantMergePass
270 ; CHECK-O-NEXT: Finished llvm::Module pass manager run.
271 ; CHECK-O-NEXT: Finished llvm::Module pass manager run.
272 ; CHECK-O-NEXT: Running pass: PrintModulePass
274 ; Make sure we get the IR back out without changes when we print the module.
275 ; CHECK-O-LABEL: define void @foo(i32 %n) local_unnamed_addr {
276 ; CHECK-O-NEXT: entry:
277 ; CHECK-O-NEXT: br label %loop
279 ; CHECK-O-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
280 ; CHECK-O-NEXT: %iv.next = add i32 %iv, 1
281 ; CHECK-O-NEXT: tail call void @bar()
282 ; CHECK-O-NEXT: %cmp = icmp eq i32 %iv, %n
283 ; CHECK-O-NEXT: br i1 %cmp, label %exit, label %loop
285 ; CHECK-O-NEXT: ret void
288 ; CHECK-O-NEXT: Finished llvm::Module pass manager run.
290 declare void @bar() local_unnamed_addr
292 define void @foo(i32 %n) local_unnamed_addr {
296 %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
297 %iv.next = add i32 %iv, 1
298 tail call void @bar()
299 %cmp = icmp eq i32 %iv, %n
300 br i1 %cmp, label %exit, label %loop