xref: /llvm-project/llvm/test/Other/pass-pipeline-parsing.ll (revision d3161defd6b717241a85b6ca528754c747060735)
1; RUN: opt -disable-output -debug-pass-manager \
2; RUN:     -passes=no-op-module,no-op-module %s 2>&1 \
3; RUN:     | FileCheck %s --check-prefix=CHECK-TWO-NOOP-MP
4; CHECK-TWO-NOOP-MP: Running pass: NoOpModulePass
5; CHECK-TWO-NOOP-MP: Running pass: NoOpModulePass
6
7; RUN: opt -disable-output -debug-pass-manager \
8; RUN:     -passes='module(no-op-module,no-op-module)' %s 2>&1 \
9; RUN:     | FileCheck %s --check-prefix=CHECK-NESTED-TWO-NOOP-MP
10; CHECK-NESTED-TWO-NOOP-MP: Running pass: NoOpModulePass
11; CHECK-NESTED-TWO-NOOP-MP: Running pass: NoOpModulePass
12
13; RUN: opt -disable-output -debug-pass-manager \
14; RUN:     -passes=no-op-function,no-op-function %s 2>&1 \
15; RUN:     | FileCheck %s --check-prefix=CHECK-TWO-NOOP-FP
16; CHECK-TWO-NOOP-FP: Running pass: NoOpFunctionPass
17; CHECK-TWO-NOOP-FP: Running pass: NoOpFunctionPass
18
19; RUN: opt -disable-output -debug-pass-manager \
20; RUN:     -passes='function(no-op-function,no-op-function)' %s 2>&1 \
21; RUN:     | FileCheck %s --check-prefix=CHECK-NESTED-TWO-NOOP-FP
22; CHECK-NESTED-TWO-NOOP-FP: Running pass: NoOpFunctionPass
23; CHECK-NESTED-TWO-NOOP-FP: Running pass: NoOpFunctionPass
24
25; RUN: opt -disable-output -debug-pass-manager \
26; RUN:     -passes='no-op-module,function(no-op-function,no-op-function),no-op-module' %s 2>&1 \
27; RUN:     | FileCheck %s --check-prefix=CHECK-MIXED-FP-AND-MP
28; CHECK-MIXED-FP-AND-MP: Running pass: NoOpModulePass
29; CHECK-MIXED-FP-AND-MP: Running pass: NoOpFunctionPass
30; CHECK-MIXED-FP-AND-MP: Running pass: NoOpFunctionPass
31; CHECK-MIXED-FP-AND-MP: Running pass: NoOpModulePass
32
33; RUN: opt -disable-output -debug-pass-manager \
34; RUN:     -aa-pipeline= -passes='require<aa>' %s 2>&1 \
35; RUN:     | FileCheck %s --check-prefix=CHECK-EMPTY-AA
36; CHECK-EMPTY-AA: Running analysis: AAManager
37; CHECK-EMPTY-AA-NOT: Running analysis: BasicAA
38
39; RUN: opt -disable-output -debug-pass-manager \
40; RUN:     -aa-pipeline=basic-aa -passes='require<aa>' %s 2>&1 \
41; RUN:     | FileCheck %s --check-prefix=CHECK-BASIC-AA
42; CHECK-BASIC-AA: Running analysis: AAManager
43; CHECK-BASIC-AA: Running analysis: BasicAA
44; CHECK-BASIC-AA-NOT: Running analysis: TypeBasedAA
45
46; RUN: opt -disable-output -debug-pass-manager \
47; RUN:     -aa-pipeline=basic-aa,tbaa -passes='require<aa>' %s 2>&1 \
48; RUN:     | FileCheck %s --check-prefix=CHECK-TWO-AA
49; CHECK-TWO-AA: Running analysis: AAManager
50; CHECK-TWO-AA: Running analysis: BasicAA
51; CHECK-TWO-AA: Running analysis: TypeBasedAA
52
53; RUN: opt -disable-output -debug-pass-manager \
54; RUN:     -aa-pipeline=default -passes='require<aa>' %s 2>&1 \
55; RUN:     | FileCheck %s --check-prefix=CHECK-DEFAULT-AA
56; CHECK-DEFAULT-AA: Running analysis: AAManager
57; CHECK-DEFAULT-AA-DAG: Running analysis: BasicAA
58; CHECK-DEFAULT-AA-DAG: Running analysis: TypeBasedAA
59
60; RUN: not opt -passes='function<no-rerun>(no-op-function)' %s 2>&1 \
61; RUN:     | FileCheck %s --check-prefix=CHECK-RERUN-BAD
62; CHECK-RERUN-BAD: cannot have a no-rerun module to function adaptor
63
64; RUN: not opt -disable-output -debug-pass-manager \
65; RUN:     -passes='no-op-module)' %s 2>&1 \
66; RUN:     | FileCheck %s --check-prefix=CHECK-UNBALANCED1
67; CHECK-UNBALANCED1: invalid pipeline 'no-op-module)'
68
69; RUN: not opt -disable-output -debug-pass-manager \
70; RUN:     -passes='module(no-op-module))' %s 2>&1 \
71; RUN:     | FileCheck %s --check-prefix=CHECK-UNBALANCED2
72; CHECK-UNBALANCED2: invalid pipeline 'module(no-op-module))'
73
74; RUN: not opt -disable-output -debug-pass-manager \
75; RUN:     -passes='module(no-op-module' %s 2>&1 \
76; RUN:     | FileCheck %s --check-prefix=CHECK-UNBALANCED3
77; CHECK-UNBALANCED3: invalid pipeline 'module(no-op-module'
78
79; RUN: not opt -disable-output -debug-pass-manager \
80; RUN:     -passes='no-op-function)' %s 2>&1 \
81; RUN:     | FileCheck %s --check-prefix=CHECK-UNBALANCED4
82; CHECK-UNBALANCED4: invalid pipeline 'no-op-function)'
83
84; RUN: not opt -disable-output -debug-pass-manager \
85; RUN:     -passes='function(no-op-function))' %s 2>&1 \
86; RUN:     | FileCheck %s --check-prefix=CHECK-UNBALANCED5
87; CHECK-UNBALANCED5: invalid pipeline 'function(no-op-function))'
88
89; RUN: not opt -disable-output -debug-pass-manager \
90; RUN:     -passes='function(function(no-op-function)))' %s 2>&1 \
91; RUN:     | FileCheck %s --check-prefix=CHECK-UNBALANCED6
92; CHECK-UNBALANCED6: invalid pipeline 'function(function(no-op-function)))'
93
94; RUN: not opt -disable-output -debug-pass-manager \
95; RUN:     -passes='function(no-op-function' %s 2>&1 \
96; RUN:     | FileCheck %s --check-prefix=CHECK-UNBALANCED7
97; CHECK-UNBALANCED7: invalid pipeline 'function(no-op-function'
98
99; RUN: not opt -disable-output -debug-pass-manager \
100; RUN:     -passes='function(function(no-op-function)' %s 2>&1 \
101; RUN:     | FileCheck %s --check-prefix=CHECK-UNBALANCED8
102; CHECK-UNBALANCED8: invalid pipeline 'function(function(no-op-function)'
103
104; RUN: not opt -disable-output -debug-pass-manager \
105; RUN:     -passes='no-op-module,)' %s 2>&1 \
106; RUN:     | FileCheck %s --check-prefix=CHECK-UNBALANCED9
107; CHECK-UNBALANCED9: invalid pipeline 'no-op-module,)'
108
109; RUN: not opt -disable-output -debug-pass-manager \
110; RUN:     -passes='no-op-function,)' %s 2>&1 \
111; RUN:     | FileCheck %s --check-prefix=CHECK-UNBALANCED10
112; CHECK-UNBALANCED10: invalid pipeline 'no-op-function,)'
113
114; RUN: opt -disable-output -debug-pass-manager \
115; RUN:     -passes=no-op-cgscc,no-op-cgscc %s 2>&1 \
116; RUN:     | FileCheck %s --check-prefix=CHECK-TWO-NOOP-CG
117; CHECK-TWO-NOOP-CG: Running pass: NoOpCGSCCPass
118; CHECK-TWO-NOOP-CG: Running pass: NoOpCGSCCPass
119
120; RUN: opt -disable-output -debug-pass-manager \
121; RUN:     -passes='module(function(no-op-function),cgscc(no-op-cgscc,function(no-op-function),no-op-cgscc),function(no-op-function))' %s 2>&1 \
122; RUN:     | FileCheck %s --check-prefix=CHECK-NESTED-MP-CG-FP
123; CHECK-NESTED-MP-CG-FP: Running pass: NoOpFunctionPass
124; CHECK-NESTED-MP-CG-FP: Running pass: NoOpCGSCCPass
125; CHECK-NESTED-MP-CG-FP: Running pass: NoOpFunctionPass
126; CHECK-NESTED-MP-CG-FP: Running pass: NoOpCGSCCPass
127; CHECK-NESTED-MP-CG-FP: Running pass: NoOpFunctionPass
128
129; RUN: opt -disable-output -debug-pass-manager \
130; RUN:     -passes='no-op-loop,no-op-loop' %s 2>&1 \
131; RUN:     | FileCheck %s --check-prefix=CHECK-TWO-NOOP-LOOP
132; CHECK-TWO-NOOP-LOOP: Running pass: NoOpLoopPass
133; CHECK-TWO-NOOP-LOOP: Running pass: NoOpLoopPass
134
135; RUN: opt -disable-output -debug-pass-manager \
136; RUN:     -passes='module(function(loop(no-op-loop)))' %s 2>&1 \
137; RUN:     | FileCheck %s --check-prefix=CHECK-NESTED-FP-LP
138; RUN: opt -disable-output -debug-pass-manager \
139; RUN:     -passes='function(loop(no-op-loop))' %s 2>&1 \
140; RUN:     | FileCheck %s --check-prefix=CHECK-NESTED-FP-LP
141; RUN: opt -disable-output -debug-pass-manager \
142; RUN:     -passes='loop(no-op-loop)' %s 2>&1 \
143; RUN:     | FileCheck %s --check-prefix=CHECK-NESTED-FP-LP
144; RUN: opt -disable-output -debug-pass-manager \
145; RUN:     -passes='no-op-loop' %s 2>&1 \
146; RUN:     | FileCheck %s --check-prefix=CHECK-NESTED-FP-LP
147; CHECK-NESTED-FP-LP: Running pass: NoOpLoopPass
148
149; RUN: opt -disable-output -debug-pass-manager=verbose \
150; RUN:     -passes='module(no-op-function,no-op-loop,no-op-cgscc,cgscc(no-op-function,no-op-loop),function(no-op-loop))' %s 2>&1 \
151; RUN:     | FileCheck %s --check-prefix=CHECK-ADAPTORS
152; CHECK-ADAPTORS: Running pass: ModuleToFunctionPassAdaptor
153; CHECK-ADAPTORS: Running pass: NoOpFunctionPass
154; CHECK-ADAPTORS: Running pass: ModuleToFunctionPassAdaptor
155; CHECK-ADAPTORS: Running pass: FunctionToLoopPassAdaptor
156; CHECK-ADAPTORS: Running pass: NoOpLoopPass on loop
157; CHECK-ADAPTORS: Running pass: ModuleToPostOrderCGSCCPassAdaptor
158; CHECK-ADAPTORS: Running pass: NoOpCGSCCPass
159; CHECK-ADAPTORS: Running pass: ModuleToPostOrderCGSCCPassAdaptor
160; CHECK-ADAPTORS: Running pass: PassManager{{.*}}SCC
161; CHECK-ADAPTORS: Running pass: CGSCCToFunctionPassAdaptor
162; CHECK-ADAPTORS: Running pass: NoOpFunctionPass
163; CHECK-ADAPTORS: Running pass: CGSCCToFunctionPassAdaptor
164; CHECK-ADAPTORS: Running pass: FunctionToLoopPassAdaptor
165; CHECK-ADAPTORS: Running pass: NoOpLoopPass on loop
166; CHECK-ADAPTORS: Running pass: ModuleToFunctionPassAdaptor
167; CHECK-ADAPTORS: Running pass: PassManager{{.*}}Function
168; CHECK-ADAPTORS: Running pass: FunctionToLoopPassAdaptor
169; CHECK-ADAPTORS: Running pass: NoOpLoopPass on loop
170
171; RUN: opt -disable-output -debug-pass-manager \
172; RUN:     -passes='module(function(no-op-function,loop(no-op-loop,no-op-loop)))' %s 2>&1 \
173; RUN:     | FileCheck %s --check-prefix=CHECK-MANAGERS-NO-VERBOSE
174; RUN: opt -disable-output -debug-pass-manager=verbose \
175; RUN:     -passes='module(function(no-op-function,loop(no-op-loop,no-op-loop)))' %s 2>&1 \
176; RUN:     | FileCheck %s --check-prefix=CHECK-MANAGERS
177; CHECK-MANAGERS: Running pass: PassManager{{.*}}Function
178; CHECK-MANAGERS: Running pass: PassManager{{.*}}Loop
179; CHECK-MANAGERS-NO-VERBOSE-NOT: PassManager
180
181; RUN: opt -disable-output -debug-pass-manager \
182; RUN:     -passes='cgscc(print)' %s 2>&1 \
183; RUN:     | FileCheck %s --check-prefix=CHECK-PRINT-IN-CGSCC
184; CHECK-PRINT-IN-CGSCC: Running pass: PrintFunctionPass
185; CHECK-PRINT-IN-CGSCC: Running pass: VerifierPass
186
187; RUN: not opt -disable-output -debug-pass-manager \
188; RUN:     -passes='function(no-op-function)function(no-op-function)' %s 2>&1 \
189; RUN:     | FileCheck %s --check-prefix=CHECK-MISSING-COMMA1
190; CHECK-MISSING-COMMA1: invalid pipeline 'function(no-op-function)function(no-op-function)'
191
192; RUN: not opt -disable-output -debug-pass-manager \
193; RUN:     -passes='function()' %s 2>&1 \
194; RUN:     | FileCheck %s --check-prefix=CHECK-EMPTY-INNER-PIPELINE
195; CHECK-EMPTY-INNER-PIPELINE: unknown function pass ''
196
197; RUN: not opt -disable-output -debug-pass-manager \
198; RUN:     -passes='no-op-module(no-op-module,whatever)' %s 2>&1 \
199; RUN:     | FileCheck %s --check-prefix=CHECK-PIPELINE-ON-MODULE-PASS
200; CHECK-PIPELINE-ON-MODULE-PASS: invalid use of 'no-op-module' pass as module pipeline
201
202; RUN: not opt -disable-output -debug-pass-manager \
203; RUN:     -passes='no-op-cgscc(no-op-cgscc,whatever)' %s 2>&1 \
204; RUN:     | FileCheck %s --check-prefix=CHECK-PIPELINE-ON-CGSCC-PASS
205; CHECK-PIPELINE-ON-CGSCC-PASS: invalid use of 'no-op-cgscc' pass as cgscc pipeline
206
207; RUN: not opt -disable-output -debug-pass-manager \
208; RUN:     -passes='no-op-function(no-op-function,whatever)' %s 2>&1 \
209; RUN:     | FileCheck %s --check-prefix=CHECK-PIPELINE-ON-FUNCTION-PASS
210; CHECK-PIPELINE-ON-FUNCTION-PASS: invalid use of 'no-op-function' pass as function pipeline
211
212; RUN: not opt -disable-output -debug-pass-manager \
213; RUN:     -passes='no-op-loop(no-op-loop,whatever)' %s 2>&1 \
214; RUN:     | FileCheck %s --check-prefix=CHECK-PIPELINE-ON-LOOP-PASS
215; CHECK-PIPELINE-ON-LOOP-PASS: invalid use of 'no-op-loop' pass as loop pipeline
216
217; RUN: not opt -disable-output -debug-pass-manager \
218; RUN:     -passes='no-op-function()' %s 2>&1 \
219; RUN:     | FileCheck %s --check-prefix=CHECK-EMPTY-PIPELINE-ON-PASS
220; CHECK-EMPTY-PIPELINE-ON-PASS: invalid use of 'no-op-function' pass as function pipeline
221
222; RUN: not opt -passes='no-op-module,bad' \
223; RUN:       /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=CHECK-UNKNOWN-MODULE
224; CHECK-UNKNOWN-MODULE: unknown module pass 'bad'
225
226; RUN: not opt -passes='no-op-loop,bad' \
227; RUN:       /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=CHECK-UNKNOWN-LOOP
228; CHECK-UNKNOWN-LOOP: unknown loop pass 'bad'
229
230; RUN: not opt -passes='no-op-cgscc,bad' \
231; RUN:       /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=CHECK-UNKNOWN-CGSCC
232; CHECK-UNKNOWN-CGSCC: unknown cgscc pass 'bad'
233
234; RUN: not opt -passes='no-op-function,bad' \
235; RUN:       /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=CHECK-UNKNOWN-FUNCTION
236; RUN: not opt -passes='function(bad,pipeline,text)' \
237; RUN:       /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=CHECK-UNKNOWN-FUNCTION
238; RUN: not opt -passes='module(no-op-module,function(bad,pipeline,text))' \
239; RUN:       /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=CHECK-UNKNOWN-FUNCTION
240; RUN: not opt -passes='no-op-module,function(bad,pipeline,text)' \
241; RUN:       /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=CHECK-UNKNOWN-FUNCTION
242; RUN: not opt -passes='module(cgscc(function(bad,pipeline,text)))' \
243; RUN:       /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=CHECK-UNKNOWN-FUNCTION
244; CHECK-UNKNOWN-FUNCTION: unknown function pass 'bad'
245
246; RUN: not opt -aa-pipeline=bad -passes=no-op-function \
247; RUN:       /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=AA-PIPELINE-ERR
248; AA-PIPELINE-ERR: unknown alias analysis name 'bad'
249; RUN: opt -passes-ep-peephole=bad -passes=no-op-function \
250; RUN:       /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=PASSES-EP-PEEPHOLE-ERR
251; PASSES-EP-PEEPHOLE-ERR: Could not parse -passes-ep-peephole pipeline: unknown function pass 'bad'
252; RUN: opt -passes-ep-late-loop-optimizations=bad -passes=no-op-function \
253; RUN:       /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=PASSES-EP-LATELOOPOPT-ERR
254; PASSES-EP-LATELOOPOPT-ERR: Could not parse -passes-ep-late-loop-optimizations pipeline: unknown loop pass 'bad'
255; RUN: opt -passes-ep-loop-optimizer-end=bad -passes=no-op-function \
256; RUN:       /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=PASSES-EP-LOOPOPTEND-ERR
257; PASSES-EP-LOOPOPTEND-ERR: Could not parse -passes-ep-loop-optimizer-end pipeline: unknown loop pass 'bad'
258; RUN: opt -passes-ep-scalar-optimizer-late=bad -passes=no-op-function \
259; RUN:       /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=PASSES-EP-SCALAROPTLATE-ERR
260; PASSES-EP-SCALAROPTLATE-ERR: Could not parse -passes-ep-scalar-optimizer-late pipeline: unknown function pass 'bad'
261; RUN: opt -passes-ep-cgscc-optimizer-late=bad -passes=no-op-function \
262; RUN:       /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=PASSES-EP-CGSCCOPTLATE-ERR
263; PASSES-EP-CGSCCOPTLATE-ERR: Could not parse -passes-ep-cgscc-optimizer-late pipeline: unknown cgscc pass 'bad'
264; RUN: opt -passes-ep-vectorizer-start=bad -passes=no-op-function \
265; RUN:       /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=PASSES-EP-VECTORIZERSTART-ERR
266; PASSES-EP-VECTORIZERSTART-ERR: Could not parse -passes-ep-vectorizer-start pipeline: unknown function pass 'bad'
267; RUN: opt -passes-ep-vectorizer-end=bad -passes=no-op-function \
268; RUN:       /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=PASSES-EP-VECTORIZEREND-ERR
269; PASSES-EP-VECTORIZEREND-ERR: Could not parse -passes-ep-vectorizer-end pipeline: unknown function pass 'bad'
270; RUN: opt -passes-ep-pipeline-start=bad -passes=no-op-function \
271; RUN:       /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=PASSES-EP-PIPELINESTART-ERR
272; PASSES-EP-PIPELINESTART-ERR: Could not parse -passes-ep-pipeline-start pipeline: unknown pass name 'bad'
273; RUN: opt -passes-ep-pipeline-early-simplification=bad -passes=no-op-function \
274; RUN:       /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=PASSES-EP-PIPELINEEARLYSIMPLIFICATION-ERR
275; PASSES-EP-PIPELINEEARLYSIMPLIFICATION-ERR: Could not parse -passes-ep-pipeline-early-simplification pipeline: unknown pass name 'bad'
276
277define void @f() {
278entry:
279 br label %loop
280loop:
281 br label %loop
282}
283