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-analysis-invalidation=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
9 ; RUN: opt -disable-verify -verify-analysis-invalidation=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
13 ; RUN: opt -disable-verify -verify-analysis-invalidation=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-EP-PIPELINE-START
17 ; RUN: opt -disable-verify -verify-analysis-invalidation=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-O23SZ
21 ; RUN: opt -disable-verify -verify-analysis-invalidation=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-O23SZ
25 ; RUN: opt -disable-verify -verify-analysis-invalidation=0 -eagerly-invalidate-analyses=0 -debug-pass-manager -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
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: EntryExitInstrumenterPass
38 ; CHECK-O-NEXT: Running pass: LowerExpectIntrinsicPass
39 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
40 ; CHECK-O-NEXT: Running analysis: TargetIRAnalysis
41 ; CHECK-O-NEXT: Running analysis: AssumptionAnalysis
42 ; CHECK-O-NEXT: Running pass: SROAPass
43 ; CHECK-O-NEXT: Running analysis: DominatorTreeAnalysis
44 ; CHECK-O-NEXT: Running pass: EarlyCSEPass
45 ; CHECK-O-NEXT: Running analysis: TargetLibraryAnalysis
46 ; CHECK-O3-NEXT: Running pass: CallSiteSplittingPass
47 ; CHECK-O-NEXT: Running pass: OpenMPOptPass
48 ; CHECK-O-NEXT: Running pass: IPSCCPPass
49 ; CHECK-O-NEXT: Running pass: CalledValuePropagationPass
50 ; CHECK-O-NEXT: Running pass: GlobalOptPass
51 ; CHECK-O-NEXT: Running pass: PromotePass
52 ; CHECK-O-NEXT: Running pass: InstCombinePass
53 ; CHECK-O-NEXT: Running analysis: LastRunTrackingAnalysis
54 ; CHECK-O-NEXT: Running analysis: OptimizationRemarkEmitterAnalysis
55 ; CHECK-O-NEXT: Running analysis: AAManager
56 ; CHECK-O-NEXT: Running analysis: BasicAA
57 ; CHECK-O-NEXT: Running analysis: ScopedNoAliasAA
58 ; CHECK-O-NEXT: Running analysis: TypeBasedAA
59 ; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy
60 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
61 ; CHECK-O-NEXT: Running pass: ModuleInlinerWrapperPass
62 ; CHECK-O-NEXT: Running analysis: InlineAdvisorAnalysis
63 ; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy
64 ; CHECK-O-NEXT: Running analysis: LazyCallGraphAnalysis
65 ; CHECK-O-NEXT: Running analysis: FunctionAnalysisManagerCGSCCProxy on (foo)
66 ; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy
67 ; CHECK-O-NEXT: Running pass: InlinerPass on (foo)
68 ; CHECK-O-NEXT: Running pass: InlinerPass on (foo)
69 ; CHECK-O-NEXT: Running pass: SROAPass on foo
70 ; CHECK-O-NEXT: Running pass: EarlyCSEPass on foo
71 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass on foo
72 ; CHECK-O-NEXT: Running pass: InstCombinePass on foo
73 ; CHECK-O-NEXT: Invalidating analysis: InlineAdvisorAnalysis
74 ; CHECK-O-NEXT: Running pass: GlobalDCEPass
75 ; CHECK-O-NEXT: Running pass: PGOInstrumentationUse
76 ; CHECK-O-NEXT: Running analysis: ProfileSummaryAnalysis
77 ; CHECK-O-NEXT: Running analysis: BranchProbabilityAnalysis on foo
78 ; CHECK-O-NEXT: Running analysis: LoopAnalysis on foo
79 ; CHECK-O-NEXT: Running analysis: PostDominatorTreeAnalysis on foo
80 ; CHECK-O-NEXT: Running analysis: BlockFrequencyAnalysis on foo
81 ; CHECK-O-NEXT: Invalidating analysis: InnerAnalysisManagerProxy
82 ; CHECK-O-NEXT: Invalidating analysis: LazyCallGraphAnalysis on
83 ; CHECK-O-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: PGOForceFunctionAttrsPass
89 ; CHECK-O-NEXT: Running pass: AlwaysInlinerPass
90 ; CHECK-O-NEXT: Running pass: ModuleInlinerWrapperPass
91 ; CHECK-O-NEXT: Running analysis: InlineAdvisorAnalysis
92 ; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}GlobalsAA
93 ; CHECK-O-NEXT: Running analysis: GlobalsAA
94 ; CHECK-O-NEXT: Running analysis: CallGraphAnalysis
95 ; CHECK-O-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}AAManager
96 ; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}ProfileSummaryAnalysis
97 ; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy
98 ; CHECK-O-NEXT: Running analysis: LazyCallGraphAnalysis
99 ; CHECK-O-NEXT: Running analysis: TargetLibraryAnalysis on foo
100 ; CHECK-O-NEXT: Running analysis: FunctionAnalysisManagerCGSCCProxy
101 ; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy<{{.*}}LazyCallGraph::SCC{{.*}}>
102 ; CHECK-O-NEXT: Running pass: DevirtSCCRepeatedPass
103 ; CHECK-O-NEXT: Running pass: InlinerPass
104 ; CHECK-O-NEXT: Running pass: PostOrderFunctionAttrsPass
105 ; CHECK-O3-NEXT: Running pass: ArgumentPromotionPass
106 ; CHECK-O2-NEXT: Running pass: OpenMPOptCGSCCPass
107 ; CHECK-O3-NEXT: Running pass: OpenMPOptCGSCCPass
108 ; CHECK-O-NEXT: Running pass: SROAPass
109 ; CHECK-O-NEXT: Running analysis: DominatorTreeAnalysis
110 ; CHECK-O-NEXT: Running analysis: AssumptionAnalysis
111 ; CHECK-O-NEXT: Running analysis: TargetIRAnalysis
112 ; CHECK-O-NEXT: Running pass: EarlyCSEPass
113 ; CHECK-O-NEXT: Running analysis: MemorySSAAnalysis
114 ; CHECK-O-NEXT: Running analysis: AAManager
115 ; CHECK-O-NEXT: Running analysis: BasicAA
116 ; CHECK-O-NEXT: Running analysis: ScopedNoAliasAA
117 ; CHECK-O-NEXT: Running analysis: TypeBasedAA
118 ; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy
119 ; CHECK-O23SZ-NEXT: Running pass: SpeculativeExecutionPass
120 ; CHECK-O23SZ-NEXT: Running pass: JumpThreadingPass
121 ; CHECK-O23SZ-NEXT: Running analysis: LazyValueAnalysis
122 ; CHECK-O23SZ-NEXT: Running pass: CorrelatedValuePropagationPass
123 ; CHECK-O23SZ-NEXT: Invalidating analysis: LazyValueAnalysis
124 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
125 ; CHECK-O-NEXT: Running pass: InstCombinePass
126 ; CHECK-O-NEXT: Running analysis: LastRunTrackingAnalysis
127 ; CHECK-O-NEXT: Running analysis: BlockFrequencyAnalysis on foo
128 ; CHECK-O-NEXT: Running analysis: BranchProbabilityAnalysis on foo
129 ; CHECK-O-NEXT: Running analysis: LoopAnalysis on foo
130 ; CHECK-O-NEXT: Running analysis: PostDominatorTreeAnalysis on foo
131 ; CHECK-O23SZ-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-O23SZ-NEXT: Running pass: ConstraintEliminationPass
141 ; CHECK-O23SZ-NEXT: Running analysis: ScalarEvolutionAnalysis
142 ; CHECK-O-NEXT: Running pass: LoopSimplifyPass
143 ; CHECK-O-NEXT: Running pass: LCSSAPass
144 ; CHECK-O1-NEXT: Running analysis: ScalarEvolutionAnalysis
145 ; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy
146 ; CHECK-O-NEXT: Running pass: LoopInstSimplifyPass
147 ; CHECK-O-NEXT: Running pass: LoopSimplifyCFGPass
148 ; CHECK-O-NEXT: Running pass: LICM
149 ; CHECK-O-NEXT: Running pass: LoopRotatePass
150 ; CHECK-O-NEXT: Running pass: LICM
151 ; CHECK-O-NEXT: Running pass: SimpleLoopUnswitchPass
152 ; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy
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: SROAPass on foo
162 ; CHECK-O23SZ-NEXT: Running pass: VectorCombinePass
163 ; CHECK-O23SZ-NEXT: Running pass: MergedLoadStoreMotionPass
164 ; CHECK-O23SZ-NEXT: Running pass: GVNPass
165 ; CHECK-O23SZ-NEXT: Running analysis: MemoryDependenceAnalysis
166 ; CHECK-O1-NEXT: Running pass: MemCpyOptPass
167 ; CHECK-O-NEXT: Running pass: SCCPPass
168 ; CHECK-O-NEXT: Running pass: BDCEPass
169 ; CHECK-O-NEXT: Running analysis: DemandedBitsAnalysis
170 ; CHECK-O-NEXT: Running pass: InstCombinePass
171 ; CHECK-O23SZ-NEXT: Running pass: JumpThreadingPass
172 ; CHECK-O23SZ-NEXT: Running analysis: LazyValueAnalysis
173 ; CHECK-O23SZ-NEXT: Running pass: CorrelatedValuePropagationPass
174 ; CHECK-O23SZ-NEXT: Invalidating analysis: LazyValueAnalysis
175 ; CHECK-O1-NEXT: Running pass: CoroElidePass
176 ; CHECK-O-NEXT: Running pass: ADCEPass
177 ; CHECK-O23SZ-NEXT: Running pass: MemCpyOptPass
178 ; CHECK-O23SZ-NEXT: Running pass: DSEPass
179 ; CHECK-O23SZ-NEXT: Running pass: MoveAutoInitPass on foo
180 ; CHECK-O23SZ-NEXT: Running pass: LoopSimplifyPass
181 ; CHECK-O23SZ-NEXT: Running pass: LCSSAPass
182 ; CHECK-O23SZ-NEXT: Running pass: LICMPass
183 ; CHECK-O23SZ-NEXT: Running pass: CoroElidePass
184 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
185 ; CHECK-O-NEXT: Running pass: InstCombinePass
186 ; CHECK-O-NEXT: Running pass: PostOrderFunctionAttrsPass
187 ; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}ShouldNotRunFunctionPassesAnalysis
188 ; CHECK-O-NEXT: Running analysis: ShouldNotRunFunctionPassesAnalysis
189 ; CHECK-O-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}ShouldNotRunFunctionPassesAnalysis
190 ; CHECK-O-NEXT: Invalidating analysis: ShouldNotRunFunctionPassesAnalysis
191 ; CHECK-O-NEXT: Invalidating analysis: InlineAdvisorAnalysis
192 ; CHECK-O-NEXT: Running pass: DeadArgumentEliminationPass
193 ; CHECK-O-NEXT: Running pass: GlobalOptPass
194 ; CHECK-O-NEXT: Running analysis: TargetLibraryAnalysis on bar
195 ; CHECK-O-NEXT: Running pass: GlobalDCEPass
196 ; CHECK-EXT: Running pass: {{.*}}::Bye
197 ; CHECK-O-NEXT: Running pass: AnnotationRemarksPass on foo
198 ; CHECK-O-NEXT: Running pass: CanonicalizeAliasesPass
199 ; CHECK-O-NEXT: Running pass: NameAnonGlobalPass
200 ; CHECK-O-NEXT: Running pass: PrintModulePass
202 ; Make sure we get the IR back out without changes when we print the module.
203 ; CHECK-O-LABEL: define void @foo(i32 %n) local_unnamed_addr {
204 ; CHECK-O-NEXT: entry:
205 ; CHECK-O-NEXT: br label %loop
207 ; CHECK-O-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
208 ; CHECK-O-NEXT: %iv.next = add i32 %iv, 1
209 ; CHECK-O-NEXT: tail call void @bar()
210 ; CHECK-O-NEXT: %cmp = icmp eq i32 %iv, %n
211 ; CHECK-O-NEXT: br i1 %cmp, label %exit, label %loop
213 ; CHECK-O-NEXT: ret void
216 ; Ignore a bunch of intervening metadata containing profile data.
219 declare void @bar() local_unnamed_addr
221 define void @foo(i32 %n) local_unnamed_addr {
225 %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
226 %iv.next = add i32 %iv, 1
227 tail call void @bar()
228 %cmp = icmp eq i32 %iv, %n
229 br i1 %cmp, label %exit, label %loop