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