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: ProfileSummaryAnalysis
35 ; CHECK-O-NEXT: Running analysis: LazyCallGraphAnalysis
36 ; CHECK-O-NEXT: Running analysis: TargetLibraryAnalysis
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: AAManager on foo
52 ; CHECK-O-NEXT: Running analysis: BasicAA
53 ; CHECK-O-NEXT: Running analysis: ScopedNoAliasAA
54 ; CHECK-O-NEXT: Running analysis: TypeBasedAA
55 ; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy
56 ; CHECK-O-NEXT: Running analysis: BlockFrequencyAnalysis on foo
57 ; CHECK-O-NEXT: Running analysis: BranchProbabilityAnalysis on foo
58 ; CHECK-O-NEXT: Running analysis: LoopAnalysis on foo
59 ; CHECK-O-NEXT: Running analysis: PostDominatorTreeAnalysis on foo
60 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass on foo
62 ; CHECK-O-NEXT: Running pass: AlwaysInlinerPass
63 ; CHECK-O-NEXT: Running pass: ModuleInlinerWrapperPass
64 ; CHECK-O-NEXT: Running analysis: InlineAdvisorAnalysis
65 ; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}GlobalsAA
66 ; CHECK-O-NEXT: Running analysis: GlobalsAA
67 ; CHECK-O-NEXT: Running analysis: CallGraphAnalysis
68 ; CHECK-O-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}AAManager
69 ; CHECK-O-NEXT: Invalidating analysis: AAManager
70 ; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}ProfileSummaryAnalysis
71 ; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy
72 ; CHECK-O-NEXT: Running analysis: FunctionAnalysisManagerCGSCCProxy
73 ; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy
74 ; CHECK-O-NEXT: Running pass: DevirtSCCRepeatedPass
75 ; CHECK-O-NEXT: Running pass: InlinerPass
76 ; CHECK-O-NEXT: Running pass: PostOrderFunctionAttrsPass
77 ; CHECK-O3-NEXT: Running pass: ArgumentPromotionPass
78 ; CHECK-O2-NEXT: Running pass: OpenMPOptCGSCCPass
79 ; CHECK-O3-NEXT: Running pass: OpenMPOptCGSCCPass
80 ; CHECK-O-NEXT: Running pass: SROAPass
81 ; CHECK-O-NEXT: Running pass: EarlyCSEPass
82 ; CHECK-O-NEXT: Running analysis: MemorySSAAnalysis
83 ; CHECK-O-NEXT: Running analysis: AAManager
84 ; CHECK-O23SZ-NEXT: Running pass: SpeculativeExecutionPass
85 ; CHECK-O23SZ-NEXT: Running pass: JumpThreadingPass
86 ; CHECK-O23SZ-NEXT: Running analysis: LazyValueAnalysis
87 ; CHECK-O23SZ-NEXT: Running pass: CorrelatedValuePropagationPass
88 ; CHECK-O23SZ-NEXT: Invalidating analysis: LazyValueAnalysis
89 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
90 ; CHECK-O-NEXT: Running pass: InstCombinePass
91 ; CHECK-O23SZ-NEXT: Running pass: AggressiveInstCombinePass
92 ; CHECK-O1-NEXT: Running pass: LibCallsShrinkWrapPass
93 ; CHECK-O2-NEXT: Running pass: LibCallsShrinkWrapPass
94 ; CHECK-O3-NEXT: Running pass: LibCallsShrinkWrapPass
95 ; CHECK-O23SZ-NEXT: Running pass: TailCallElimPass
96 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
97 ; CHECK-O-NEXT: Running pass: ReassociatePass
98 ; CHECK-O23SZ-NEXT: Running pass: ConstraintEliminationPass
99 ; CHECK-O23SZ-NEXT: Running analysis: ScalarEvolutionAnalysis
100 ; CHECK-O-NEXT: Running pass: LoopSimplifyPass
101 ; CHECK-O-NEXT: Running pass: LCSSAPass
102 ; CHECK-O1-NEXT: Running analysis: ScalarEvolutionAnalysis
103 ; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy
104 ; CHECK-O-NEXT: Running pass: LoopInstSimplifyPass
105 ; CHECK-O-NEXT: Running pass: LoopSimplifyCFGPass
106 ; CHECK-O-NEXT: Running pass: LICM
107 ; CHECK-O-NEXT: Running pass: LoopRotatePass
108 ; CHECK-O-NEXT: Running pass: LICM
109 ; CHECK-O-NEXT: Running pass: SimpleLoopUnswitchPass
110 ; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy
111 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
112 ; CHECK-O-NEXT: Running pass: InstCombinePass
113 ; CHECK-O-NEXT: Running pass: LoopSimplifyPass
114 ; CHECK-O-NEXT: Running pass: LCSSAPass
115 ; CHECK-O-NEXT: Running pass: LoopIdiomRecognizePass
116 ; CHECK-O-NEXT: Running pass: IndVarSimplifyPass
117 ; CHECK-O-NEXT: Running pass: LoopDeletionPass
118 ; CHECK-O-NEXT: Running pass: LoopFullUnrollPass
119 ; CHECK-O-NEXT: Running pass: SROAPass on foo
120 ; CHECK-O23SZ-NEXT: Running pass: VectorCombinePass
121 ; CHECK-O23SZ-NEXT: Running pass: MergedLoadStoreMotionPass
122 ; CHECK-O23SZ-NEXT: Running pass: GVNPass
123 ; CHECK-O23SZ-NEXT: Running analysis: MemoryDependenceAnalysis
124 ; CHECK-O1-NEXT: Running pass: MemCpyOptPass
125 ; CHECK-O-NEXT: Running pass: SCCPPass
126 ; CHECK-O-NEXT: Running pass: BDCEPass
127 ; CHECK-O-NEXT: Running analysis: DemandedBitsAnalysis
128 ; CHECK-O-NEXT: Running pass: InstCombinePass
129 ; CHECK-O23SZ-NEXT: Running pass: JumpThreadingPass
130 ; CHECK-O23SZ-NEXT: Running analysis: LazyValueAnalysis
131 ; CHECK-O23SZ-NEXT: Running pass: CorrelatedValuePropagationPass
132 ; CHECK-O23SZ-NEXT: Invalidating analysis: LazyValueAnalysis
133 ; CHECK-O1-NEXT: Running pass: CoroElidePass
134 ; CHECK-O-NEXT: Running pass: ADCEPass
135 ; CHECK-O23SZ-NEXT: Running pass: MemCpyOptPass
136 ; CHECK-O23SZ-NEXT: Running pass: DSEPass
137 ; CHECK-O23SZ-NEXT: Running pass: MoveAutoInitPass
138 ; CHECK-O23SZ-NEXT: Running pass: LoopSimplifyPass
139 ; CHECK-O23SZ-NEXT: Running pass: LCSSAPass
140 ; CHECK-O23SZ-NEXT: Running pass: LICMPass
141 ; CHECK-O23SZ-NEXT: Running pass: CoroElidePass
142 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
143 ; CHECK-O-NEXT: Running pass: InstCombinePass
144 ; CHECK-O-NEXT: Running pass: PostOrderFunctionAttrsPass
145 ; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}ShouldNotRunFunctionPassesAnalysis
146 ; CHECK-O-NEXT: Running analysis: ShouldNotRunFunctionPassesAnalysis
147 ; CHECK-O-NEXT: Running pass: CoroSplitPass
148 ; CHECK-O-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}ShouldNotRunFunctionPassesAnalysis
149 ; CHECK-O-NEXT: Invalidating analysis: ShouldNotRunFunctionPassesAnalysis
150 ; CHECK-O-NEXT: Invalidating analysis: InlineAdvisorAnalysis
151 ; CHECK-O-NEXT: Running pass: DeadArgumentEliminationPass
152 ; CHECK-O-NEXT: Running pass: CoroCleanupPass
153 ; CHECK-O-NEXT: Running pass: GlobalOptPass
154 ; CHECK-O-NEXT: Running pass: GlobalDCEPass
155 ; CHECK-O-NEXT: Running pass: EliminateAvailableExternallyPass
156 ; CHECK-O-NEXT: Running pass: ReversePostOrderFunctionAttrsPass
157 ; CHECK-O-NEXT: Running pass: RecomputeGlobalsAAPass
158 ; CHECK-O-NEXT: Running pass: Float2IntPass
159 ; CHECK-O-NEXT: Running pass: LowerConstantIntrinsicsPass
160 ; CHECK-O3-NEXT: Running pass: ControlHeightReductionPass
161 ; CHECK-O3-NEXT: Running analysis: RegionInfoAnalysis
162 ; CHECK-O3-NEXT: Running analysis: DominanceFrontierAnalysis
163 ; CHECK-EXT: Running pass: {{.*}}::Bye
164 ; CHECK-O-NEXT: Running pass: LoopSimplifyPass
165 ; CHECK-O-NEXT: Running pass: LCSSAPass
166 ; CHECK-O-NEXT: Running pass: LoopRotatePass
167 ; CHECK-O-NEXT: Running pass: LoopDeletionPass
168 ; CHECK-O-NEXT: Running pass: LoopDistributePass
169 ; CHECK-O-NEXT: Running analysis: LoopAccessAnalysis
170 ; CHECK-O-NEXT: Running pass: InjectTLIMappings
171 ; CHECK-O-NEXT: Running pass: LoopVectorizePass
172 ; CHECK-O-NEXT: Running pass: InferAlignmentPass
173 ; CHECK-O-NEXT: Running pass: LoopLoadEliminationPass
174 ; CHECK-O-NEXT: Running pass: InstCombinePass
175 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
176 ; CHECK-O2-NEXT: Running pass: SLPVectorizerPass
177 ; CHECK-O3-NEXT: Running pass: SLPVectorizerPass
178 ; CHECK-Os-NEXT: Running pass: SLPVectorizerPass
179 ; CHECK-O-NEXT: Running pass: VectorCombinePass
180 ; CHECK-O-NEXT: Running pass: InstCombinePass
181 ; CHECK-O-NEXT: Running pass: LoopUnrollPass
182 ; CHECK-O-NEXT: Running pass: WarnMissedTransformationsPass
183 ; CHECK-O-NEXT: Running pass: SROAPass
184 ; CHECK-O-NEXT: Running pass: InferAlignmentPass
185 ; CHECK-O-NEXT: Running pass: InstCombinePass
186 ; CHECK-O-NEXT: Running pass: LoopSimplifyPass
187 ; CHECK-O-NEXT: Running pass: LCSSAPass
188 ; CHECK-O-NEXT: Running pass: LICMPass
189 ; CHECK-O-NEXT: Running pass: AlignmentFromAssumptionsPass
190 ; CHECK-O-NEXT: Running pass: LoopSinkPass
191 ; CHECK-O-NEXT: Running pass: InstSimplifyPass
192 ; CHECK-O-NEXT: Running pass: DivRemPairsPass
193 ; CHECK-O-NEXT: Running pass: TailCallElimPass
194 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
195 ; CHECK-O-NEXT: Running pass: GlobalDCEPass
196 ; CHECK-O-NEXT: Running pass: ConstantMergePass
197 ; CHECK-O-NEXT: Running pass: CGProfilePass
198 ; CHECK-O-NEXT: Running pass: RelLookupTableConverterPass
199 ; CHECK-O-NEXT: Running pass: AnnotationRemarksPass on foo
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