1 ; Validate ThinLTO prelink 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-pre-link<O1>' -S %s 2>&1 \
6 ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O1
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-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-analysis-invalidation=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-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-pre-link<Os>' -S %s 2>&1 \
18 ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O23SZ
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-pre-link<Oz>' -S %s 2>&1 \
22 ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O23SZ
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-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: SampleProfileLoaderPass
46 ; CHECK-O-NEXT: Running analysis: ProfileSummaryAnalysis
47 ; CHECK-O-NEXT: Running analysis: LazyCallGraphAnalysis
48 ; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}ProfileSummaryAnalysis
49 ; CHECK-O-NEXT: Running pass: OpenMPOptPass
50 ; CHECK-O-NEXT: Running pass: IPSCCPPass
51 ; CHECK-O-NEXT: Running pass: CalledValuePropagationPass
52 ; CHECK-O-NEXT: Running pass: GlobalOptPass
53 ; CHECK-O-NEXT: Running pass: PromotePass
54 ; CHECK-O-NEXT: Running pass: InstCombinePass
55 ; CHECK-O-NEXT: Running analysis: OptimizationRemarkEmitterAnalysis on foo
56 ; CHECK-O-NEXT: Running analysis: AAManager on foo
57 ; CHECK-O-NEXT: Running analysis: BasicAA
58 ; CHECK-O-NEXT: Running analysis: ScopedNoAliasAA
59 ; CHECK-O-NEXT: Running analysis: TypeBasedAA
60 ; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy
61 ; CHECK-O-NEXT: Running analysis: BlockFrequencyAnalysis on foo
62 ; CHECK-O-NEXT: Running analysis: BranchProbabilityAnalysis on foo
63 ; CHECK-O-NEXT: Running analysis: LoopAnalysis on foo
64 ; CHECK-O-NEXT: Running analysis: PostDominatorTreeAnalysis on foo
65 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass on foo
66 ; CHECK-O-NEXT: Running pass: AlwaysInlinerPass
67 ; CHECK-O-NEXT: Running pass: ModuleInlinerWrapperPass
68 ; CHECK-O-NEXT: Running analysis: InlineAdvisorAnalysis
69 ; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}GlobalsAA
70 ; CHECK-O-NEXT: Running analysis: GlobalsAA
71 ; CHECK-O-NEXT: Running analysis: CallGraphAnalysis
72 ; CHECK-O-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}AAManager
73 ; CHECK-O-NEXT: Invalidating analysis: AAManager
74 ; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}ProfileSummaryAnalysis
75 ; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy
76 ; CHECK-O-NEXT: Running analysis: FunctionAnalysisManagerCGSCCProxy
77 ; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy<{{.*}}LazyCallGraph::SCC{{.*}}>
78 ; CHECK-O-NEXT: Running pass: DevirtSCCRepeatedPass
79 ; CHECK-O-NEXT: Running pass: InlinerPass
80 ; CHECK-O-NEXT: Running pass: PostOrderFunctionAttrsPass
81 ; CHECK-O3-NEXT: Running pass: ArgumentPromotionPass
82 ; CHECK-O2-NEXT: Running pass: OpenMPOptCGSCCPass
83 ; CHECK-O3-NEXT: Running pass: OpenMPOptCGSCCPass
84 ; CHECK-O-NEXT: Running pass: SROAPass
85 ; CHECK-O-NEXT: Running pass: EarlyCSEPass
86 ; CHECK-O-NEXT: Running analysis: MemorySSAAnalysis
87 ; CHECK-O-NEXT: Running analysis: AAManager
88 ; CHECK-O23SZ-NEXT: Running pass: SpeculativeExecutionPass
89 ; CHECK-O23SZ-NEXT: Running pass: JumpThreadingPass
90 ; CHECK-O23SZ-NEXT: Running analysis: LazyValueAnalysis
91 ; CHECK-O23SZ-NEXT: Running pass: CorrelatedValuePropagationPass
92 ; CHECK-O23SZ-NEXT: Invalidating analysis: LazyValueAnalysis
93 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
94 ; CHECK-O-NEXT: Running pass: InstCombinePass
95 ; CHECK-O23SZ-NEXT: Running pass: AggressiveInstCombinePass
96 ; CHECK-O1-NEXT: Running pass: LibCallsShrinkWrapPass
97 ; CHECK-O2-NEXT: Running pass: LibCallsShrinkWrapPass
98 ; CHECK-O3-NEXT: Running pass: LibCallsShrinkWrapPass
99 ; CHECK-O23SZ-NEXT: Running pass: TailCallElimPass
100 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
101 ; CHECK-O-NEXT: Running pass: ReassociatePass
102 ; CHECK-O23SZ-NEXT: Running pass: ConstraintEliminationPass
103 ; CHECK-O23SZ-NEXT: Running analysis: ScalarEvolutionAnalysis
104 ; CHECK-O-NEXT: Running pass: LoopSimplifyPass
105 ; CHECK-O-NEXT: Running pass: LCSSAPass
106 ; CHECK-O1-NEXT: Running analysis: ScalarEvolutionAnalysis
107 ; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy
108 ; CHECK-O-NEXT: Running pass: LoopInstSimplifyPass
109 ; CHECK-O-NEXT: Running pass: LoopSimplifyCFGPass
110 ; CHECK-O-NEXT: Running pass: LICM
111 ; CHECK-O-NEXT: Running pass: LoopRotatePass
112 ; CHECK-O-NEXT: Running pass: LICM
113 ; CHECK-O-NEXT: Running pass: SimpleLoopUnswitchPass
114 ; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy
115 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
116 ; CHECK-O-NEXT: Running pass: InstCombinePass
117 ; CHECK-O-NEXT: Running pass: LoopSimplifyPass
118 ; CHECK-O-NEXT: Running pass: LCSSAPass
119 ; CHECK-O-NEXT: Running pass: LoopIdiomRecognizePass
120 ; CHECK-O-NEXT: Running pass: IndVarSimplifyPass
121 ; CHECK-O-NEXT: Running pass: LoopDeletionPass
122 ; CHECK-O-NEXT: Running pass: SROAPass on foo
123 ; CHECK-O23SZ-NEXT: Running pass: VectorCombinePass
124 ; CHECK-O23SZ-NEXT: Running pass: MergedLoadStoreMotionPass
125 ; CHECK-O23SZ-NEXT: Running pass: GVNPass
126 ; CHECK-O23SZ-NEXT: Running analysis: MemoryDependenceAnalysis
127 ; CHECK-O1-NEXT: Running pass: MemCpyOptPass
128 ; CHECK-O-NEXT: Running pass: SCCPPass
129 ; CHECK-O-NEXT: Running pass: BDCEPass
130 ; CHECK-O-NEXT: Running analysis: DemandedBitsAnalysis
131 ; CHECK-O-NEXT: Running pass: InstCombinePass
132 ; CHECK-O23SZ-NEXT: Running pass: JumpThreadingPass
133 ; CHECK-O23SZ-NEXT: Running analysis: LazyValueAnalysis
134 ; CHECK-O23SZ-NEXT: Running pass: CorrelatedValuePropagationPass
135 ; CHECK-O23SZ-NEXT: Invalidating analysis: LazyValueAnalysis
136 ; CHECK-O1-NEXT: Running pass: CoroElidePass
137 ; CHECK-O-NEXT: Running pass: ADCEPass
138 ; CHECK-O23SZ-NEXT: Running pass: MemCpyOptPass
139 ; CHECK-O23SZ-NEXT: Running pass: DSEPass
140 ; CHECK-O23SZ-NEXT: Running pass: MoveAutoInitPass on foo
141 ; CHECK-O23SZ-NEXT: Running pass: LoopSimplifyPass
142 ; CHECK-O23SZ-NEXT: Running pass: LCSSAPass
143 ; CHECK-O23SZ-NEXT: Running pass: LICMPass
144 ; CHECK-O23SZ-NEXT: Running pass: CoroElidePass
145 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
146 ; CHECK-O-NEXT: Running pass: InstCombinePass
147 ; CHECK-O-NEXT: Running pass: PostOrderFunctionAttrsPass
148 ; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}ShouldNotRunFunctionPassesAnalysis
149 ; CHECK-O-NEXT: Running analysis: ShouldNotRunFunctionPassesAnalysis
150 ; CHECK-O-NEXT: Running pass: CoroSplitPass
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: AnnotationRemarksPass on foo
159 ; CHECK-O-NEXT: Running pass: CanonicalizeAliasesPass
160 ; CHECK-O-NEXT: Running pass: NameAnonGlobalPass
161 ; CHECK-O-NEXT: Running pass: PrintModulePass
163 ; Make sure we get the IR back out without changes when we print the module.
164 ; CHECK-O-LABEL: define void @foo(i32 %n) local_unnamed_addr
165 ; CHECK-O-NEXT: entry:
166 ; CHECK-O-NEXT: br label %loop
168 ; CHECK-O-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
169 ; CHECK-O-NEXT: %iv.next = add i32 %iv, 1
170 ; CHECK-O-NEXT: tail call void @bar()
171 ; CHECK-O-NEXT: %cmp = icmp eq i32 %iv, %n
172 ; CHECK-O-NEXT: br i1 %cmp, label %exit, label %loop
174 ; CHECK-O-NEXT: ret void
177 ; Ignore a bunch of intervening metadata containing profile data.
180 declare void @bar() local_unnamed_addr
182 define void @foo(i32 %n) local_unnamed_addr {
186 %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
187 %iv.next = add i32 %iv, 1
188 tail call void @bar()
189 %cmp = icmp eq i32 %iv, %n
190 br i1 %cmp, label %exit, label %loop