• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; This test is essentially doing very basic things with the opt tool and the
2; new pass manager pipeline. It will be used to flesh out the feature
3; completeness of the opt tool when the new pass manager is engaged. The tests
4; may not be useful once it becomes the default or may get spread out into other
5; files, but for now this is just going to step the new process through its
6; paces.
7
8; RUN: opt -disable-output -disable-verify -debug-pass-manager \
9; RUN:     -passes=no-op-module %s 2>&1 \
10; RUN:     | FileCheck %s --check-prefix=CHECK-MODULE-PASS
11; CHECK-MODULE-PASS: Starting pass manager
12; CHECK-MODULE-PASS-NEXT: Running pass: NoOpModulePass
13; CHECK-MODULE-PASS-NEXT: Finished pass manager
14
15; RUN: opt -disable-output -disable-verify -debug-pass-manager \
16; RUN:     -passes=no-op-cgscc %s 2>&1 \
17; RUN:     | FileCheck %s --check-prefix=CHECK-CGSCC-PASS
18; RUN: opt -disable-output -disable-verify -debug-pass-manager \
19; RUN:     -passes='cgscc(no-op-cgscc)' %s 2>&1 \
20; RUN:     | FileCheck %s --check-prefix=CHECK-CGSCC-PASS
21; CHECK-CGSCC-PASS: Starting pass manager
22; CHECK-CGSCC-PASS-NEXT: Running pass: ModuleToPostOrderCGSCCPassAdaptor
23; CHECK-CGSCC-PASS-NEXT: Running analysis: CGSCCAnalysisManagerModuleProxy
24; CHECK-CGSCC-PASS-NEXT: Running analysis: Lazy CallGraph Analysis
25; CHECK-CGSCC-PASS-NEXT: Starting pass manager
26; CHECK-CGSCC-PASS-NEXT: Running pass: NoOpCGSCCPass
27; CHECK-CGSCC-PASS-NEXT: Finished pass manager
28; CHECK-CGSCC-PASS-NEXT: Finished pass manager
29
30; RUN: opt -disable-output -disable-verify -debug-pass-manager \
31; RUN:     -passes=no-op-function %s 2>&1 \
32; RUN:     | FileCheck %s --check-prefix=CHECK-FUNCTION-PASS
33; RUN: opt -disable-output -disable-verify -debug-pass-manager \
34; RUN:     -passes='function(no-op-function)' %s 2>&1 \
35; RUN:     | FileCheck %s --check-prefix=CHECK-FUNCTION-PASS
36; CHECK-FUNCTION-PASS: Starting pass manager
37; CHECK-FUNCTION-PASS-NEXT: Running pass: ModuleToFunctionPassAdaptor
38; CHECK-FUNCTION-PASS-NEXT: Running analysis: FunctionAnalysisManagerModuleProxy
39; CHECK-FUNCTION-PASS-NEXT: Starting pass manager
40; CHECK-FUNCTION-PASS-NEXT: Running pass: NoOpFunctionPass
41; CHECK-FUNCTION-PASS-NEXT: Finished pass manager
42; CHECK-FUNCTION-PASS-NEXT: Finished pass manager
43
44; RUN: opt -disable-output -debug-pass-manager -passes=print %s 2>&1 \
45; RUN:     | FileCheck %s --check-prefix=CHECK-MODULE-PRINT
46; CHECK-MODULE-PRINT: Starting pass manager
47; CHECK-MODULE-PRINT: Running pass: VerifierPass
48; CHECK-MODULE-PRINT: Running pass: PrintModulePass
49; CHECK-MODULE-PRINT: ModuleID
50; CHECK-MODULE-PRINT: define void @foo()
51; CHECK-MODULE-PRINT: Running pass: VerifierPass
52; CHECK-MODULE-PRINT: Finished pass manager
53
54; RUN: opt -disable-output -debug-pass-manager -disable-verify -passes='print,verify' %s 2>&1 \
55; RUN:     | FileCheck %s --check-prefix=CHECK-MODULE-VERIFY
56; CHECK-MODULE-VERIFY: Starting pass manager
57; CHECK-MODULE-VERIFY: Running pass: PrintModulePass
58; CHECK-MODULE-VERIFY: ModuleID
59; CHECK-MODULE-VERIFY: define void @foo()
60; CHECK-MODULE-VERIFY: Running pass: VerifierPass
61; CHECK-MODULE-VERIFY: Finished pass manager
62
63; RUN: opt -disable-output -debug-pass-manager -passes='function(print)' %s 2>&1 \
64; RUN:     | FileCheck %s --check-prefix=CHECK-FUNCTION-PRINT
65; CHECK-FUNCTION-PRINT: Starting pass manager
66; CHECK-FUNCTION-PRINT: Running pass: VerifierPass
67; CHECK-FUNCTION-PRINT: Running pass: ModuleToFunctionPassAdaptor
68; CHECK-FUNCTION-PRINT: Running analysis: FunctionAnalysisManagerModuleProxy
69; CHECK-FUNCTION-PRINT: Starting pass manager
70; CHECK-FUNCTION-PRINT: Running pass: PrintFunctionPass
71; CHECK-FUNCTION-PRINT-NOT: ModuleID
72; CHECK-FUNCTION-PRINT: define void @foo()
73; CHECK-FUNCTION-PRINT: Finished pass manager
74; CHECK-FUNCTION-PRINT: Running pass: VerifierPass
75; CHECK-FUNCTION-PRINT: Finished pass manager
76
77; RUN: opt -disable-output -debug-pass-manager -disable-verify -passes='function(print,verify)' %s 2>&1 \
78; RUN:     | FileCheck %s --check-prefix=CHECK-FUNCTION-VERIFY
79; CHECK-FUNCTION-VERIFY: Starting pass manager
80; CHECK-FUNCTION-VERIFY: Starting pass manager
81; CHECK-FUNCTION-VERIFY: Running pass: PrintFunctionPass
82; CHECK-FUNCTION-VERIFY-NOT: ModuleID
83; CHECK-FUNCTION-VERIFY: define void @foo()
84; CHECK-FUNCTION-VERIFY: Running pass: VerifierPass
85; CHECK-FUNCTION-VERIFY: Finished pass manager
86; CHECK-FUNCTION-VERIFY: Finished pass manager
87
88; RUN: opt -S -o - -passes='no-op-module,no-op-module' %s \
89; RUN:     | FileCheck %s --check-prefix=CHECK-NOOP
90; CHECK-NOOP: define void @foo() {
91; CHECK-NOOP:   ret void
92; CHECK-NOOP: }
93
94; Round trip through bitcode.
95; RUN: opt -f -o - -passes='no-op-module,no-op-module' %s \
96; RUN:     | llvm-dis \
97; RUN:     | FileCheck %s --check-prefix=CHECK-NOOP
98
99; RUN: opt -disable-output -debug-pass-manager -verify-each -passes='no-op-module,function(no-op-function)' %s 2>&1 \
100; RUN:     | FileCheck %s --check-prefix=CHECK-VERIFY-EACH
101; CHECK-VERIFY-EACH: Starting pass manager
102; CHECK-VERIFY-EACH: Running pass: VerifierPass
103; CHECK-VERIFY-EACH: Running pass: NoOpModulePass
104; CHECK-VERIFY-EACH: Running pass: VerifierPass
105; CHECK-VERIFY-EACH: Starting pass manager
106; CHECK-VERIFY-EACH: Running pass: NoOpFunctionPass
107; CHECK-VERIFY-EACH: Running pass: VerifierPass
108; CHECK-VERIFY-EACH: Finished pass manager
109; CHECK-VERIFY-EACH: Running pass: VerifierPass
110; CHECK-VERIFY-EACH: Finished pass manager
111
112; RUN: opt -disable-output -debug-pass-manager -disable-verify -passes='no-op-module,function(no-op-function)' %s 2>&1 \
113; RUN:     | FileCheck %s --check-prefix=CHECK-NO-VERIFY
114; CHECK-NO-VERIFY: Starting pass manager
115; CHECK-NO-VERIFY-NOT: VerifierPass
116; CHECK-NO-VERIFY: Running pass: NoOpModulePass
117; CHECK-NO-VERIFY-NOT: VerifierPass
118; CHECK-NO-VERIFY: Starting pass manager
119; CHECK-NO-VERIFY: Running pass: NoOpFunctionPass
120; CHECK-NO-VERIFY-NOT: VerifierPass
121; CHECK-NO-VERIFY: Finished pass manager
122; CHECK-NO-VERIFY-NOT: VerifierPass
123; CHECK-NO-VERIFY: Finished pass manager
124
125; RUN: opt -disable-output -debug-pass-manager \
126; RUN:     -passes='require<no-op-module>,cgscc(require<no-op-cgscc>,function(require<no-op-function>))' %s 2>&1 \
127; RUN:     | FileCheck %s --check-prefix=CHECK-ANALYSES
128; CHECK-ANALYSES: Starting pass manager
129; CHECK-ANALYSES: Running pass: RequireAnalysisPass
130; CHECK-ANALYSES: Running analysis: NoOpModuleAnalysis
131; CHECK-ANALYSES: Starting pass manager
132; CHECK-ANALYSES: Running pass: RequireAnalysisPass
133; CHECK-ANALYSES: Running analysis: NoOpCGSCCAnalysis
134; CHECK-ANALYSES: Starting pass manager
135; CHECK-ANALYSES: Running pass: RequireAnalysisPass
136; CHECK-ANALYSES: Running analysis: NoOpFunctionAnalysis
137
138; Make sure no-op passes that preserve all analyses don't even try to do any
139; analysis invalidation.
140; RUN: opt -disable-output -debug-pass-manager \
141; RUN:     -passes='require<no-op-module>,cgscc(require<no-op-cgscc>,function(require<no-op-function>))' %s 2>&1 \
142; RUN:     | FileCheck %s --check-prefix=CHECK-NO-OP-INVALIDATION
143; CHECK-NO-OP-INVALIDATION: Starting pass manager
144; CHECK-NO-OP-INVALIDATION-NOT: Invalidating all non-preserved analyses
145
146; RUN: opt -disable-output -debug-pass-manager \
147; RUN:     -passes='require<no-op-module>,require<no-op-module>,require<no-op-module>' %s 2>&1 \
148; RUN:     | FileCheck %s --check-prefix=CHECK-DO-CACHE-MODULE-ANALYSIS-RESULTS
149; CHECK-DO-CACHE-MODULE-ANALYSIS-RESULTS: Starting pass manager
150; CHECK-DO-CACHE-MODULE-ANALYSIS-RESULTS: Running pass: RequireAnalysisPass
151; CHECK-DO-CACHE-MODULE-ANALYSIS-RESULTS: Running analysis: NoOpModuleAnalysis
152; CHECK-DO-CACHE-MODULE-ANALYSIS-RESULTS-NOT: Running analysis: NoOpModuleAnalysis
153
154; RUN: opt -disable-output -debug-pass-manager \
155; RUN:     -passes='require<no-op-module>,invalidate<no-op-module>,require<no-op-module>' %s 2>&1 \
156; RUN:     | FileCheck %s --check-prefix=CHECK-DO-INVALIDATE-MODULE-ANALYSIS-RESULTS
157; CHECK-DO-INVALIDATE-MODULE-ANALYSIS-RESULTS: Starting pass manager
158; CHECK-DO-INVALIDATE-MODULE-ANALYSIS-RESULTS: Running pass: RequireAnalysisPass
159; CHECK-DO-INVALIDATE-MODULE-ANALYSIS-RESULTS: Running analysis: NoOpModuleAnalysis
160; CHECK-DO-INVALIDATE-MODULE-ANALYSIS-RESULTS: Invalidating analysis: NoOpModuleAnalysis
161; CHECK-DO-INVALIDATE-MODULE-ANALYSIS-RESULTS: Running analysis: NoOpModuleAnalysis
162
163; RUN: opt -disable-output -debug-pass-manager \
164; RUN:     -passes='cgscc(require<no-op-cgscc>,require<no-op-cgscc>,require<no-op-cgscc>)' %s 2>&1 \
165; RUN:     | FileCheck %s --check-prefix=CHECK-DO-CACHE-CGSCC-ANALYSIS-RESULTS
166; CHECK-DO-CACHE-CGSCC-ANALYSIS-RESULTS: Starting pass manager
167; CHECK-DO-CACHE-CGSCC-ANALYSIS-RESULTS: Running pass: RequireAnalysisPass
168; CHECK-DO-CACHE-CGSCC-ANALYSIS-RESULTS: Running analysis: NoOpCGSCCAnalysis
169; CHECK-DO-CACHE-CGSCC-ANALYSIS-RESULTS-NOT: Running analysis: NoOpCGSCCAnalysis
170
171; RUN: opt -disable-output -debug-pass-manager \
172; RUN:     -passes='cgscc(require<no-op-cgscc>,invalidate<no-op-cgscc>,require<no-op-cgscc>)' %s 2>&1 \
173; RUN:     | FileCheck %s --check-prefix=CHECK-DO-INVALIDATE-CGSCC-ANALYSIS-RESULTS
174; CHECK-DO-INVALIDATE-CGSCC-ANALYSIS-RESULTS: Starting pass manager
175; CHECK-DO-INVALIDATE-CGSCC-ANALYSIS-RESULTS: Running pass: RequireAnalysisPass
176; CHECK-DO-INVALIDATE-CGSCC-ANALYSIS-RESULTS: Running analysis: NoOpCGSCCAnalysis
177; CHECK-DO-INVALIDATE-CGSCC-ANALYSIS-RESULTS: Invalidating analysis: NoOpCGSCCAnalysis
178; CHECK-DO-INVALIDATE-CGSCC-ANALYSIS-RESULTS: Running analysis: NoOpCGSCCAnalysis
179
180; RUN: opt -disable-output -debug-pass-manager \
181; RUN:     -passes='function(require<no-op-function>,require<no-op-function>,require<no-op-function>)' %s 2>&1 \
182; RUN:     | FileCheck %s --check-prefix=CHECK-DO-CACHE-FUNCTION-ANALYSIS-RESULTS
183; CHECK-DO-CACHE-FUNCTION-ANALYSIS-RESULTS: Starting pass manager
184; CHECK-DO-CACHE-FUNCTION-ANALYSIS-RESULTS: Running pass: RequireAnalysisPass
185; CHECK-DO-CACHE-FUNCTION-ANALYSIS-RESULTS: Running analysis: NoOpFunctionAnalysis
186; CHECK-DO-CACHE-FUNCTION-ANALYSIS-RESULTS-NOT: Running analysis: NoOpFunctionAnalysis
187
188; RUN: opt -disable-output -debug-pass-manager \
189; RUN:     -passes='function(require<no-op-function>,invalidate<no-op-function>,require<no-op-function>)' %s 2>&1 \
190; RUN:     | FileCheck %s --check-prefix=CHECK-DO-INVALIDATE-FUNCTION-ANALYSIS-RESULTS
191; CHECK-DO-INVALIDATE-FUNCTION-ANALYSIS-RESULTS: Starting pass manager
192; CHECK-DO-INVALIDATE-FUNCTION-ANALYSIS-RESULTS: Running pass: RequireAnalysisPass
193; CHECK-DO-INVALIDATE-FUNCTION-ANALYSIS-RESULTS: Running analysis: NoOpFunctionAnalysis
194; CHECK-DO-INVALIDATE-FUNCTION-ANALYSIS-RESULTS: Invalidating analysis: NoOpFunctionAnalysis
195; CHECK-DO-INVALIDATE-FUNCTION-ANALYSIS-RESULTS: Running analysis: NoOpFunctionAnalysis
196
197; RUN: opt -disable-output -disable-verify -debug-pass-manager \
198; RUN:     -passes='require<no-op-module>,module(require<no-op-module>,function(require<no-op-function>,invalidate<all>,require<no-op-function>),require<no-op-module>),require<no-op-module>' %s 2>&1 \
199; RUN:     | FileCheck %s --check-prefix=CHECK-INVALIDATE-ALL
200; CHECK-INVALIDATE-ALL: Starting pass manager
201; CHECK-INVALIDATE-ALL: Running pass: RequireAnalysisPass
202; CHECK-INVALIDATE-ALL: Running analysis: NoOpModuleAnalysis
203; CHECK-INVALIDATE-ALL: Starting pass manager
204; CHECK-INVALIDATE-ALL: Running pass: RequireAnalysisPass
205; CHECK-INVALIDATE-ALL-NOT: Running analysis: NoOpModuleAnalysis
206; CHECK-INVALIDATE-ALL: Starting pass manager
207; CHECK-INVALIDATE-ALL: Running pass: RequireAnalysisPass
208; CHECK-INVALIDATE-ALL: Running analysis: NoOpFunctionAnalysis
209; CHECK-INVALIDATE-ALL: Running pass: InvalidateAllAnalysesPass
210; CHECK-INVALIDATE-ALL: Invalidating all non-preserved analyses
211; CHECK-INVALIDATE-ALL: Invalidating analysis: NoOpFunctionAnalysis
212; CHECK-INVALIDATE-ALL: Running pass: RequireAnalysisPass
213; CHECK-INVALIDATE-ALL: Running analysis: NoOpFunctionAnalysis
214; CHECK-INVALIDATE-ALL: Finished pass manager
215; CHECK-INVALIDATE-ALL: Invalidating all non-preserved analyses
216; CHECK-INVALIDATE-ALL-NOT: Running analysis: NoOpFunctionAnalysis
217; CHECK-INVALIDATE-ALL: Invalidating all non-preserved analyses
218; CHECK-INVALIDATE-ALL: Invalidating analysis: NoOpModuleAnalysis
219; CHECK-INVALIDATE-ALL: Running pass: RequireAnalysisPass
220; CHECK-INVALIDATE-ALL: Running analysis: NoOpModuleAnalysis
221; CHECK-INVALIDATE-ALL: Finished pass manager
222; CHECK-INVALIDATE-ALL: Invalidating all non-preserved analyses
223; CHECK-INVALIDATE-ALL-NOT: Invalidating analysis: NoOpModuleAnalysis
224; CHECK-INVALIDATE-ALL: Running pass: RequireAnalysisPass
225; CHECK-INVALIDATE-ALL-NOT: Running analysis: NoOpModuleAnalysis
226; CHECK-INVALIDATE-ALL: Finished pass manager
227
228; RUN: opt -disable-output -disable-verify -debug-pass-manager \
229; RUN:     -passes='require<no-op-module>,module(require<no-op-module>,cgscc(require<no-op-cgscc>,function(require<no-op-function>,invalidate<all>,require<no-op-function>),require<no-op-cgscc>),require<no-op-module>),require<no-op-module>' %s 2>&1 \
230; RUN:     | FileCheck %s --check-prefix=CHECK-INVALIDATE-ALL-CG
231; CHECK-INVALIDATE-ALL-CG: Starting pass manager
232; CHECK-INVALIDATE-ALL-CG: Running pass: RequireAnalysisPass
233; CHECK-INVALIDATE-ALL-CG: Running analysis: NoOpModuleAnalysis
234; CHECK-INVALIDATE-ALL-CG: Starting pass manager
235; CHECK-INVALIDATE-ALL-CG: Running pass: RequireAnalysisPass
236; CHECK-INVALIDATE-ALL-CG-NOT: Running analysis: NoOpModuleAnalysis
237; CHECK-INVALIDATE-ALL-CG: Starting pass manager
238; CHECK-INVALIDATE-ALL-CG: Running pass: RequireAnalysisPass
239; CHECK-INVALIDATE-ALL-CG: Running analysis: NoOpCGSCCAnalysis
240; CHECK-INVALIDATE-ALL-CG: Starting pass manager
241; CHECK-INVALIDATE-ALL-CG: Running pass: RequireAnalysisPass
242; CHECK-INVALIDATE-ALL-CG: Running analysis: NoOpFunctionAnalysis
243; CHECK-INVALIDATE-ALL-CG: Running pass: InvalidateAllAnalysesPass
244; CHECK-INVALIDATE-ALL-CG: Invalidating all non-preserved analyses
245; CHECK-INVALIDATE-ALL-CG: Invalidating analysis: NoOpFunctionAnalysis
246; CHECK-INVALIDATE-ALL-CG: Running pass: RequireAnalysisPass
247; CHECK-INVALIDATE-ALL-CG: Running analysis: NoOpFunctionAnalysis
248; CHECK-INVALIDATE-ALL-CG: Finished pass manager
249; CHECK-INVALIDATE-ALL-CG: Invalidating all non-preserved analyses
250; CHECK-INVALIDATE-ALL-CG-NOT: Running analysis: NoOpFunctionAnalysis
251; CHECK-INVALIDATE-ALL-CG: Invalidating all non-preserved analyses
252; CHECK-INVALIDATE-ALL-CG: Invalidating analysis: NoOpCGSCCAnalysis
253; CHECK-INVALIDATE-ALL-CG: Running pass: RequireAnalysisPass
254; CHECK-INVALIDATE-ALL-CG: Running analysis: NoOpCGSCCAnalysis
255; CHECK-INVALIDATE-ALL-CG: Finished pass manager
256; CHECK-INVALIDATE-ALL-CG: Invalidating all non-preserved analyses
257; CHECK-INVALIDATE-ALL-CG-NOT: Invalidating analysis: NoOpCGSCCAnalysis
258; CHECK-INVALIDATE-ALL-CG: Invalidating all non-preserved analyses
259; CHECK-INVALIDATE-ALL-CG: Invalidating analysis: NoOpModuleAnalysis
260; CHECK-INVALIDATE-ALL-CG: Running pass: RequireAnalysisPass
261; CHECK-INVALIDATE-ALL-CG: Running analysis: NoOpModuleAnalysis
262; CHECK-INVALIDATE-ALL-CG: Finished pass manager
263; CHECK-INVALIDATE-ALL-CG: Invalidating all non-preserved analyses
264; CHECK-INVALIDATE-ALL-CG-NOT: Invalidating analysis: NoOpModuleAnalysis
265; CHECK-INVALIDATE-ALL-CG: Running pass: RequireAnalysisPass
266; CHECK-INVALIDATE-ALL-CG-NOT: Running analysis: NoOpModuleAnalysis
267; CHECK-INVALIDATE-ALL-CG: Finished pass manager
268
269; RUN: opt -disable-output -disable-verify -debug-pass-manager %s 2>&1 \
270; RUN:     -passes='require<targetlibinfo>,invalidate<all>,require<targetlibinfo>' \
271; RUN:     | FileCheck %s --check-prefix=CHECK-TLI
272; CHECK-TLI: Starting pass manager
273; CHECK-TLI: Running pass: RequireAnalysisPass
274; CHECK-TLI: Running analysis: TargetLibraryAnalysis
275; CHECK-TLI: Running pass: InvalidateAllAnalysesPass
276; CHECK-TLI-NOT: Invalidating analysis: TargetLibraryAnalysis
277; CHECK-TLI: Running pass: RequireAnalysisPass
278; CHECK-TLI-NOT: Running analysis: TargetLibraryAnalysis
279; CHECK-TLI: Finished pass manager
280
281; RUN: opt -disable-output -disable-verify -debug-pass-manager %s 2>&1 \
282; RUN:     -passes='require<targetir>,invalidate<all>,require<targetir>' \
283; RUN:     | FileCheck %s --check-prefix=CHECK-TIRA
284; CHECK-TIRA: Starting pass manager
285; CHECK-TIRA: Running pass: RequireAnalysisPass
286; CHECK-TIRA: Running analysis: TargetIRAnalysis
287; CHECK-TIRA: Running pass: InvalidateAllAnalysesPass
288; CHECK-TIRA-NOT: Invalidating analysis: TargetIRAnalysis
289; CHECK-TIRA: Running pass: RequireAnalysisPass
290; CHECK-TIRA-NOT: Running analysis: TargetIRAnalysis
291; CHECK-TIRA: Finished pass manager
292
293; RUN: opt -disable-output -disable-verify -debug-pass-manager %s 2>&1 \
294; RUN:     -passes='require<domtree>' \
295; RUN:     | FileCheck %s --check-prefix=CHECK-DT
296; CHECK-DT: Starting pass manager
297; CHECK-DT: Running pass: RequireAnalysisPass
298; CHECK-DT: Running analysis: DominatorTreeAnalysis
299; CHECK-DT: Finished pass manager
300
301define void @foo() {
302  ret void
303}
304
305declare void @bar()
306