1 ; Basic test for the new LTO pipeline.
2 ; For now the only difference is between -O1 and everything else, so
3 ; -O2, -O3, -Os, -Oz are the same.
5 ; RUN: opt -disable-verify -debug-pass-manager \
6 ; RUN: -passes='lto<O1>' -S %s 2>&1 \
7 ; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O1
8 ; RUN: opt -disable-verify -debug-pass-manager \
9 ; RUN: -passes='lto<O2>' -S %s 2>&1 \
10 ; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O2
11 ; RUN: opt -disable-verify -debug-pass-manager \
12 ; RUN: -passes='lto<O3>' -S %s 2>&1 \
13 ; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O2 \
14 ; RUN: --check-prefix=CHECK-O3
15 ; RUN: opt -disable-verify -debug-pass-manager \
16 ; RUN: -passes='lto<Os>' -S %s 2>&1 \
17 ; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O2
18 ; RUN: opt -disable-verify -debug-pass-manager \
19 ; RUN: -passes='lto<Oz>' -S %s 2>&1 \
20 ; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O2
21 ; RUN: opt -disable-verify -debug-pass-manager \
22 ; RUN: -passes='lto<O3>' -S %s -passes-ep-peephole='no-op-function' 2>&1 \
23 ; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O2 \
24 ; RUN: --check-prefix=CHECK-O3 --check-prefix=CHECK-EP-Peephole
26 ; CHECK-O: Running analysis: PassInstrumentationAnalysis
27 ; CHECK-O-NEXT: Starting llvm::Module pass manager run.
28 ; CHECK-O-NEXT: Running pass: PassManager<{{.*}}Module
29 ; CHECK-O-NEXT: Starting llvm::Module pass manager run.
30 ; CHECK-O-NEXT: Running pass: GlobalDCEPass
31 ; CHECK-O-NEXT: Running pass: ForceFunctionAttrsPass
32 ; CHECK-O-NEXT: Running pass: InferFunctionAttrsPass
33 ; CHECK-O-NEXT: Running analysis: TargetLibraryAnalysis
34 ; CHECK-O2-NEXT: Running pass: ModuleToFunctionPassAdaptor<{{.*}}PassManager{{.*}}>
35 ; CHECK-O2-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Module
36 ; CHECK-O2-NEXT: Running analysis: PassInstrumentationAnalysis
37 ; CHECK-O2-NEXT: Starting llvm::Function pass manager run.
38 ; CHECK-O2-NEXT: Running pass: CallSiteSplittingPass on foo
39 ; CHECK-O2-NEXT: Running analysis: TargetLibraryAnalysis on foo
40 ; CHECK-O2-NEXT: Running analysis: TargetIRAnalysis on foo
41 ; CHECK-O2-NEXT: Finished llvm::Function pass manager run.
42 ; CHECK-O2-NEXT: PGOIndirectCallPromotion
43 ; CHECK-O2-NEXT: Running analysis: ProfileSummaryAnalysis
44 ; CHECK-O2-NEXT: Running analysis: OptimizationRemarkEmitterAnalysis
45 ; CHECK-O2-NEXT: Running pass: IPSCCPPass
46 ; CHECK-O2-DAG: Running analysis: AssumptionAnalysis on foo
47 ; CHECK-O2-DAG: Running analysis: DominatorTreeAnalysis on foo
48 ; CHECK-O2-NEXT: Running pass: CalledValuePropagationPass
49 ; CHECK-O-NEXT: Running pass: ModuleToPostOrderCGSCCPassAdaptor<{{.*}}PostOrderFunctionAttrsPass>
50 ; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}SCC
51 ; CHECK-O1-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Function
52 ; CHECK-O-NEXT: Running analysis: LazyCallGraphAnalysis
53 ; CHECK-O-NEXT: Running analysis: FunctionAnalysisManagerCGSCCProxy
54 ; CHECK-O-NEXT: Running analysis: PassInstrumentationAnalysis
55 ; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy<{{.*}}LazyCallGraph{{.*}}>
56 ; CHECK-O-NEXT: Running analysis: AAManager
57 ; CHECK-O1-NEXT: Running analysis: PassInstrumentationAnalysis
58 ; CHECK-O1-NEXT: Running analysis: TargetLibraryAnalysis
59 ; CHECK-O-NEXT: Running pass: ReversePostOrderFunctionAttrsPass
60 ; CHECK-O-NEXT: Running analysis: CallGraphAnalysis
61 ; CHECK-O-NEXT: Running pass: GlobalSplitPass
62 ; CHECK-O-NEXT: Running pass: WholeProgramDevirtPass
63 ; CHECK-O1-NEXT: Running pass: LowerTypeTestsPass
64 ; CHECK-O2-NEXT: Running pass: GlobalOptPass
65 ; CHECK-O2-NEXT: Running pass: ModuleToFunctionPassAdaptor<{{.*}}PromotePass>
66 ; CHECK-O2-NEXT: Running pass: ConstantMergePass
67 ; CHECK-O2-NEXT: Running pass: DeadArgumentEliminationPass
68 ; CHECK-O2-NEXT: Running pass: ModuleToFunctionPassAdaptor<{{.*}}PassManager{{.*}}>
69 ; CHECK-O2-NEXT: Starting llvm::Function pass manager run.
70 ; CHECK-O3-NEXT: Running pass: AggressiveInstCombinePass
71 ; CHECK-O2-NEXT: Running pass: InstCombinePass
72 ; CHECK-EP-Peephole-NEXT: Running pass: NoOpFunctionPass
73 ; CHECK-O2-NEXT: Finished llvm::Function pass manager run.
74 ; CHECK-O2-NEXT: Running pass: ModuleToPostOrderCGSCCPassAdaptor<{{.*}}InlinerPass>
75 ; CHECK-O2-NEXT: Running pass: GlobalOptPass
76 ; CHECK-O2-NEXT: Running pass: GlobalDCEPass
77 ; CHECK-O2-NEXT: Running pass: ModuleToFunctionPassAdaptor<{{.*}}PassManager{{.*}}>
78 ; CHECK-O2-NEXT: Starting llvm::Function pass manager run.
79 ; CHECK-O2-NEXT: Running pass: InstCombinePass
80 ; CHECK-EP-Peephole-NEXT: Running pass: NoOpFunctionPass
81 ; CHECK-O2-NEXT: Running pass: JumpThreadingPass
82 ; CHECK-O2-NEXT: Running analysis: LazyValueAnalysis
83 ; CHECK-O2-NEXT: Running pass: SROA on foo
84 ; CHECK-O2-NEXT: Finished llvm::Function pass manager run.
85 ; CHECK-O2-NEXT: Running pass: ModuleToPostOrderCGSCCPassAdaptor<{{.*}}PostOrderFunctionAttrsPass>
86 ; CHECK-O2-NEXT: Running pass: ModuleToFunctionPassAdaptor<{{.*}}PassManager{{.*}}>
87 ; CHECK-O2-NEXT: Running analysis: MemoryDependenceAnalysis
88 ; CHECK-O2-NEXT: Running analysis: PhiValuesAnalysis
89 ; CHECK-O2-NEXT: Running analysis: DemandedBitsAnalysis
90 ; CHECK-O2-NEXT: Running pass: CrossDSOCFIPass
91 ; CHECK-O2-NEXT: Running pass: LowerTypeTestsPass
92 ; CHECK-O2-NEXT: Running pass: ModuleToFunctionPassAdaptor<{{.*}}SimplifyCFGPass>
93 ; CHECK-O2-NEXT: Running pass: EliminateAvailableExternallyPass
94 ; CHECK-O2-NEXT: Running pass: GlobalDCEPass
95 ; CHECK-O-NEXT: Finished llvm::Module pass manager run.
96 ; CHECK-O-NEXT: Running pass: PrintModulePass
98 ; Make sure we get the IR back out without changes when we print the module.
99 ; CHECK-O-LABEL: define void @foo(i32 %n) local_unnamed_addr {
100 ; CHECK-O-NEXT: entry:
101 ; CHECK-O-NEXT: br label %loop
103 ; CHECK-O-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
104 ; CHECK-O-NEXT: %iv.next = add i32 %iv, 1
105 ; CHECK-O-NEXT: tail call void @bar()
106 ; CHECK-O-NEXT: %cmp = icmp eq i32 %iv, %n
107 ; CHECK-O-NEXT: br i1 %cmp, label %exit, label %loop
109 ; CHECK-O-NEXT: ret void
112 ; CHECK-O-NEXT: Finished llvm::Module pass manager run.
114 declare void @bar() local_unnamed_addr
116 define void @foo(i32 %n) local_unnamed_addr {
120 %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
121 %iv.next = add i32 %iv, 1
122 tail call void @bar()
123 %cmp = icmp eq i32 %iv, %n
124 br i1 %cmp, label %exit, label %loop