1 ; Validate ThinLTO postlink pipeline when we have Sample PGO
3 ; RUN: opt -disable-verify -verify-analysis-invalidation=0 -eagerly-invalidate-analyses=0 -debug-pass-manager \
4 ; RUN: -pgo-kind=pgo-sample-use-pipeline -profile-file='%S/Inputs/new-pm-thinlto-samplepgo-defaults.prof' \
5 ; RUN: -passes='thinlto<O1>' -S %s 2>&1 \
6 ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O1,%llvmcheckext
7 ; RUN: opt -disable-verify -verify-analysis-invalidation=0 -eagerly-invalidate-analyses=0 -debug-pass-manager \
8 ; RUN: -pgo-kind=pgo-sample-use-pipeline -profile-file='%S/Inputs/new-pm-thinlto-samplepgo-defaults.prof' \
9 ; RUN: -passes='thinlto<O2>' -S %s 2>&1 \
10 ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O2,CHECK-O23SZ,%llvmcheckext
11 ; RUN: opt -disable-verify -verify-analysis-invalidation=0 -eagerly-invalidate-analyses=0 -debug-pass-manager -passes-ep-pipeline-start='no-op-module' \
12 ; RUN: -pgo-kind=pgo-sample-use-pipeline -profile-file='%S/Inputs/new-pm-thinlto-samplepgo-defaults.prof' \
13 ; RUN: -passes='thinlto<O3>' -S %s 2>&1 \
14 ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O3,CHECK-O23SZ,%llvmcheckext
15 ; RUN: opt -disable-verify -verify-analysis-invalidation=0 -eagerly-invalidate-analyses=0 -debug-pass-manager \
16 ; RUN: -pgo-kind=pgo-sample-use-pipeline -profile-file='%S/Inputs/new-pm-thinlto-samplepgo-defaults.prof' \
17 ; RUN: -passes='thinlto<Os>' -S %s 2>&1 \
18 ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-Os,CHECK-O23SZ,%llvmcheckext
19 ; RUN: opt -disable-verify -verify-analysis-invalidation=0 -eagerly-invalidate-analyses=0 -debug-pass-manager \
20 ; RUN: -pgo-kind=pgo-sample-use-pipeline -profile-file='%S/Inputs/new-pm-thinlto-samplepgo-defaults.prof' \
21 ; RUN: -passes='thinlto<Oz>' -S %s 2>&1 \
22 ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O23SZ,%llvmcheckext
23 ; RUN: opt -disable-verify -verify-analysis-invalidation=0 -eagerly-invalidate-analyses=0 -debug-pass-manager -debug-info-for-profiling \
24 ; RUN: -pgo-kind=pgo-sample-use-pipeline -profile-file='%S/Inputs/new-pm-thinlto-samplepgo-defaults.prof' \
25 ; RUN: -passes='thinlto<O2>' -S %s 2>&1 \
26 ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O2,CHECK-O23SZ,%llvmcheckext
28 ; Suppress FileCheck --allow-unused-prefixes=false diagnostics.
31 ; CHECK-EP-PIPELINE-START: Running pass: NoOpModulePass
32 ; CHECK-O: Running pass: SampleProfileLoaderPass
33 ; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy
34 ; CHECK-O-NEXT: Running analysis: LazyCallGraphAnalysis
35 ; CHECK-O-NEXT: Running analysis: TargetLibraryAnalysis
36 ; CHECK-O-NEXT: Running analysis: ProfileSummaryAnalysis
37 ; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}ProfileSummaryAnalysis
38 ; CHECK-O-NEXT: Running pass: PGOIndirectCallPromotion
39 ; CHECK-O-NEXT: Running analysis: OptimizationRemarkEmitterAnalysis
40 ; CHECK-O-NEXT: Running pass: OpenMPOptPass
41 ; CHECK-O-NEXT: Running pass: LowerTypeTestsPass
42 ; CHECK-O-NEXT: Running pass: IPSCCPPass
43 ; CHECK-O-NEXT: Running analysis: DominatorTreeAnalysis
44 ; CHECK-O-NEXT: Running analysis: AssumptionAnalysis
45 ; CHECK-O-NEXT: Running analysis: TargetIRAnalysis
46 ; CHECK-O-NEXT: Running pass: CalledValuePropagationPass
47 ; CHECK-O-NEXT: Running pass: GlobalOptPass
48 ; CHECK-O-NEXT: Running analysis: TargetLibraryAnalysis
49 ; CHECK-O-NEXT: Running pass: PromotePass
50 ; CHECK-O-NEXT: Running pass: InstCombinePass
51 ; CHECK-O-NEXT: Running analysis: LastRunTrackingAnalysis
52 ; CHECK-O-NEXT: Running analysis: AAManager on foo
53 ; CHECK-O-NEXT: Running analysis: BasicAA
54 ; CHECK-O-NEXT: Running analysis: ScopedNoAliasAA
55 ; CHECK-O-NEXT: Running analysis: TypeBasedAA
56 ; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy
57 ; CHECK-O-NEXT: Running analysis: BlockFrequencyAnalysis on foo
58 ; CHECK-O-NEXT: Running analysis: BranchProbabilityAnalysis on foo
59 ; CHECK-O-NEXT: Running analysis: LoopAnalysis on foo
60 ; CHECK-O-NEXT: Running analysis: PostDominatorTreeAnalysis on foo
61 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass on foo
63 ; CHECK-O-NEXT: Running pass: PGOForceFunctionAttrsPass
64 ; CHECK-O-NEXT: Running pass: AlwaysInlinerPass
65 ; CHECK-O-NEXT: Running pass: ModuleInlinerWrapperPass
66 ; CHECK-O-NEXT: Running analysis: InlineAdvisorAnalysis
67 ; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}GlobalsAA
68 ; CHECK-O-NEXT: Running analysis: GlobalsAA
69 ; CHECK-O-NEXT: Running analysis: CallGraphAnalysis
70 ; CHECK-O-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}AAManager
71 ; CHECK-O-NEXT: Invalidating analysis: AAManager
72 ; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}ProfileSummaryAnalysis
73 ; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy
74 ; CHECK-O-NEXT: Running analysis: FunctionAnalysisManagerCGSCCProxy
75 ; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy
76 ; CHECK-O-NEXT: Running pass: DevirtSCCRepeatedPass
77 ; CHECK-O-NEXT: Running pass: InlinerPass
78 ; CHECK-O-NEXT: Running pass: PostOrderFunctionAttrsPass
79 ; CHECK-O3-NEXT: Running pass: ArgumentPromotionPass
80 ; CHECK-O2-NEXT: Running pass: OpenMPOptCGSCCPass
81 ; CHECK-O3-NEXT: Running pass: OpenMPOptCGSCCPass
82 ; CHECK-O-NEXT: Running pass: SROAPass
83 ; CHECK-O-NEXT: Running pass: EarlyCSEPass
84 ; CHECK-O-NEXT: Running analysis: MemorySSAAnalysis
85 ; CHECK-O-NEXT: Running analysis: AAManager
86 ; CHECK-O23SZ-NEXT: Running pass: SpeculativeExecutionPass
87 ; CHECK-O23SZ-NEXT: Running pass: JumpThreadingPass
88 ; CHECK-O23SZ-NEXT: Running analysis: LazyValueAnalysis
89 ; CHECK-O23SZ-NEXT: Running pass: CorrelatedValuePropagationPass
90 ; CHECK-O23SZ-NEXT: Invalidating analysis: LazyValueAnalysis
91 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
92 ; CHECK-O-NEXT: Running pass: InstCombinePass
93 ; CHECK-O23SZ-NEXT: Running pass: AggressiveInstCombinePass
94 ; CHECK-O1-NEXT: Running pass: LibCallsShrinkWrapPass
95 ; CHECK-O2-NEXT: Running pass: LibCallsShrinkWrapPass
96 ; CHECK-O3-NEXT: Running pass: LibCallsShrinkWrapPass
97 ; CHECK-O23SZ-NEXT: Running pass: TailCallElimPass
98 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
99 ; CHECK-O-NEXT: Running pass: ReassociatePass
100 ; CHECK-O23SZ-NEXT: Running pass: ConstraintEliminationPass
101 ; CHECK-O23SZ-NEXT: Running analysis: ScalarEvolutionAnalysis
102 ; CHECK-O-NEXT: Running pass: LoopSimplifyPass
103 ; CHECK-O-NEXT: Running pass: LCSSAPass
104 ; CHECK-O1-NEXT: Running analysis: ScalarEvolutionAnalysis
105 ; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy
106 ; CHECK-O-NEXT: Running pass: LoopInstSimplifyPass
107 ; CHECK-O-NEXT: Running pass: LoopSimplifyCFGPass
108 ; CHECK-O-NEXT: Running pass: LICM
109 ; CHECK-O-NEXT: Running pass: LoopRotatePass
110 ; CHECK-O-NEXT: Running pass: LICM
111 ; CHECK-O-NEXT: Running pass: SimpleLoopUnswitchPass
112 ; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy
113 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
114 ; CHECK-O-NEXT: Running pass: InstCombinePass
115 ; CHECK-O-NEXT: Running pass: LoopSimplifyPass
116 ; CHECK-O-NEXT: Running pass: LCSSAPass
117 ; CHECK-O-NEXT: Running pass: LoopIdiomRecognizePass
118 ; CHECK-O-NEXT: Running pass: IndVarSimplifyPass
119 ; CHECK-O-NEXT: Running pass: LoopDeletionPass
120 ; CHECK-O-NEXT: Running pass: LoopFullUnrollPass
121 ; CHECK-O-NEXT: Running pass: SROAPass on foo
122 ; CHECK-O23SZ-NEXT: Running pass: VectorCombinePass
123 ; CHECK-O23SZ-NEXT: Running pass: MergedLoadStoreMotionPass
124 ; CHECK-O23SZ-NEXT: Running pass: GVNPass
125 ; CHECK-O23SZ-NEXT: Running analysis: MemoryDependenceAnalysis
126 ; CHECK-O1-NEXT: Running pass: MemCpyOptPass
127 ; CHECK-O-NEXT: Running pass: SCCPPass
128 ; CHECK-O-NEXT: Running pass: BDCEPass
129 ; CHECK-O-NEXT: Running analysis: DemandedBitsAnalysis
130 ; CHECK-O-NEXT: Running pass: InstCombinePass
131 ; CHECK-O23SZ-NEXT: Running pass: JumpThreadingPass
132 ; CHECK-O23SZ-NEXT: Running analysis: LazyValueAnalysis
133 ; CHECK-O23SZ-NEXT: Running pass: CorrelatedValuePropagationPass
134 ; CHECK-O23SZ-NEXT: Invalidating analysis: LazyValueAnalysis
135 ; CHECK-O1-NEXT: Running pass: CoroElidePass
136 ; CHECK-O-NEXT: Running pass: ADCEPass
137 ; CHECK-O23SZ-NEXT: Running pass: MemCpyOptPass
138 ; CHECK-O23SZ-NEXT: Running pass: DSEPass
139 ; CHECK-O23SZ-NEXT: Running pass: MoveAutoInitPass
140 ; CHECK-O23SZ-NEXT: Running pass: LoopSimplifyPass
141 ; CHECK-O23SZ-NEXT: Running pass: LCSSAPass
142 ; CHECK-O23SZ-NEXT: Running pass: LICMPass
143 ; CHECK-O23SZ-NEXT: Running pass: CoroElidePass
144 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
145 ; CHECK-O-NEXT: Running pass: InstCombinePass
146 ; CHECK-O-NEXT: Running pass: PostOrderFunctionAttrsPass
147 ; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}ShouldNotRunFunctionPassesAnalysis
148 ; CHECK-O-NEXT: Running analysis: ShouldNotRunFunctionPassesAnalysis
149 ; CHECK-O-NEXT: Running pass: CoroSplitPass
150 ; CHECK-O-NEXT: Running pass: CoroAnnotationElidePass
151 ; CHECK-O-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}ShouldNotRunFunctionPassesAnalysis
152 ; CHECK-O-NEXT: Invalidating analysis: ShouldNotRunFunctionPassesAnalysis
153 ; CHECK-O-NEXT: Invalidating analysis: InlineAdvisorAnalysis
154 ; CHECK-O-NEXT: Running pass: DeadArgumentEliminationPass
155 ; CHECK-O-NEXT: Running pass: CoroCleanupPass
156 ; CHECK-O-NEXT: Running pass: GlobalOptPass
157 ; CHECK-O-NEXT: Running pass: GlobalDCEPass
158 ; CHECK-O-NEXT: Running pass: EliminateAvailableExternallyPass
159 ; CHECK-O-NEXT: Running pass: ReversePostOrderFunctionAttrsPass
160 ; CHECK-O-NEXT: Running pass: RecomputeGlobalsAAPass
161 ; CHECK-O-NEXT: Running pass: Float2IntPass
162 ; CHECK-O-NEXT: Running pass: LowerConstantIntrinsicsPass
163 ; CHECK-O3-NEXT: Running pass: ControlHeightReductionPass
164 ; CHECK-O3-NEXT: Running analysis: RegionInfoAnalysis
165 ; CHECK-O3-NEXT: Running analysis: DominanceFrontierAnalysis
166 ; CHECK-EXT: Running pass: {{.*}}::Bye
167 ; CHECK-O-NEXT: Running pass: LoopSimplifyPass
168 ; CHECK-O-NEXT: Running pass: LCSSAPass
169 ; CHECK-O-NEXT: Running pass: LoopRotatePass
170 ; CHECK-O-NEXT: Running pass: LoopDeletionPass
171 ; CHECK-O-NEXT: Running pass: LoopDistributePass
172 ; CHECK-O-NEXT: Running analysis: LoopAccessAnalysis
173 ; CHECK-O-NEXT: Running pass: InjectTLIMappings
174 ; CHECK-O-NEXT: Running pass: LoopVectorizePass
175 ; CHECK-O-NEXT: Running pass: InferAlignmentPass
176 ; CHECK-O-NEXT: Running pass: LoopLoadEliminationPass
177 ; CHECK-O-NEXT: Running pass: InstCombinePass
178 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
179 ; CHECK-O2-NEXT: Running pass: SLPVectorizerPass
180 ; CHECK-O3-NEXT: Running pass: SLPVectorizerPass
181 ; CHECK-Os-NEXT: Running pass: SLPVectorizerPass
182 ; CHECK-O-NEXT: Running pass: VectorCombinePass
183 ; CHECK-O-NEXT: Running pass: InstCombinePass
184 ; CHECK-O-NEXT: Running pass: LoopUnrollPass
185 ; CHECK-O-NEXT: Running pass: WarnMissedTransformationsPass
186 ; CHECK-O-NEXT: Running pass: SROAPass
187 ; CHECK-O-NEXT: Running pass: InferAlignmentPass
188 ; CHECK-O-NEXT: Running pass: InstCombinePass
189 ; CHECK-O-NEXT: Running pass: LoopSimplifyPass
190 ; CHECK-O-NEXT: Running pass: LCSSAPass
191 ; CHECK-O-NEXT: Running pass: LICMPass
192 ; CHECK-O-NEXT: Running pass: AlignmentFromAssumptionsPass
193 ; CHECK-O-NEXT: Running pass: LoopSinkPass
194 ; CHECK-O-NEXT: Running pass: InstSimplifyPass
195 ; CHECK-O-NEXT: Running pass: DivRemPairsPass
196 ; CHECK-O-NEXT: Running pass: TailCallElimPass
197 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
198 ; CHECK-O-NEXT: Running pass: GlobalDCEPass
199 ; CHECK-O-NEXT: Running pass: ConstantMergePass
200 ; CHECK-O-NEXT: Running pass: CGProfilePass
201 ; CHECK-O-NEXT: Running pass: RelLookupTableConverterPass
202 ; CHECK-O-NEXT: Running pass: AnnotationRemarksPass on foo
203 ; CHECK-O-NEXT: Running pass: PrintModulePass
205 ; Make sure we get the IR back out without changes when we print the module.
206 ; CHECK-O-LABEL: define void @foo(i32 %n) local_unnamed_addr
207 ; CHECK-O-NEXT: entry:
208 ; CHECK-O-NEXT: br label %loop
210 ; CHECK-O-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
211 ; CHECK-O-NEXT: %iv.next = add i32 %iv, 1
212 ; CHECK-O-NEXT: tail call void @bar()
213 ; CHECK-O-NEXT: %cmp = icmp eq i32 %iv, %n
214 ; CHECK-O-NEXT: br i1 %cmp, label %exit, label %loop
216 ; CHECK-O-NEXT: ret void
219 ; Ignore a bunch of intervening metadata containing profile data.
222 declare void @bar() local_unnamed_addr
224 define void @foo(i32 %n) local_unnamed_addr {
228 %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
229 %iv.next = add i32 %iv, 1
230 tail call void @bar()
231 %cmp = icmp eq i32 %iv, %n
232 br i1 %cmp, label %exit, label %loop