[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / llvm / test / Other / new-pm-thinlto-prelink-pgo-defaults.ll
blob448eb0e228e596e1d3b3c00e409cf1d11c1bc9c1
1 ; Validate ThinLTO prelink pipeline when we have instrumentation PGO
3 ; RUN: llvm-profdata merge %S/Inputs/new-pm-thinlto-prelink-pgo-defaults.proftext -o %t.profdata
5 ; RUN: opt -disable-verify -verify-cfg-preserved=0 -eagerly-invalidate-analyses=0 -debug-pass-manager \
6 ; RUN:     -pgo-kind=pgo-instr-use-pipeline -profile-file='%t.profdata' \
7 ; RUN:     -passes='thinlto-pre-link<O1>' -S %s 2>&1 \
8 ; RUN:     | FileCheck %s --check-prefixes=CHECK-O,CHECK-O1,CHECK-O123SZ
9 ; RUN: opt -disable-verify -verify-cfg-preserved=0 -eagerly-invalidate-analyses=0 -debug-pass-manager \
10 ; RUN:     -pgo-kind=pgo-instr-use-pipeline -profile-file='%t.profdata' \
11 ; RUN:     -passes='thinlto-pre-link<O2>' -S  %s 2>&1 \
12 ; RUN:     | FileCheck %s --check-prefixes=CHECK-O,CHECK-O2,CHECK-O23SZ,CHECK-O123SZ
13 ; RUN: opt -disable-verify -verify-cfg-preserved=0 -eagerly-invalidate-analyses=0 -debug-pass-manager \
14 ; RUN:     -pgo-kind=pgo-instr-use-pipeline -profile-file='%t.profdata' \
15 ; RUN:     -passes='thinlto-pre-link<O3>' -S -passes-ep-pipeline-start='no-op-module' %s 2>&1 \
16 ; RUN:     | FileCheck %s --check-prefixes=CHECK-O,CHECK-O3,CHECK-O23SZ,CHECK-O123SZ,CHECK-EP-PIPELINE-START
17 ; RUN: opt -disable-verify -verify-cfg-preserved=0 -eagerly-invalidate-analyses=0 -debug-pass-manager \
18 ; RUN:     -pgo-kind=pgo-instr-use-pipeline -profile-file='%t.profdata' \
19 ; RUN:     -passes='thinlto-pre-link<Os>' -S %s 2>&1 \
20 ; RUN:     | FileCheck %s --check-prefixes=CHECK-O,CHECK-O123SZ,CHECK-Os,CHECK-O23SZ
21 ; RUN: opt -disable-verify -verify-cfg-preserved=0 -eagerly-invalidate-analyses=0 -debug-pass-manager \
22 ; RUN:     -pgo-kind=pgo-instr-use-pipeline -profile-file='%t.profdata' \
23 ; RUN:     -passes='thinlto-pre-link<Oz>' -S %s 2>&1 \
24 ; RUN:     | FileCheck %s --check-prefixes=CHECK-O,CHECK-O123SZ,CHECK-Oz,CHECK-O23SZ
25 ; RUN: opt -disable-verify -verify-cfg-preserved=0 -eagerly-invalidate-analyses=0 -debug-pass-manager -new-pm-debug-info-for-profiling \
26 ; RUN:     -pgo-kind=pgo-instr-use-pipeline -profile-file='%t.profdata' \
27 ; RUN:     -passes='thinlto-pre-link<O2>' -S  %s 2>&1 \
28 ; RUN:     | FileCheck %s --check-prefixes=CHECK-O,CHECK-O2,CHECK-O23SZ,CHECK-O123SZ
30 ; CHECK-O: Running pass: Annotation2Metadata
31 ; CHECK-O-NEXT: Running pass: ForceFunctionAttrsPass
32 ; CHECK-EP-PIPELINE-START-NEXT: Running pass: NoOpModulePass
33 ; CHECK-O-NEXT: Running pass: InferFunctionAttrsPass
34 ; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy
35 ; CHECK-O-NEXT: Running analysis: TargetLibraryAnalysis
36 ; CHECK-O-NEXT: Running pass: CoroEarlyPass
37 ; CHECK-O-NEXT: Running pass: LowerExpectIntrinsicPass
38 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
39 ; CHECK-O-NEXT: Running analysis: TargetIRAnalysis
40 ; CHECK-O-NEXT: Running analysis: AssumptionAnalysis
41 ; CHECK-O-NEXT: Running pass: SROAPass
42 ; CHECK-O-NEXT: Running analysis: DominatorTreeAnalysis
43 ; CHECK-O-NEXT: Running pass: EarlyCSEPass
44 ; CHECK-O-NEXT: Running analysis: TargetLibraryAnalysis
45 ; CHECK-O3-NEXT: Running pass: CallSiteSplittingPass
46 ; CHECK-O-NEXT: Running pass: OpenMPOptPass
47 ; CHECK-O-NEXT: Running pass: IPSCCPPass
48 ; CHECK-O-NEXT: Running pass: CalledValuePropagationPass
49 ; CHECK-O-NEXT: Running pass: GlobalOptPass
50 ; CHECK-O-NEXT: Running pass: PromotePass
51 ; CHECK-O-NEXT: Running pass: DeadArgumentEliminationPass
52 ; CHECK-O-NEXT: Running pass: InstCombinePass
53 ; CHECK-O-NEXT: Running analysis: OptimizationRemarkEmitterAnalysis
54 ; CHECK-O-NEXT: Running analysis: AAManager
55 ; CHECK-O-NEXT: Running analysis: BasicAA
56 ; CHECK-O-NEXT: Running analysis: ScopedNoAliasAA
57 ; CHECK-O-NEXT: Running analysis: TypeBasedAA
58 ; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy
59 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
60 ; CHECK-O123SZ-NEXT: Running pass: ModuleInlinerWrapperPass
61 ; CHECK-O123SZ-NEXT: Running analysis: InlineAdvisorAnalysis
62 ; CHECK-O123SZ-NEXT: Running analysis: InnerAnalysisManagerProxy
63 ; CHECK-O123SZ-NEXT: Running analysis: LazyCallGraphAnalysis
64 ; CHECK-O123SZ-NEXT: Running analysis: FunctionAnalysisManagerCGSCCProxy on (foo)
65 ; CHECK-O123SZ-NEXT: Running analysis: OuterAnalysisManagerProxy
66 ; CHECK-O123SZ-NEXT: Running pass: InlinerPass on (foo)
67 ; CHECK-O123SZ-NEXT: Running pass: InlinerPass on (foo)
68 ; CHECK-O123SZ-NEXT: Running pass: SROAPass on foo
69 ; CHECK-O123SZ-NEXT: Running pass: EarlyCSEPass on foo
70 ; CHECK-O123SZ-NEXT: Running pass: SimplifyCFGPass on foo
71 ; CHECK-O123SZ-NEXT: Running pass: InstCombinePass on foo
72 ; CHECK-O123SZ-NEXT: Invalidating analysis: InlineAdvisorAnalysis
73 ; CHECK-O123SZ-NEXT: Running pass: GlobalDCEPass
74 ; CHECK-O-NEXT: Running pass: PGOInstrumentationUse
75 ; These next two can appear in any order since they are accessed as parameters
76 ; on the same call to BlockFrequencyInfo::calculate.
77 ; CHECK-O-DAG: Running analysis: BranchProbabilityAnalysis on foo
78 ; CHECK-O-DAG: Running analysis: PostDominatorTreeAnalysis on foo
79 ; CHECK-O-DAG: Running analysis: LoopAnalysis on foo
80 ; CHECK-O-NEXT: Running analysis: BlockFrequencyAnalysis on foo
81 ; CHECK-O-NEXT: Invalidating analysis: InnerAnalysisManagerProxy
82 ; CHECK-O123SZ-NEXT: Invalidating analysis: LazyCallGraphAnalysis on
83 ; CHECK-O123SZ-NEXT: Invalidating analysis: InnerAnalysisManagerProxy
84 ; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}ProfileSummaryAnalysis
85 ; CHECK-O-NEXT: Running pass: PGOIndirectCallPromotion on
86 ; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy
87 ; CHECK-O-NEXT: Running analysis: OptimizationRemarkEmitterAnalysis on foo
88 ; CHECK-O-NEXT: Running pass: ModuleInlinerWrapperPass
89 ; CHECK-O-NEXT: Running analysis: InlineAdvisorAnalysis
90 ; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}GlobalsAA
91 ; CHECK-O-NEXT: Running analysis: GlobalsAA
92 ; CHECK-O-NEXT: Running analysis: CallGraphAnalysis
93 ; CHECK-O-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}AAManager
94 ; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}ProfileSummaryAnalysis
95 ; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy
96 ; CHECK-O-NEXT: Running analysis: LazyCallGraphAnalysis
97 ; CHECK-O-NEXT: Running analysis: TargetLibraryAnalysis on foo
98 ; CHECK-O-NEXT: Running analysis: FunctionAnalysisManagerCGSCCProxy
99 ; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy<{{.*}}LazyCallGraph::SCC{{.*}}>
100 ; CHECK-O-NEXT: Running pass: DevirtSCCRepeatedPass
101 ; CHECK-O-NEXT: Running pass: InlinerPass
102 ; CHECK-O-NEXT: Running pass: InlinerPass
103 ; CHECK-O-NEXT: Running pass: PostOrderFunctionAttrsPass
104 ; CHECK-O-NEXT: Running analysis: AAManager
105 ; CHECK-O-NEXT: Running analysis: BasicAA
106 ; CHECK-O-NEXT: Running analysis: AssumptionAnalysis
107 ; CHECK-O-NEXT: Running analysis: TargetIRAnalysis
108 ; CHECK-O-NEXT: Running analysis: DominatorTreeAnalysis
109 ; CHECK-O-NEXT: Running analysis: ScopedNoAliasAA
110 ; CHECK-O-NEXT: Running analysis: TypeBasedAA
111 ; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy
112 ; CHECK-O3-NEXT: Running pass: ArgumentPromotionPass
113 ; CHECK-O2-NEXT: Running pass: OpenMPOptCGSCCPass
114 ; CHECK-O3-NEXT: Running pass: OpenMPOptCGSCCPass
115 ; CHECK-O-NEXT: Running pass: SROAPass
116 ; CHECK-O-NEXT: Running pass: EarlyCSEPass
117 ; CHECK-O-NEXT: Running analysis: MemorySSAAnalysis
118 ; CHECK-O23SZ-NEXT: Running pass: SpeculativeExecutionPass
119 ; CHECK-O23SZ-NEXT: Running pass: JumpThreadingPass
120 ; CHECK-O23SZ-NEXT: Running analysis: LazyValueAnalysis
121 ; CHECK-O23SZ-NEXT: Running pass: CorrelatedValuePropagationPass
122 ; CHECK-O23SZ-NEXT: Invalidating analysis: LazyValueAnalysis
123 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
124 ; CHECK-O-NEXT: Running pass: InstCombinePass
125 ; CHECK-O-NEXT: Running analysis: BlockFrequencyAnalysis on foo
126 ; These next two can appear in any order since they are accessed as parameters
127 ; on the same call to BlockFrequencyInfo::calculate.
128 ; CHECK-O-DAG: Running analysis: LoopAnalysis on foo
129 ; CHECK-O-DAG: Running analysis: BranchProbabilityAnalysis on foo
130 ; CHECK-O-DAG: Running analysis: PostDominatorTreeAnalysis on foo
131 ; CHECK-O3-NEXT: Running pass: AggressiveInstCombinePass
132 ; CHECK-O1-NEXT: Running pass: LibCallsShrinkWrapPass
133 ; CHECK-O2-NEXT: Running pass: LibCallsShrinkWrapPass
134 ; CHECK-O3-NEXT: Running pass: LibCallsShrinkWrapPass
135 ; CHECK-O2-NEXT: Running pass: PGOMemOPSizeOpt
136 ; CHECK-O3-NEXT: Running pass: PGOMemOPSizeOpt
137 ; CHECK-O23SZ-NEXT: Running pass: TailCallElimPass
138 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
139 ; CHECK-O-NEXT: Running pass: ReassociatePass
140 ; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}OptimizationRemarkEmitterAnalysis
141 ; CHECK-O-NEXT: Running pass: LoopSimplifyPass
142 ; CHECK-O-NEXT: Running pass: LCSSAPass
143 ; CHECK-O-NEXT: Running analysis: ScalarEvolutionAnalysis
144 ; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy
145 ; CHECK-O-NEXT: Running pass: LoopInstSimplifyPass
146 ; CHECK-O-NEXT: Running pass: LoopSimplifyCFGPass
147 ; CHECK-O-NEXT: Running pass: LICM
148 ; CHECK-O-NEXT: Running pass: LoopRotatePass
149 ; CHECK-O-NEXT: Running pass: LICM
150 ; CHECK-O-NEXT: Running pass: SimpleLoopUnswitchPass
151 ; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy
152 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
153 ; CHECK-O-NEXT: Running pass: InstCombinePass
154 ; CHECK-O-NEXT: Running pass: LoopSimplifyPass
155 ; CHECK-O-NEXT: Running pass: LCSSAPass
156 ; CHECK-O-NEXT: Running pass: LoopIdiomRecognizePass
157 ; CHECK-O-NEXT: Running pass: IndVarSimplifyPass
158 ; CHECK-O-NEXT: Running pass: LoopDeletionPass
159 ; CHECK-O-NEXT: Running pass: LoopFullUnrollPass
160 ; CHECK-O-NEXT: Running pass: SROAPass on foo
161 ; CHECK-Os-NEXT: Running pass: MergedLoadStoreMotionPass
162 ; CHECK-Os-NEXT: Running pass: GVNPass
163 ; CHECK-Os-NEXT: Running analysis: MemoryDependenceAnalysis
164 ; CHECK-Os-NEXT: Running analysis: PhiValuesAnalysis
165 ; CHECK-Oz-NEXT: Running pass: MergedLoadStoreMotionPass
166 ; CHECK-Oz-NEXT: Running pass: GVNPass
167 ; CHECK-Oz-NEXT: Running analysis: MemoryDependenceAnalysis
168 ; CHECK-Oz-NEXT: Running analysis: PhiValuesAnalysis
169 ; CHECK-O2-NEXT: Running pass: MergedLoadStoreMotionPass
170 ; CHECK-O2-NEXT: Running pass: GVNPass
171 ; CHECK-O2-NEXT: Running analysis: MemoryDependenceAnalysis
172 ; CHECK-O2-NEXT: Running analysis: PhiValuesAnalysis
173 ; CHECK-O3-NEXT: Running pass: MergedLoadStoreMotionPass
174 ; CHECK-O3-NEXT: Running pass: GVNPass
175 ; CHECK-O3-NEXT: Running analysis: MemoryDependenceAnalysis
176 ; CHECK-O3-NEXT: Running analysis: PhiValuesAnalysis
177 ; CHECK-O1-NEXT: Running pass: MemCpyOptPass
178 ; CHECK-O-NEXT: Running pass: SCCPPass
179 ; CHECK-O-NEXT: Running pass: BDCEPass
180 ; CHECK-O-NEXT: Running analysis: DemandedBitsAnalysis
181 ; CHECK-O-NEXT: Running pass: InstCombinePass
182 ; CHECK-O23SZ-NEXT: Running pass: JumpThreadingPass
183 ; CHECK-O23SZ-NEXT: Running analysis: LazyValueAnalysis
184 ; CHECK-O23SZ-NEXT: Running pass: CorrelatedValuePropagationPass
185 ; CHECK-O23SZ-NEXT: Invalidating analysis: LazyValueAnalysis
186 ; CHECK-O1-NEXT: Running pass: CoroElidePass
187 ; CHECK-O-NEXT: Running pass: ADCEPass
188 ; CHECK-O23SZ-NEXT: Running pass: MemCpyOptPass
189 ; CHECK-O23SZ-NEXT: Running pass: DSEPass
190 ; CHECK-O23SZ-NEXT: Running pass: LoopSimplifyPass
191 ; CHECK-O23SZ-NEXT: Running pass: LCSSAPass
192 ; CHECK-O23SZ-NEXT: Running pass: LICMPass
193 ; CHECK-O23SZ-NEXT: Running pass: CoroElidePass
194 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
195 ; CHECK-O-NEXT: Running pass: InstCombinePass
196 ; CHECK-O3-NEXT: Running pass: ControlHeightReductionPass on foo
197 ; CHECK-O3-NEXT: Running analysis: RegionInfoAnalysis on foo
198 ; CHECK-O3-NEXT: Running analysis: DominanceFrontierAnalysis on foo
199 ; CHECK-O-NEXT: Running analysis: ShouldNotRunFunctionPassesAnalysis
200 ; CHECK-O-NEXT: Running pass: CoroSplitPass
201 ; CHECK-O-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}ShouldNotRunFunctionPassesAnalysis
202 ; CHECK-O-NEXT: Invalidating analysis: ShouldNotRunFunctionPassesAnalysis
203 ; CHECK-O-NEXT: Invalidating analysis: InlineAdvisorAnalysis
204 ; CHECK-O-NEXT: Running pass: CoroCleanupPass
205 ; CHECK-O-NEXT: Running pass: GlobalOptPass
206 ; CHECK-O-NEXT: Running analysis: TargetLibraryAnalysis on bar
207 ; CHECK-EXT: Running pass: {{.*}}::Bye
208 ; CHECK-O-NEXT: Running pass: AnnotationRemarksPass on foo
209 ; CHECK-O-NEXT: Running pass: CanonicalizeAliasesPass
210 ; CHECK-O-NEXT: Running pass: NameAnonGlobalPass
211 ; CHECK-O-NEXT: Running pass: PrintModulePass
213 ; Make sure we get the IR back out without changes when we print the module.
214 ; CHECK-O-LABEL: define void @foo(i32 %n) local_unnamed_addr {
215 ; CHECK-O-NEXT: entry:
216 ; CHECK-O-NEXT:   br label %loop
217 ; CHECK-O:      loop:
218 ; CHECK-O-NEXT:   %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
219 ; CHECK-O-NEXT:   %iv.next = add i32 %iv, 1
220 ; CHECK-O-NEXT:   tail call void @bar()
221 ; CHECK-O-NEXT:   %cmp = icmp eq i32 %iv, %n
222 ; CHECK-O-NEXT:   br i1 %cmp, label %exit, label %loop
223 ; CHECK-O:      exit:
224 ; CHECK-O-NEXT:   ret void
225 ; CHECK-O-NEXT: }
227 ; Ignore a bunch of intervening metadata containing profile data.
230 declare void @bar() local_unnamed_addr
232 define void @foo(i32 %n) local_unnamed_addr {
233 entry:
234   br label %loop
235 loop:
236   %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
237   %iv.next = add i32 %iv, 1
238   tail call void @bar()
239   %cmp = icmp eq i32 %iv, %n
240   br i1 %cmp, label %exit, label %loop
241 exit:
242   ret void