1; Validate ThinLTO prelink pipeline when we have Sample PGO 2; 3; RUN: opt -disable-verify -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 -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 -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 -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 -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 -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 27; 28; CHECK-O: Starting {{.*}}Module pass manager run. 29; CHECK-O-NEXT: Running pass: Annotation2Metadata 30; CHECK-O-NEXT: Running pass: ForceFunctionAttrsPass 31; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy 32; CHECK-O-NEXT: Running pass: AddDiscriminatorsPass 33; CHECK-EP-PIPELINE-START-NEXT: Running pass: NoOpModulePass 34; CHECK-O-NEXT: Running pass: InferFunctionAttrsPass 35; CHECK-O-NEXT: Running analysis: TargetLibraryAnalysis 36; CHECK-O-NEXT: Starting {{.*}}Function pass manager run. 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: SROA 41; CHECK-O-NEXT: Running analysis: DominatorTreeAnalysis 42; CHECK-O-NEXT: Running pass: EarlyCSEPass 43; CHECK-O-NEXT: Running analysis: TargetLibraryAnalysis 44; CHECK-O-NEXT: Running pass: LowerExpectIntrinsicPass 45; CHECK-O3-NEXT: Running pass: CallSiteSplittingPass 46; CHECK-O-NEXT: Running pass: InstCombinePass on foo 47; CHECK-O-NEXT: Running analysis: OptimizationRemarkEmitterAnalysis on foo 48; CHECK-O-NEXT: Running analysis: AAManager on foo 49; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy 50; CHECK-O-NEXT: Finished {{.*}}Function pass manager run. 51; CHECK-O-NEXT: Running pass: SampleProfileLoaderPass 52; CHECK-O-NEXT: Running analysis: ProfileSummaryAnalysis 53; CHECK-O-NEXT: Running analysis: CallGraphAnalysis 54; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}ProfileSummaryAnalysis 55; CHECK-O-NEXT: Running pass: IPSCCPPass 56; CHECK-O-NEXT: Running pass: CalledValuePropagationPass 57; CHECK-O-NEXT: Running pass: GlobalOptPass 58; CHECK-O-NEXT: Running pass: PromotePass 59; CHECK-O-NEXT: Running pass: DeadArgumentEliminationPass 60; CHECK-O-NEXT: Starting {{.*}}Function pass manager run. 61; CHECK-O-NEXT: Running pass: InstCombinePass 62; CHECK-O-NEXT: Running analysis: BlockFrequencyAnalysis on foo 63; These next two can appear in any order since they are accessed as parameters 64; on the same call to BlockFrequencyInfo::calculate. 65; CHECK-O-DAG: Running analysis: LoopAnalysis on foo 66; CHECK-O-DAG: Running analysis: BranchProbabilityAnalysis on foo 67; CHECK-O-NEXT: Running analysis: PostDominatorTreeAnalysis on foo 68; CHECK-O-NEXT: Running pass: SimplifyCFGPass on foo 69; CHECK-O-NEXT: Finished {{.*}}Function pass manager run 70; CHECK-O-NEXT: Running pass: ModuleInlinerWrapperPass 71; CHECK-O-NEXT: Running analysis: InlineAdvisorAnalysis 72; CHECK-O-NEXT: Starting {{.*}}Module pass manager run. 73; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy 74; CHECK-O-NEXT: Running analysis: LazyCallGraphAnalysis 75; CHECK-O-NEXT: Running analysis: FunctionAnalysisManagerCGSCCProxy 76; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy<{{.*}}LazyCallGraph::SCC{{.*}}> 77; CHECK-O-NEXT: Running pass: DevirtSCCRepeatedPass 78; CHECK-O-NEXT: Starting CGSCC pass manager run. 79; CHECK-O-NEXT: Running pass: InlinerPass 80; CHECK-O-NEXT: Finished CGSCC pass manager run. 81; CHECK-O-NEXT: Finished llvm::Module pass manager run. 82; CHECK-O-NEXT: Running pass: ModuleInlinerWrapperPass 83; CHECK-O-NEXT: Starting llvm::Module pass manager run. 84; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}GlobalsAA 85; CHECK-O-NEXT: Running analysis: GlobalsAA 86; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}ProfileSummaryAnalysis 87; CHECK-O-NEXT: Running pass: DevirtSCCRepeatedPass 88; CHECK-O-NEXT: Starting CGSCC pass manager run. 89; CHECK-O-NEXT: Running pass: InlinerPass 90; CHECK-O-NEXT: Running pass: PostOrderFunctionAttrsPass 91; CHECK-O3-NEXT: Running pass: ArgumentPromotionPass 92; CHECK-O2-NEXT: Running pass: OpenMPOptPass 93; CHECK-O3-NEXT: Running pass: OpenMPOptPass 94; CHECK-O-NEXT: Starting {{.*}}Function pass manager run. 95; CHECK-O-NEXT: Running pass: SROA 96; CHECK-O-NEXT: Running pass: EarlyCSEPass 97; CHECK-O-NEXT: Running analysis: MemorySSAAnalysis 98; CHECK-O23SZ-NEXT: Running pass: SpeculativeExecutionPass 99; CHECK-O23SZ-NEXT: Running pass: JumpThreadingPass 100; CHECK-O23SZ-NEXT: Running analysis: LazyValueAnalysis 101; CHECK-O23SZ-NEXT: Running pass: CorrelatedValuePropagationPass 102; CHECK-O23SZ-NEXT: Invalidating analysis: LazyValueAnalysis 103; CHECK-O-NEXT: Running pass: SimplifyCFGPass 104; CHECK-O3-NEXT: Running pass: AggressiveInstCombinePass 105; CHECK-O-NEXT: Running pass: InstCombinePass 106; CHECK-O1-NEXT: Running pass: LibCallsShrinkWrapPass 107; CHECK-O2-NEXT: Running pass: LibCallsShrinkWrapPass 108; CHECK-O3-NEXT: Running pass: LibCallsShrinkWrapPass 109; CHECK-O23SZ-NEXT: Running pass: TailCallElimPass 110; CHECK-O-NEXT: Running pass: SimplifyCFGPass 111; CHECK-O-NEXT: Running pass: ReassociatePass 112; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}OptimizationRemarkEmitterAnalysis 113; CHECK-O-NEXT: Starting {{.*}}Function pass manager run 114; CHECK-O-NEXT: Running pass: LoopSimplifyPass 115; CHECK-O-NEXT: Running pass: LCSSAPass 116; CHECK-O-NEXT: Finished {{.*}}Function pass manager run 117; CHECK-O-NEXT: Running analysis: ScalarEvolutionAnalysis 118; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy 119; CHECK-O-NEXT: Starting Loop pass manager run. 120; CHECK-O-NEXT: Running pass: LoopInstSimplifyPass 121; CHECK-O-NEXT: Running pass: LoopSimplifyCFGPass 122; CHECK-O-NEXT: Running pass: LoopRotatePass 123; CHECK-O-NEXT: Running pass: LICM 124; CHECK-O-NEXT: Running pass: SimpleLoopUnswitchPass 125; CHECK-O-NEXT: Finished Loop pass manager run. 126; CHECK-O-NEXT: Running pass: SimplifyCFGPass 127; CHECK-O-NEXT: Running pass: InstCombinePass 128; CHECK-O-NEXT: Starting {{.*}}Function pass manager run 129; CHECK-O-NEXT: Running pass: LoopSimplifyPass 130; CHECK-O-NEXT: Running pass: LCSSAPass 131; CHECK-O-NEXT: Finished {{.*}}Function pass manager run 132; CHECK-O-NEXT: Starting Loop pass manager run. 133; CHECK-O-NEXT: Running pass: LoopIdiomRecognizePass 134; CHECK-O-NEXT: Running pass: IndVarSimplifyPass 135; CHECK-O-NEXT: Running pass: LoopDeletionPass 136; CHECK-O-NEXT: Finished Loop pass manager run. 137; CHECK-O-NEXT: Running pass: SROA on foo 138; CHECK-Os-NEXT: Running pass: MergedLoadStoreMotionPass 139; CHECK-Os-NEXT: Running pass: GVN 140; CHECK-Os-NEXT: Running analysis: MemoryDependenceAnalysis 141; CHECK-Os-NEXT: Running analysis: PhiValuesAnalysis 142; CHECK-Oz-NEXT: Running pass: MergedLoadStoreMotionPass 143; CHECK-Oz-NEXT: Running pass: GVN 144; CHECK-Oz-NEXT: Running analysis: MemoryDependenceAnalysis 145; CHECK-Oz-NEXT: Running analysis: PhiValuesAnalysis 146; CHECK-O2-NEXT: Running pass: MergedLoadStoreMotionPass 147; CHECK-O2-NEXT: Running pass: GVN 148; CHECK-O2-NEXT: Running analysis: MemoryDependenceAnalysis 149; CHECK-O2-NEXT: Running analysis: PhiValuesAnalysis 150; CHECK-O3-NEXT: Running pass: MergedLoadStoreMotionPass 151; CHECK-O3-NEXT: Running pass: GVN 152; CHECK-O3-NEXT: Running analysis: MemoryDependenceAnalysis 153; CHECK-O3-NEXT: Running analysis: PhiValuesAnalysis 154; CHECK-O-NEXT: Running pass: MemCpyOptPass 155; CHECK-O1-NEXT: Running analysis: MemoryDependenceAnalysis 156; CHECK-O1-NEXT: Running analysis: PhiValuesAnalysis 157; CHECK-O-NEXT: Running pass: SCCPPass 158; CHECK-O-NEXT: Running pass: BDCEPass 159; CHECK-O-NEXT: Running analysis: DemandedBitsAnalysis 160; CHECK-O-NEXT: Running pass: InstCombinePass 161; CHECK-O23SZ-NEXT: Running pass: JumpThreadingPass 162; CHECK-O23SZ-NEXT: Running analysis: LazyValueAnalysis 163; CHECK-O23SZ-NEXT: Running pass: CorrelatedValuePropagationPass 164; CHECK-O23SZ-NEXT: Invalidating analysis: LazyValueAnalysis 165; CHECK-O-NEXT: Running pass: ADCEPass 166; CHECK-O23SZ-NEXT: Running pass: DSEPass 167; CHECK-O23SZ-NEXT: Starting {{.*}}Function pass manager run 168; CHECK-O23SZ-NEXT: Running pass: LoopSimplifyPass 169; CHECK-O23SZ-NEXT: Running pass: LCSSAPass 170; CHECK-O23SZ-NEXT: Finished {{.*}}Function pass manager run 171; CHECK-O23SZ-NEXT: Running pass: LICMPass 172; CHECK-O-NEXT: Running pass: SimplifyCFGPass 173; CHECK-O-NEXT: Running pass: InstCombinePass 174; CHECK-O3-NEXT: Running pass: ControlHeightReductionPass on foo 175; CHECK-O3-NEXT: Running analysis: RegionInfoAnalysis on foo 176; CHECK-O3-NEXT: Running analysis: DominanceFrontierAnalysis on foo 177; CHECK-O-NEXT: Finished {{.*}}Function pass manager run. 178; CHECK-O-NEXT: Finished CGSCC pass manager run. 179; CHECK-O-NEXT: Finished {{.*}}Module pass manager run. 180; CHECK-O-NEXT: Running pass: GlobalOptPass 181; CHECK-O-NEXT: Running pass: AnnotationRemarksPass on foo 182; CHECK-O-NEXT: Running pass: CanonicalizeAliasesPass 183; CHECK-O-NEXT: Running pass: NameAnonGlobalPass 184; CHECK-O-NEXT: Running pass: PrintModulePass 185 186; Make sure we get the IR back out without changes when we print the module. 187; CHECK-O-LABEL: define void @foo(i32 %n) local_unnamed_addr 188; CHECK-O-NEXT: entry: 189; CHECK-O-NEXT: br label %loop 190; CHECK-O: loop: 191; CHECK-O-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ] 192; CHECK-O-NEXT: %iv.next = add i32 %iv, 1 193; CHECK-O-NEXT: tail call void @bar() 194; CHECK-O-NEXT: %cmp = icmp eq i32 %iv, %n 195; CHECK-O-NEXT: br i1 %cmp, label %exit, label %loop 196; CHECK-O: exit: 197; CHECK-O-NEXT: ret void 198; CHECK-O-NEXT: } 199; 200; Ignore a bunch of intervening metadata containing profile data. 201; 202; CHECK-O: Finished {{.*}}Module pass manager run. 203 204declare void @bar() local_unnamed_addr 205 206define void @foo(i32 %n) local_unnamed_addr { 207entry: 208 br label %loop 209loop: 210 %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ] 211 %iv.next = add i32 %iv, 1 212 tail call void @bar() 213 %cmp = icmp eq i32 %iv, %n 214 br i1 %cmp, label %exit, label %loop 215exit: 216 ret void 217} 218