1 ; Basic test for the new LTO pipeline.
3 ; RUN: opt -disable-verify -verify-analysis-invalidation=0 -eagerly-invalidate-analyses=0 -debug-pass-manager \
4 ; RUN: -passes='lto<O1>' -S %s 2>&1 \
5 ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O1
6 ; RUN: opt -disable-verify -verify-analysis-invalidation=0 -eagerly-invalidate-analyses=0 -debug-pass-manager \
7 ; RUN: -passes='lto<O1>' -S %s -passes-ep-full-link-time-optimization-early=no-op-module \
8 ; RUN: -passes-ep-full-link-time-optimization-last=no-op-module 2>&1 \
9 ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O1,CHECK-EP
10 ; RUN: opt -disable-verify -verify-analysis-invalidation=0 -eagerly-invalidate-analyses=0 -debug-pass-manager \
11 ; RUN: -passes='lto<O2>' -S %s 2>&1 \
12 ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O2,CHECK-O23SZ
13 ; RUN: opt -disable-verify -verify-analysis-invalidation=0 -eagerly-invalidate-analyses=0 -debug-pass-manager \
14 ; RUN: -passes='lto<O2>' -S %s -passes-ep-full-link-time-optimization-early=no-op-module \
15 ; RUN: -passes-ep-full-link-time-optimization-last=no-op-module 2>&1 \
16 ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O2,CHECK-O23SZ,CHECK-EP
17 ; RUN: opt -disable-verify -verify-analysis-invalidation=0 -eagerly-invalidate-analyses=0 -debug-pass-manager \
18 ; RUN: -passes='lto<O3>' -S %s 2>&1 \
19 ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O3,CHECK-O23SZ
20 ; RUN: opt -disable-verify -verify-analysis-invalidation=0 -eagerly-invalidate-analyses=0 -debug-pass-manager \
21 ; RUN: -passes='lto<Os>' -S %s 2>&1 \
22 ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-OS,CHECK-O23SZ
23 ; RUN: opt -disable-verify -verify-analysis-invalidation=0 -eagerly-invalidate-analyses=0 -debug-pass-manager \
24 ; RUN: -passes='lto<Oz>' -S %s 2>&1 \
25 ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O23SZ
26 ; RUN: opt -disable-verify -verify-analysis-invalidation=0 -eagerly-invalidate-analyses=0 -debug-pass-manager \
27 ; RUN: -passes='lto<O3>' -S %s -passes-ep-peephole='no-op-function' 2>&1 \
28 ; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O3,CHECK-O23SZ,CHECK-EP-Peephole
30 ; CHECK-EP: Running pass: NoOpModulePass
31 ; CHECK-O: Running pass: CrossDSOCFIPass
32 ; CHECK-O-NEXT: Running pass: OpenMPOptPass
33 ; CHECK-O-NEXT: Running pass: GlobalDCEPass
34 ; CHECK-O-NEXT: Running pass: InferFunctionAttrsPass
35 ; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Module
36 ; CHECK-O-NEXT: Running analysis: TargetLibraryAnalysis
37 ; CHECK-O23SZ-NEXT: Running pass: CallSiteSplittingPass on foo
38 ; CHECK-O23SZ-NEXT: Running analysis: TargetLibraryAnalysis on foo
39 ; CHECK-O23SZ-NEXT: Running analysis: TargetIRAnalysis on foo
40 ; CHECK-O23SZ-NEXT: Running analysis: DominatorTreeAnalysis on foo
41 ; CHECK-O23SZ-NEXT: PGOIndirectCallPromotion
42 ; CHECK-O23SZ-NEXT: Running analysis: ProfileSummaryAnalysis
43 ; CHECK-O23SZ-NEXT: Running analysis: OptimizationRemarkEmitterAnalysis
44 ; CHECK-O23SZ-NEXT: Running pass: IPSCCPPass
45 ; CHECK-O23SZ-NEXT: Running analysis: AssumptionAnalysis on foo
46 ; CHECK-O23SZ-NEXT: Running pass: CalledValuePropagationPass
47 ; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}SCC
48 ; CHECK-O-NEXT: Running analysis: LazyCallGraphAnalysis
49 ; CHECK-O1-NEXT: Running analysis: TargetLibraryAnalysis
50 ; CHECK-O-NEXT: Running analysis: FunctionAnalysisManagerCGSCCProxy
51 ; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy<{{.*}}LazyCallGraph{{.*}}>
52 ; CHECK-O-NEXT: Running pass: PostOrderFunctionAttrsPass
53 ; CHECK-O-NEXT: Running analysis: AAManager
54 ; CHECK-O-NEXT: Running analysis: BasicAA
55 ; CHECK-O1-NEXT: Running analysis: AssumptionAnalysis on foo
56 ; CHECK-O1-NEXT: Running analysis: TargetIRAnalysis
57 ; CHECK-O1-NEXT: Running analysis: DominatorTreeAnalysis
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 pass: ReversePostOrderFunctionAttrsPass
62 ; CHECK-O-NEXT: Running pass: GlobalSplitPass
63 ; CHECK-O-NEXT: Running pass: WholeProgramDevirtPass
64 ; CHECK-O1-NEXT: Running pass: LowerTypeTestsPass
65 ; CHECK-O23SZ-NEXT: Running pass: GlobalOptPass
66 ; CHECK-O23SZ-NEXT: Running pass: PromotePass
67 ; CHECK-O23SZ-NEXT: Running pass: ConstantMergePass
68 ; CHECK-O23SZ-NEXT: Running pass: DeadArgumentEliminationPass
69 ; CHECK-O23SZ-NEXT: Running pass: InstCombinePass
70 ; CHECK-O23SZ-NEXT: Running pass: AggressiveInstCombinePass
71 ; CHECK-EP-Peephole-NEXT: Running pass: NoOpFunctionPass
72 ; CHECK-O23SZ-NEXT: Running pass: ModuleInlinerWrapperPass
73 ; CHECK-O23SZ-NEXT: Running analysis: InlineAdvisorAnalysis
74 ; CHECK-O23SZ-NEXT: Running pass: InlinerPass
75 ; CHECK-O23SZ-NEXT: Running pass: InlinerPass
76 ; CHECK-O23SZ-NEXT: Invalidating analysis: InlineAdvisorAnalysis
77 ; CHECK-O23SZ-NEXT: Running pass: GlobalOptPass
78 ; CHECK-O23SZ-NEXT: Running pass: OpenMPOptPass
79 ; CHECK-O23SZ-NEXT: Running pass: GlobalDCEPass
80 ; CHECK-O23SZ-NEXT: Running pass: ArgumentPromotionPass
81 ; CHECK-O23SZ-NEXT: Running pass: InstCombinePass
82 ; CHECK-EP-Peephole-NEXT: Running pass: NoOpFunctionPass
83 ; CHECK-O23SZ-NEXT: Running pass: ConstraintEliminationPass
84 ; CHECK-O23SZ-NEXT: Running analysis: LoopAnalysis on foo
85 ; CHECK-O23SZ-NEXT: Running analysis: ScalarEvolutionAnalysis on foo
86 ; CHECK-O23SZ-NEXT: Running pass: JumpThreadingPass
87 ; CHECK-O23SZ-NEXT: Running analysis: LazyValueAnalysis
88 ; CHECK-O23SZ-NEXT: Running pass: SROAPass on foo
89 ; CHECK-O23SZ-NEXT: Running pass: TailCallElimPass on foo
90 ; CHECK-O23SZ-NEXT: Running pass: PostOrderFunctionAttrsPass on (foo)
91 ; CHECK-O23SZ-NEXT: Running pass: RequireAnalysisPass<{{.*}}GlobalsAA
92 ; CHECK-O23SZ-NEXT: Running analysis: GlobalsAA on [module]
93 ; CHECK-O23SZ-NEXT: Running analysis: CallGraphAnalysis on [module]
94 ; CHECK-O23SZ-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}AAManager
95 ; CHECK-O23SZ-NEXT: Invalidating analysis: AAManager on foo
96 ; CHECK-O23SZ-NEXT: Running pass: OpenMPOptCGSCCPass on (foo)
97 ; CHECK-O23SZ-NEXT: Running pass: LoopSimplifyPass on foo
98 ; CHECK-O23SZ-NEXT: Running pass: LCSSAPass on foo
99 ; CHECK-O23SZ-NEXT: Running analysis: MemorySSAAnalysis on foo
100 ; CHECK-O23SZ-NEXT: Running analysis: AAManager on foo
101 ; CHECK-O23SZ-NEXT: Running analysis: InnerAnalysisManagerProxy
102 ; CHECK-O23SZ-NEXT: Running pass: LICMPass on loop
103 ; CHECK-O23SZ-NEXT: Running pass: GVNPass on foo
104 ; CHECK-O23SZ-NEXT: Running analysis: MemoryDependenceAnalysis on foo
105 ; CHECK-O23SZ-NEXT: Running pass: MemCpyOptPass on foo
106 ; CHECK-O23SZ-NEXT: Running analysis: PostDominatorTreeAnalysis on foo
107 ; CHECK-O23SZ-NEXT: Running pass: DSEPass on foo
108 ; CHECK-O23SZ-NEXT: Running pass: MoveAutoInitPass on foo
109 ; CHECK-O23SZ-NEXT: Running pass: MergedLoadStoreMotionPass on foo
110 ; CHECK-O23SZ-NEXT: Running pass: LoopSimplifyPass on foo
111 ; CHECK-O23SZ-NEXT: Running pass: LCSSAPass on foo
112 ; CHECK-O23SZ-NEXT: Running pass: IndVarSimplifyPass on loop
113 ; CHECK-O23SZ-NEXT: Running pass: LoopDeletionPass on loop
114 ; CHECK-O23SZ-NEXT: Running pass: LoopFullUnrollPass on loop
115 ; CHECK-O23SZ-NEXT: Running pass: LoopDistributePass on foo
116 ; CHECK-O23SZ-NEXT: Running analysis: LoopAccessAnalysis on foo
117 ; CHECK-O23SZ-NEXT: Running pass: LoopVectorizePass on foo
118 ; CHECK-O23SZ-NEXT: Running analysis: DemandedBitsAnalysis on foo
119 ; CHECK-O23SZ-NEXT: Running pass: InferAlignmentPass on foo
120 ; CHECK-O23SZ-NEXT: Running pass: LoopUnrollPass on foo
121 ; CHECK-O23SZ-NEXT: WarnMissedTransformationsPass on foo
122 ; CHECK-O23SZ-NEXT: Running pass: SROAPass on foo
123 ; CHECK-O23SZ-NEXT: Running pass: InstCombinePass on foo
124 ; CHECK-O23SZ-NEXT: Running pass: SimplifyCFGPass on foo
125 ; CHECK-O23SZ-NEXT: Running pass: SCCPPass on foo
126 ; CHECK-O23SZ-NEXT: Running pass: InstCombinePass on foo
127 ; CHECK-O23SZ-NEXT: Running pass: BDCEPass on foo
128 ; CHECK-O2-NEXT: Running pass: SLPVectorizerPass on foo
129 ; CHECK-O3-NEXT: Running pass: SLPVectorizerPass on foo
130 ; CHECK-OS-NEXT: Running pass: SLPVectorizerPass on foo
131 ; CHECK-O23SZ-NEXT: Running pass: VectorCombinePass on foo
132 ; CHECK-O23SZ-NEXT: Running pass: InferAlignmentPass on foo
133 ; CHECK-O23SZ-NEXT: Running pass: InstCombinePass on foo
134 ; CHECK-O23SZ-NEXT: Running pass: LoopSimplifyPass
135 ; CHECK-O23SZ-NEXT: Running pass: LCSSAPass
136 ; CHECK-O23SZ-NEXT: Running pass: LICMPass
137 ; CHECK-O23SZ-NEXT: Running pass: AlignmentFromAssumptionsPass on foo
138 ; CHECK-EP-Peephole-NEXT: Running pass: NoOpFunctionPass on foo
139 ; CHECK-O23SZ-NEXT: Running pass: JumpThreadingPass on foo
140 ; CHECK-O23SZ-NEXT: Running pass: LowerTypeTestsPass
141 ; CHECK-O-NEXT: Running pass: LowerTypeTestsPass
142 ; CHECK-O23SZ-NEXT: Running pass: LoopSink
143 ; CHECK-O23SZ-NEXT: Running pass: DivRemPairs
144 ; CHECK-O23SZ-NEXT: Running pass: SimplifyCFGPass
145 ; CHECK-O23SZ-NEXT: Running pass: EliminateAvailableExternallyPass
146 ; CHECK-O23SZ-NEXT: Running pass: GlobalDCEPass
147 ; CHECK-O23SZ-NEXT: Running pass: CGProfilePass
148 ; CHECK-EP-NEXT: Running pass: NoOpModulePass
149 ; CHECK-O-NEXT: Running pass: AnnotationRemarksPass on foo
150 ; CHECK-O-NEXT: Running pass: PrintModulePass
152 ; Make sure we get the IR back out without changes when we print the module.
153 ; CHECK-O-LABEL: define void @foo(i32 %n) local_unnamed_addr {
154 ; CHECK-O-NEXT: entry:
155 ; CHECK-O-NEXT: br label %loop
157 ; CHECK-O-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
158 ; CHECK-O-NEXT: %iv.next = add i32 %iv, 1
159 ; CHECK-O-NEXT: tail call void @bar()
160 ; CHECK-O-NEXT: %cmp = icmp eq i32 %iv, %n
161 ; CHECK-O-NEXT: br i1 %cmp, label %exit, label %loop
163 ; CHECK-O-NEXT: ret void
167 declare void @bar() local_unnamed_addr
169 define void @foo(i32 %n) local_unnamed_addr {
173 %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
174 %iv.next = add i32 %iv, 1
175 tail call void @bar()
176 %cmp = icmp eq i32 %iv, %n
177 br i1 %cmp, label %exit, label %loop