1 ; Validate ThinLTO prelink pipeline when we have Sample PGO
3 ; RUN: opt -disable-verify -verify-cfg-preserved=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-pre-link<O1>' -S %s 2>&1 \
6 ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O1
7 ; RUN: opt -disable-verify -verify-cfg-preserved=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-pre-link<O2>' -S %s 2>&1 \
10 ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O2,CHECK-O23SZ
11 ; RUN: opt -disable-verify -verify-cfg-preserved=0 -eagerly-invalidate-analyses=0 -debug-pass-manager \
12 ; RUN: -pgo-kind=pgo-sample-use-pipeline -profile-file='%S/Inputs/new-pm-thinlto-samplepgo-defaults.prof' \
13 ; RUN: -passes='thinlto-pre-link<O3>' -S -passes-ep-pipeline-start='no-op-module' %s 2>&1 \
14 ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O3,CHECK-O23SZ,CHECK-EP-PIPELINE-START
15 ; RUN: opt -disable-verify -verify-cfg-preserved=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-pre-link<Os>' -S %s 2>&1 \
18 ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-Os,CHECK-O23SZ
19 ; RUN: opt -disable-verify -verify-cfg-preserved=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-pre-link<Oz>' -S %s 2>&1 \
22 ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-Oz,CHECK-O23SZ
23 ; RUN: opt -disable-verify -verify-cfg-preserved=0 -eagerly-invalidate-analyses=0 -debug-pass-manager -new-pm-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-pre-link<O2>' -S %s 2>&1 \
26 ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O2,CHECK-O23SZ
28 ; CHECK-O: Running pass: Annotation2Metadata
29 ; CHECK-O-NEXT: Running pass: ForceFunctionAttrsPass
30 ; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy
31 ; CHECK-O-NEXT: Running pass: AddDiscriminatorsPass
32 ; CHECK-EP-PIPELINE-START-NEXT: Running pass: NoOpModulePass
33 ; CHECK-O-NEXT: Running pass: InferFunctionAttrsPass
34 ; CHECK-O-NEXT: Running analysis: TargetLibraryAnalysis
35 ; CHECK-O-NEXT: Running pass: CoroEarlyPass
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: SROAPass
41 ; CHECK-O-NEXT: Running analysis: DominatorTreeAnalysis
42 ; CHECK-O-NEXT: Running pass: EarlyCSEPass
43 ; CHECK-O-NEXT: Running analysis: TargetLibraryAnalysis
44 ; CHECK-O3-NEXT: Running pass: CallSiteSplittingPass
45 ; CHECK-O-NEXT: Running pass: InstCombinePass on foo
46 ; CHECK-O-NEXT: Running analysis: OptimizationRemarkEmitterAnalysis on foo
47 ; CHECK-O-NEXT: Running analysis: AAManager on foo
48 ; CHECK-O-NEXT: Running analysis: BasicAA
49 ; CHECK-O-NEXT: Running analysis: ScopedNoAliasAA
50 ; CHECK-O-NEXT: Running analysis: TypeBasedAA
51 ; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy
52 ; CHECK-O-NEXT: Running pass: SampleProfileLoaderPass
53 ; CHECK-O-NEXT: Running analysis: ProfileSummaryAnalysis
54 ; CHECK-O-NEXT: Running analysis: CallGraphAnalysis
55 ; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}ProfileSummaryAnalysis
56 ; CHECK-O-NEXT: Running pass: OpenMPOptPass
57 ; CHECK-O-NEXT: Running pass: IPSCCPPass
58 ; CHECK-O-NEXT: Running pass: CalledValuePropagationPass
59 ; CHECK-O-NEXT: Running pass: GlobalOptPass
60 ; CHECK-O-NEXT: Running pass: PromotePass
61 ; CHECK-O-NEXT: Running pass: DeadArgumentEliminationPass
62 ; CHECK-O-NEXT: Running pass: InstCombinePass
63 ; CHECK-O-NEXT: Running analysis: BlockFrequencyAnalysis on foo
64 ; These next two can appear in any order since they are accessed as parameters
65 ; on the same call to BlockFrequencyInfo::calculate.
66 ; CHECK-O-DAG: Running analysis: LoopAnalysis on foo
67 ; CHECK-O-DAG: Running analysis: BranchProbabilityAnalysis on foo
68 ; CHECK-O-NEXT: Running analysis: PostDominatorTreeAnalysis on foo
69 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass on foo
70 ; CHECK-O-NEXT: Running pass: ModuleInlinerWrapperPass
71 ; CHECK-O-NEXT: Running analysis: InlineAdvisorAnalysis
72 ; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}GlobalsAA
73 ; CHECK-O-NEXT: Running analysis: GlobalsAA
74 ; CHECK-O-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}AAManager
75 ; CHECK-O-NEXT: Invalidating analysis: AAManager
76 ; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}ProfileSummaryAnalysis
77 ; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy
78 ; CHECK-O-NEXT: Running analysis: LazyCallGraphAnalysis
79 ; CHECK-O-NEXT: Running analysis: FunctionAnalysisManagerCGSCCProxy
80 ; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy<{{.*}}LazyCallGraph::SCC{{.*}}>
81 ; CHECK-O-NEXT: Running pass: DevirtSCCRepeatedPass
82 ; CHECK-O-NEXT: Running pass: InlinerPass
83 ; CHECK-O-NEXT: Running pass: InlinerPass
84 ; CHECK-O-NEXT: Running pass: PostOrderFunctionAttrsPass
85 ; CHECK-O-NEXT: Running analysis: AAManager
86 ; CHECK-O3-NEXT: Running pass: ArgumentPromotionPass
87 ; CHECK-O2-NEXT: Running pass: OpenMPOptCGSCCPass
88 ; CHECK-O3-NEXT: Running pass: OpenMPOptCGSCCPass
89 ; CHECK-O-NEXT: Running pass: SROAPass
90 ; CHECK-O-NEXT: Running pass: EarlyCSEPass
91 ; CHECK-O-NEXT: Running analysis: MemorySSAAnalysis
92 ; CHECK-O23SZ-NEXT: Running pass: SpeculativeExecutionPass
93 ; CHECK-O23SZ-NEXT: Running pass: JumpThreadingPass
94 ; CHECK-O23SZ-NEXT: Running analysis: LazyValueAnalysis
95 ; CHECK-O23SZ-NEXT: Running pass: CorrelatedValuePropagationPass
96 ; CHECK-O23SZ-NEXT: Invalidating analysis: LazyValueAnalysis
97 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
98 ; CHECK-O-NEXT: Running pass: InstCombinePass
99 ; CHECK-O3-NEXT: Running pass: AggressiveInstCombinePass
100 ; CHECK-O1-NEXT: Running pass: LibCallsShrinkWrapPass
101 ; CHECK-O2-NEXT: Running pass: LibCallsShrinkWrapPass
102 ; CHECK-O3-NEXT: Running pass: LibCallsShrinkWrapPass
103 ; CHECK-O23SZ-NEXT: Running pass: TailCallElimPass
104 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
105 ; CHECK-O-NEXT: Running pass: ReassociatePass
106 ; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}OptimizationRemarkEmitterAnalysis
107 ; CHECK-O-NEXT: Running pass: LoopSimplifyPass
108 ; CHECK-O-NEXT: Running pass: LCSSAPass
109 ; CHECK-O-NEXT: Running analysis: ScalarEvolutionAnalysis
110 ; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy
111 ; CHECK-O-NEXT: Running pass: LoopInstSimplifyPass
112 ; CHECK-O-NEXT: Running pass: LoopSimplifyCFGPass
113 ; CHECK-O-NEXT: Running pass: LICM
114 ; CHECK-O-NEXT: Running pass: LoopRotatePass
115 ; CHECK-O-NEXT: Running pass: LICM
116 ; CHECK-O-NEXT: Running pass: SimpleLoopUnswitchPass
117 ; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy
118 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
119 ; CHECK-O-NEXT: Running pass: InstCombinePass
120 ; CHECK-O-NEXT: Running pass: LoopSimplifyPass
121 ; CHECK-O-NEXT: Running pass: LCSSAPass
122 ; CHECK-O-NEXT: Running pass: LoopIdiomRecognizePass
123 ; CHECK-O-NEXT: Running pass: IndVarSimplifyPass
124 ; CHECK-O-NEXT: Running pass: LoopDeletionPass
125 ; CHECK-O-NEXT: Running pass: SROAPass on foo
126 ; CHECK-Os-NEXT: Running pass: MergedLoadStoreMotionPass
127 ; CHECK-Os-NEXT: Running pass: GVNPass
128 ; CHECK-Os-NEXT: Running analysis: MemoryDependenceAnalysis
129 ; CHECK-Os-NEXT: Running analysis: PhiValuesAnalysis
130 ; CHECK-Oz-NEXT: Running pass: MergedLoadStoreMotionPass
131 ; CHECK-Oz-NEXT: Running pass: GVNPass
132 ; CHECK-Oz-NEXT: Running analysis: MemoryDependenceAnalysis
133 ; CHECK-Oz-NEXT: Running analysis: PhiValuesAnalysis
134 ; CHECK-O2-NEXT: Running pass: MergedLoadStoreMotionPass
135 ; CHECK-O2-NEXT: Running pass: GVNPass
136 ; CHECK-O2-NEXT: Running analysis: MemoryDependenceAnalysis
137 ; CHECK-O2-NEXT: Running analysis: PhiValuesAnalysis
138 ; CHECK-O3-NEXT: Running pass: MergedLoadStoreMotionPass
139 ; CHECK-O3-NEXT: Running pass: GVNPass
140 ; CHECK-O3-NEXT: Running analysis: MemoryDependenceAnalysis
141 ; CHECK-O3-NEXT: Running analysis: PhiValuesAnalysis
142 ; CHECK-O1-NEXT: Running pass: MemCpyOptPass
143 ; CHECK-O-NEXT: Running pass: SCCPPass
144 ; CHECK-O-NEXT: Running pass: BDCEPass
145 ; CHECK-O-NEXT: Running analysis: DemandedBitsAnalysis
146 ; CHECK-O-NEXT: Running pass: InstCombinePass
147 ; CHECK-O23SZ-NEXT: Running pass: JumpThreadingPass
148 ; CHECK-O23SZ-NEXT: Running analysis: LazyValueAnalysis
149 ; CHECK-O23SZ-NEXT: Running pass: CorrelatedValuePropagationPass
150 ; CHECK-O23SZ-NEXT: Invalidating analysis: LazyValueAnalysis
151 ; CHECK-O1-NEXT: Running pass: CoroElidePass
152 ; CHECK-O-NEXT: Running pass: ADCEPass
153 ; CHECK-O23SZ-NEXT: Running pass: MemCpyOptPass
154 ; CHECK-O23SZ-NEXT: Running pass: DSEPass
155 ; CHECK-O23SZ-NEXT: Running pass: LoopSimplifyPass
156 ; CHECK-O23SZ-NEXT: Running pass: LCSSAPass
157 ; CHECK-O23SZ-NEXT: Running pass: LICMPass
158 ; CHECK-O23SZ-NEXT: Running pass: CoroElidePass
159 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
160 ; CHECK-O-NEXT: Running pass: InstCombinePass
161 ; CHECK-O3-NEXT: Running pass: ControlHeightReductionPass on foo
162 ; CHECK-O3-NEXT: Running analysis: RegionInfoAnalysis on foo
163 ; CHECK-O3-NEXT: Running analysis: DominanceFrontierAnalysis on foo
164 ; CHECK-O-NEXT: Running analysis: ShouldNotRunFunctionPassesAnalysis
165 ; CHECK-O-NEXT: Running pass: CoroSplitPass
166 ; CHECK-O-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}ShouldNotRunFunctionPassesAnalysis
167 ; CHECK-O-NEXT: Invalidating analysis: ShouldNotRunFunctionPassesAnalysis
168 ; CHECK-O-NEXT: Invalidating analysis: InlineAdvisorAnalysis
169 ; CHECK-O-NEXT: Running pass: CoroCleanupPass
170 ; CHECK-O-NEXT: Running pass: GlobalOptPass
171 ; CHECK-O-NEXT: Running pass: AnnotationRemarksPass on foo
172 ; CHECK-O-NEXT: Running pass: CanonicalizeAliasesPass
173 ; CHECK-O-NEXT: Running pass: NameAnonGlobalPass
174 ; CHECK-O-NEXT: Running pass: PrintModulePass
176 ; Make sure we get the IR back out without changes when we print the module.
177 ; CHECK-O-LABEL: define void @foo(i32 %n) local_unnamed_addr
178 ; CHECK-O-NEXT: entry:
179 ; CHECK-O-NEXT: br label %loop
181 ; CHECK-O-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
182 ; CHECK-O-NEXT: %iv.next = add i32 %iv, 1
183 ; CHECK-O-NEXT: tail call void @bar()
184 ; CHECK-O-NEXT: %cmp = icmp eq i32 %iv, %n
185 ; CHECK-O-NEXT: br i1 %cmp, label %exit, label %loop
187 ; CHECK-O-NEXT: ret void
190 ; Ignore a bunch of intervening metadata containing profile data.
193 declare void @bar() local_unnamed_addr
195 define void @foo(i32 %n) local_unnamed_addr {
199 %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
200 %iv.next = add i32 %iv, 1
201 tail call void @bar()
202 %cmp = icmp eq i32 %iv, %n
203 br i1 %cmp, label %exit, label %loop