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: Running analysis: DominatorTreeAnalysis on foo
42 ; CHECK-O2-NEXT: Finished llvm::Function pass manager run.
43 ; CHECK-O2-NEXT: PGOIndirectCallPromotion
44 ; CHECK-O2-NEXT: Running analysis: ProfileSummaryAnalysis
45 ; CHECK-O2-NEXT: Running analysis: OptimizationRemarkEmitterAnalysis
46 ; CHECK-O2-NEXT: Running pass: IPSCCPPass
47 ; CHECK-O2-NEXT: Running analysis: AssumptionAnalysis 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-O2-NEXT: Running analysis: OuterAnalysisManagerProxy
73 ; CHECK-EP-Peephole-NEXT: Running pass: NoOpFunctionPass
74 ; CHECK-O2-NEXT: Finished llvm::Function pass manager run.
75 ; CHECK-O2-NEXT: Running pass: ModuleToPostOrderCGSCCPassAdaptor<{{.*}}InlinerPass>
76 ; CHECK-O2-NEXT: Running pass: GlobalOptPass
77 ; CHECK-O2-NEXT: Running pass: GlobalDCEPass
78 ; CHECK-O2-NEXT: Running pass: ModuleToFunctionPassAdaptor<{{.*}}PassManager{{.*}}>
79 ; CHECK-O2-NEXT: Starting llvm::Function pass manager run.
80 ; CHECK-O2-NEXT: Running pass: InstCombinePass
81 ; CHECK-EP-Peephole-NEXT: Running pass: NoOpFunctionPass
82 ; CHECK-O2-NEXT: Running pass: JumpThreadingPass
83 ; CHECK-O2-NEXT: Running analysis: LazyValueAnalysis
84 ; CHECK-O2-NEXT: Running pass: SROA on foo
85 ; CHECK-O2-NEXT: Running pass: TailCallElimPass on foo
86 ; CHECK-O2-NEXT: Finished llvm::Function pass manager run.
87 ; CHECK-O2-NEXT: Running pass: ModuleToPostOrderCGSCCPassAdaptor<{{.*}}PostOrderFunctionAttrsPass>
88 ; CHECK-O2-NEXT: Running pass: ModuleToFunctionPassAdaptor<{{.*}}PassManager{{.*}}>
89 ; CHECK-O2-NEXT: Running analysis: MemoryDependenceAnalysis
90 ; CHECK-O2-NEXT: Running analysis: PhiValuesAnalysis
91 ; CHECK-O2-NEXT: Running analysis: DemandedBitsAnalysis
92 ; CHECK-O2-NEXT: Running pass: CrossDSOCFIPass
93 ; CHECK-O2-NEXT: Running pass: LowerTypeTestsPass
94 ; CHECK-O2-NEXT: Running pass: ModuleToFunctionPassAdaptor<{{.*}}SimplifyCFGPass>
95 ; CHECK-O2-NEXT: Running pass: EliminateAvailableExternallyPass
96 ; CHECK-O2-NEXT: Running pass: GlobalDCEPass
97 ; CHECK-O-NEXT: Finished llvm::Module pass manager run.
98 ; CHECK-O-NEXT: Running pass: PrintModulePass
100 ; Make sure we get the IR back out without changes when we print the module.
101 ; CHECK-O-LABEL: define void @foo(i32 %n) local_unnamed_addr {
102 ; CHECK-O-NEXT: entry:
103 ; CHECK-O-NEXT: br label %loop
105 ; CHECK-O-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
106 ; CHECK-O-NEXT: %iv.next = add i32 %iv, 1
107 ; CHECK-O-NEXT: tail call void @bar()
108 ; CHECK-O-NEXT: %cmp = icmp eq i32 %iv, %n
109 ; CHECK-O-NEXT: br i1 %cmp, label %exit, label %loop
111 ; CHECK-O-NEXT: ret void
114 ; CHECK-O-NEXT: Finished llvm::Module pass manager run.
116 declare void @bar() local_unnamed_addr
118 define void @foo(i32 %n) local_unnamed_addr {
122 %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
123 %iv.next = add i32 %iv, 1
124 tail call void @bar()
125 %cmp = icmp eq i32 %iv, %n
126 br i1 %cmp, label %exit, label %loop