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 -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 -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 -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 -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 -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 -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: LowerExpectIntrinsicPass
37 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
38 ; CHECK-O-NEXT: Running analysis: TargetIRAnalysis
39 ; CHECK-O-NEXT: Running analysis: AssumptionAnalysis
40 ; CHECK-O-NEXT: Running pass: SROA
41 ; CHECK-O-NEXT: Running analysis: DominatorTreeAnalysis
42 ; CHECK-O-NEXT: Running pass: EarlyCSEPass
43 ; CHECK-O-NEXT: Running analysis: TargetLibraryAnalysis
44 ; CHECK-O-NEXT: Running pass: CoroEarlyPass
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: SROA 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: Running pass: GlobalDCEPass
73 ; CHECK-O-NEXT: Running pass: PGOInstrumentationUse
74 ; These next two can appear in any order since they are accessed as parameters
75 ; on the same call to BlockFrequencyInfo::calculate.
76 ; CHECK-O-DAG: Running analysis: BranchProbabilityAnalysis on foo
77 ; CHECK-O-DAG: Running analysis: PostDominatorTreeAnalysis on foo
78 ; CHECK-O-DAG: Running analysis: LoopAnalysis on foo
79 ; CHECK-O-NEXT: Running analysis: BlockFrequencyAnalysis on foo
80 ; CHECK-O-NEXT: Invalidating analysis: InnerAnalysisManagerProxy
81 ; CHECK-O123SZ-NEXT: Invalidating analysis: LazyCallGraphAnalysis on
82 ; CHECK-O123SZ-NEXT: Invalidating analysis: InnerAnalysisManagerProxy
83 ; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}ProfileSummaryAnalysis
84 ; CHECK-O-NEXT: Running pass: PGOIndirectCallPromotion on
85 ; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy
86 ; CHECK-O-NEXT: Running analysis: OptimizationRemarkEmitterAnalysis on foo
87 ; CHECK-O-NEXT: Running pass: ModuleInlinerWrapperPass
88 ; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}GlobalsAA
89 ; CHECK-O-NEXT: Running analysis: GlobalsAA
90 ; CHECK-O-NEXT: Running analysis: CallGraphAnalysis
91 ; CHECK-O-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}AAManager
92 ; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}ProfileSummaryAnalysis
93 ; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy
94 ; CHECK-O-NEXT: Running analysis: LazyCallGraphAnalysis
95 ; CHECK-O-NEXT: Running analysis: TargetLibraryAnalysis on foo
96 ; CHECK-O-NEXT: Running analysis: FunctionAnalysisManagerCGSCCProxy
97 ; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy<{{.*}}LazyCallGraph::SCC{{.*}}>
98 ; CHECK-O-NEXT: Running pass: DevirtSCCRepeatedPass
99 ; CHECK-O-NEXT: Running pass: InlinerPass
100 ; CHECK-O-NEXT: Running pass: InlinerPass
101 ; CHECK-O-NEXT: Running pass: PostOrderFunctionAttrsPass
102 ; CHECK-O-NEXT: Running analysis: AAManager
103 ; CHECK-O-NEXT: Running analysis: BasicAA
104 ; CHECK-O-NEXT: Running analysis: AssumptionAnalysis
105 ; CHECK-O-NEXT: Running analysis: DominatorTreeAnalysis
106 ; CHECK-O-NEXT: Running analysis: ScopedNoAliasAA
107 ; CHECK-O-NEXT: Running analysis: TypeBasedAA
108 ; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy
109 ; CHECK-O3-NEXT: Running pass: ArgumentPromotionPass
110 ; CHECK-O3-NEXT: Running analysis: TargetIRAnalysis
111 ; CHECK-O2-NEXT: Running pass: OpenMPOptCGSCCPass
112 ; CHECK-O3-NEXT: Running pass: OpenMPOptCGSCCPass
113 ; CHECK-O-NEXT: Running pass: SROA
114 ; CHECK-O-NEXT: Running pass: EarlyCSEPass
115 ; CHECK-O1-NEXT: Running analysis: TargetIRAnalysis on foo
116 ; CHECK-O2-NEXT: Running analysis: TargetIRAnalysis on foo
117 ; CHECK-Os-NEXT: Running analysis: TargetIRAnalysis on foo
118 ; CHECK-Oz-NEXT: Running analysis: TargetIRAnalysis on foo
119 ; CHECK-O-NEXT: Running analysis: MemorySSAAnalysis
120 ; CHECK-O23SZ-NEXT: Running pass: SpeculativeExecutionPass
121 ; CHECK-O23SZ-NEXT: Running pass: JumpThreadingPass
122 ; CHECK-O23SZ-NEXT: Running analysis: LazyValueAnalysis
123 ; CHECK-O23SZ-NEXT: Running pass: CorrelatedValuePropagationPass
124 ; CHECK-O23SZ-NEXT: Invalidating analysis: LazyValueAnalysis
125 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
126 ; CHECK-O3-NEXT: Running pass: AggressiveInstCombinePass
127 ; CHECK-O-NEXT: Running pass: InstCombinePass
128 ; CHECK-O-NEXT: Running analysis: BlockFrequencyAnalysis on foo
129 ; These next two can appear in any order since they are accessed as parameters
130 ; on the same call to BlockFrequencyInfo::calculate.
131 ; CHECK-O-DAG: Running analysis: LoopAnalysis on foo
132 ; CHECK-O-DAG: Running analysis: BranchProbabilityAnalysis on foo
133 ; CHECK-O-DAG: Running analysis: PostDominatorTreeAnalysis on foo
134 ; CHECK-O1-NEXT: Running pass: LibCallsShrinkWrapPass
135 ; CHECK-O2-NEXT: Running pass: LibCallsShrinkWrapPass
136 ; CHECK-O3-NEXT: Running pass: LibCallsShrinkWrapPass
137 ; CHECK-O2-NEXT: Running pass: PGOMemOPSizeOpt
138 ; CHECK-O3-NEXT: Running pass: PGOMemOPSizeOpt
139 ; CHECK-O23SZ-NEXT: Running pass: TailCallElimPass
140 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
141 ; CHECK-O-NEXT: Running pass: ReassociatePass
142 ; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}OptimizationRemarkEmitterAnalysis
143 ; CHECK-O-NEXT: Running pass: LoopSimplifyPass
144 ; CHECK-O-NEXT: Running pass: LCSSAPass
145 ; CHECK-O-NEXT: Running analysis: ScalarEvolutionAnalysis
146 ; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy
147 ; CHECK-O-NEXT: Running pass: LoopInstSimplifyPass
148 ; CHECK-O-NEXT: Running pass: LoopSimplifyCFGPass
149 ; CHECK-O-NEXT: Running pass: LICM
150 ; CHECK-O-NEXT: Running pass: LoopRotatePass
151 ; CHECK-O-NEXT: Running pass: LICM
152 ; CHECK-O-NEXT: Running pass: SimpleLoopUnswitchPass
153 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
154 ; CHECK-O-NEXT: Running pass: InstCombinePass
155 ; CHECK-O-NEXT: Running pass: LoopSimplifyPass
156 ; CHECK-O-NEXT: Running pass: LCSSAPass
157 ; CHECK-O-NEXT: Running pass: LoopIdiomRecognizePass
158 ; CHECK-O-NEXT: Running pass: IndVarSimplifyPass
159 ; CHECK-O-NEXT: Running pass: LoopDeletionPass
160 ; CHECK-O-NEXT: Running pass: LoopFullUnrollPass
161 ; CHECK-O-NEXT: Running pass: SROA on foo
162 ; CHECK-Os-NEXT: Running pass: MergedLoadStoreMotionPass
163 ; CHECK-Os-NEXT: Running pass: GVN
164 ; CHECK-Os-NEXT: Running analysis: MemoryDependenceAnalysis
165 ; CHECK-Os-NEXT: Running analysis: PhiValuesAnalysis
166 ; CHECK-Oz-NEXT: Running pass: MergedLoadStoreMotionPass
167 ; CHECK-Oz-NEXT: Running pass: GVN
168 ; CHECK-Oz-NEXT: Running analysis: MemoryDependenceAnalysis
169 ; CHECK-Oz-NEXT: Running analysis: PhiValuesAnalysis
170 ; CHECK-O2-NEXT: Running pass: MergedLoadStoreMotionPass
171 ; CHECK-O2-NEXT: Running pass: GVN
172 ; CHECK-O2-NEXT: Running analysis: MemoryDependenceAnalysis
173 ; CHECK-O2-NEXT: Running analysis: PhiValuesAnalysis
174 ; CHECK-O3-NEXT: Running pass: MergedLoadStoreMotionPass
175 ; CHECK-O3-NEXT: Running pass: GVN
176 ; CHECK-O3-NEXT: Running analysis: MemoryDependenceAnalysis
177 ; CHECK-O3-NEXT: Running analysis: PhiValuesAnalysis
178 ; CHECK-O1-NEXT: Running pass: MemCpyOptPass
179 ; CHECK-O-NEXT: Running pass: SCCPPass
180 ; CHECK-O-NEXT: Running pass: BDCEPass
181 ; CHECK-O-NEXT: Running analysis: DemandedBitsAnalysis
182 ; CHECK-O-NEXT: Running pass: InstCombinePass
183 ; CHECK-O23SZ-NEXT: Running pass: JumpThreadingPass
184 ; CHECK-O23SZ-NEXT: Running analysis: LazyValueAnalysis
185 ; CHECK-O23SZ-NEXT: Running pass: CorrelatedValuePropagationPass
186 ; CHECK-O23SZ-NEXT: Invalidating analysis: LazyValueAnalysis
187 ; CHECK-O1-NEXT: Running pass: CoroElidePass
188 ; CHECK-O-NEXT: Running pass: ADCEPass
189 ; CHECK-O23SZ-NEXT: Running pass: MemCpyOptPass
190 ; CHECK-O23SZ-NEXT: Running pass: DSEPass
191 ; CHECK-O23SZ-NEXT: Running pass: LoopSimplifyPass
192 ; CHECK-O23SZ-NEXT: Running pass: LCSSAPass
193 ; CHECK-O23SZ-NEXT: Running pass: LICMPass
194 ; CHECK-O23SZ-NEXT: Running pass: CoroElidePass
195 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
196 ; CHECK-O-NEXT: Running pass: InstCombinePass
197 ; CHECK-O3-NEXT: Running pass: ControlHeightReductionPass on foo
198 ; CHECK-O3-NEXT: Running analysis: RegionInfoAnalysis on foo
199 ; CHECK-O3-NEXT: Running analysis: DominanceFrontierAnalysis on foo
200 ; CHECK-O-NEXT: Running pass: CoroSplitPass
201 ; CHECK-O-NEXT: Running pass: GlobalOptPass
202 ; CHECK-O-NEXT: Running analysis: TargetLibraryAnalysis on bar
203 ; CHECK-EXT: Running pass: {{.*}}::Bye
204 ; CHECK-O-NEXT: Running pass: CoroCleanupPass
205 ; CHECK-O-NEXT: Running pass: AnnotationRemarksPass on foo
206 ; CHECK-O-NEXT: Running pass: CanonicalizeAliasesPass
207 ; CHECK-O-NEXT: Running pass: NameAnonGlobalPass
208 ; CHECK-O-NEXT: Running pass: PrintModulePass
210 ; Make sure we get the IR back out without changes when we print the module.
211 ; CHECK-O-LABEL: define void @foo(i32 %n) local_unnamed_addr {
212 ; CHECK-O-NEXT: entry:
213 ; CHECK-O-NEXT: br label %loop
215 ; CHECK-O-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
216 ; CHECK-O-NEXT: %iv.next = add i32 %iv, 1
217 ; CHECK-O-NEXT: tail call void @bar()
218 ; CHECK-O-NEXT: %cmp = icmp eq i32 %iv, %n
219 ; CHECK-O-NEXT: br i1 %cmp, label %exit, label %loop
221 ; CHECK-O-NEXT: ret void
224 ; Ignore a bunch of intervening metadata containing profile data.
227 declare void @bar() local_unnamed_addr
229 define void @foo(i32 %n) local_unnamed_addr {
233 %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
234 %iv.next = add i32 %iv, 1
235 tail call void @bar()
236 %cmp = icmp eq i32 %iv, %n
237 br i1 %cmp, label %exit, label %loop