1 ; Validate ThinLTO prelink pipeline when we have Sample PGO
3 ; RUN: opt -disable-verify -verify-cfg-preserved=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 -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 -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 -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 -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 -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: LowerExpectIntrinsicPass
36 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
37 ; CHECK-O-NEXT: Running analysis: TargetIRAnalysis
38 ; CHECK-O-NEXT: Running analysis: AssumptionAnalysis
39 ; CHECK-O-NEXT: Running pass: SROA
40 ; CHECK-O-NEXT: Running analysis: DominatorTreeAnalysis
41 ; CHECK-O-NEXT: Running pass: EarlyCSEPass
42 ; CHECK-O-NEXT: Running analysis: TargetLibraryAnalysis
43 ; CHECK-O-NEXT: Running pass: CoroEarlyPass
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: SROA
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-O3-NEXT: Running pass: AggressiveInstCombinePass
99 ; CHECK-O-NEXT: Running pass: InstCombinePass
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 pass: SimplifyCFGPass
118 ; CHECK-O-NEXT: Running pass: InstCombinePass
119 ; CHECK-O-NEXT: Running pass: LoopSimplifyPass
120 ; CHECK-O-NEXT: Running pass: LCSSAPass
121 ; CHECK-O-NEXT: Running pass: LoopIdiomRecognizePass
122 ; CHECK-O-NEXT: Running pass: IndVarSimplifyPass
123 ; CHECK-O-NEXT: Running pass: LoopDeletionPass
124 ; CHECK-O-NEXT: Running pass: SROA on foo
125 ; CHECK-Os-NEXT: Running pass: MergedLoadStoreMotionPass
126 ; CHECK-Os-NEXT: Running pass: GVN
127 ; CHECK-Os-NEXT: Running analysis: MemoryDependenceAnalysis
128 ; CHECK-Os-NEXT: Running analysis: PhiValuesAnalysis
129 ; CHECK-Oz-NEXT: Running pass: MergedLoadStoreMotionPass
130 ; CHECK-Oz-NEXT: Running pass: GVN
131 ; CHECK-Oz-NEXT: Running analysis: MemoryDependenceAnalysis
132 ; CHECK-Oz-NEXT: Running analysis: PhiValuesAnalysis
133 ; CHECK-O2-NEXT: Running pass: MergedLoadStoreMotionPass
134 ; CHECK-O2-NEXT: Running pass: GVN
135 ; CHECK-O2-NEXT: Running analysis: MemoryDependenceAnalysis
136 ; CHECK-O2-NEXT: Running analysis: PhiValuesAnalysis
137 ; CHECK-O3-NEXT: Running pass: MergedLoadStoreMotionPass
138 ; CHECK-O3-NEXT: Running pass: GVN
139 ; CHECK-O3-NEXT: Running analysis: MemoryDependenceAnalysis
140 ; CHECK-O3-NEXT: Running analysis: PhiValuesAnalysis
141 ; CHECK-O1-NEXT: Running pass: MemCpyOptPass
142 ; CHECK-O-NEXT: Running pass: SCCPPass
143 ; CHECK-O-NEXT: Running pass: BDCEPass
144 ; CHECK-O-NEXT: Running analysis: DemandedBitsAnalysis
145 ; CHECK-O-NEXT: Running pass: InstCombinePass
146 ; CHECK-O23SZ-NEXT: Running pass: JumpThreadingPass
147 ; CHECK-O23SZ-NEXT: Running analysis: LazyValueAnalysis
148 ; CHECK-O23SZ-NEXT: Running pass: CorrelatedValuePropagationPass
149 ; CHECK-O23SZ-NEXT: Invalidating analysis: LazyValueAnalysis
150 ; CHECK-O1-NEXT: Running pass: CoroElidePass
151 ; CHECK-O-NEXT: Running pass: ADCEPass
152 ; CHECK-O23SZ-NEXT: Running pass: MemCpyOptPass
153 ; CHECK-O23SZ-NEXT: Running pass: DSEPass
154 ; CHECK-O23SZ-NEXT: Running pass: LoopSimplifyPass
155 ; CHECK-O23SZ-NEXT: Running pass: LCSSAPass
156 ; CHECK-O23SZ-NEXT: Running pass: LICMPass
157 ; CHECK-O23SZ-NEXT: Running pass: CoroElidePass
158 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
159 ; CHECK-O-NEXT: Running pass: InstCombinePass
160 ; CHECK-O3-NEXT: Running pass: ControlHeightReductionPass on foo
161 ; CHECK-O3-NEXT: Running analysis: RegionInfoAnalysis on foo
162 ; CHECK-O3-NEXT: Running analysis: DominanceFrontierAnalysis on foo
163 ; CHECK-O-NEXT: Running pass: CoroSplitPass
164 ; CHECK-O-NEXT: Running pass: GlobalOptPass
165 ; CHECK-O-NEXT: Running pass: CoroCleanupPass
166 ; CHECK-O-NEXT: Running pass: AnnotationRemarksPass on foo
167 ; CHECK-O-NEXT: Running pass: CanonicalizeAliasesPass
168 ; CHECK-O-NEXT: Running pass: NameAnonGlobalPass
169 ; CHECK-O-NEXT: Running pass: PrintModulePass
171 ; Make sure we get the IR back out without changes when we print the module.
172 ; CHECK-O-LABEL: define void @foo(i32 %n) local_unnamed_addr
173 ; CHECK-O-NEXT: entry:
174 ; CHECK-O-NEXT: br label %loop
176 ; CHECK-O-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
177 ; CHECK-O-NEXT: %iv.next = add i32 %iv, 1
178 ; CHECK-O-NEXT: tail call void @bar()
179 ; CHECK-O-NEXT: %cmp = icmp eq i32 %iv, %n
180 ; CHECK-O-NEXT: br i1 %cmp, label %exit, label %loop
182 ; CHECK-O-NEXT: ret void
185 ; Ignore a bunch of intervening metadata containing profile data.
188 declare void @bar() local_unnamed_addr
190 define void @foo(i32 %n) local_unnamed_addr {
194 %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
195 %iv.next = add i32 %iv, 1
196 tail call void @bar()
197 %cmp = icmp eq i32 %iv, %n
198 br i1 %cmp, label %exit, label %loop