1 // RUN: mlir-opt %s -mlir-disable-threading -pass-pipeline='builtin.module(builtin.module(test-module-pass,func.func(test-function-pass)),func.func(test-function-pass),func.func(cse,canonicalize))' -verify-each=false -mlir-timing -mlir-timing-display=tree 2>&1 | FileCheck %s
2 // RUN: mlir-opt %s -mlir-disable-threading -test-textual-pm-nested-pipeline -verify-each=false -mlir-timing -mlir-timing-display=tree 2>&1 | FileCheck %s --check-prefix=TEXTUAL_CHECK
3 // RUN: mlir-opt %s -mlir-disable-threading -pass-pipeline='builtin.module(builtin.module(test-module-pass),any(test-interface-pass),any(test-interface-pass),func.func(test-function-pass),any(canonicalize),func.func(cse))' -verify-each=false -mlir-timing -mlir-timing-display=tree 2>&1 | FileCheck %s --check-prefix=GENERIC_MERGE_CHECK
4 // RUN: mlir-opt %s -mlir-disable-threading -pass-pipeline=' builtin.module ( builtin.module( func.func( test-function-pass, print-op-stats{ json=false } ) ) ) ' -verify-each=false -mlir-timing -mlir-timing-display=tree 2>&1 | FileCheck %s --check-prefix=PIPELINE_STR_WITH_SPACES_CHECK
5 // RUN: not mlir-opt %s -pass-pipeline='any(builtin.module(test-module-pass)' 2>&1 | FileCheck --check-prefix=CHECK_ERROR_1 %s
6 // RUN: not mlir-opt %s -pass-pipeline='builtin.module(test-module-pass))' 2>&1 | FileCheck --check-prefix=CHECK_ERROR_2 %s
7 // RUN: not mlir-opt %s -pass-pipeline='any(builtin.module()()' 2>&1 | FileCheck --check-prefix=CHECK_ERROR_3 %s
8 // RUN: not mlir-opt %s -pass-pipeline='any(,)' 2>&1 | FileCheck --check-prefix=CHECK_ERROR_4 %s
9 // RUN: not mlir-opt %s -pass-pipeline='func.func(test-module-pass)' 2>&1 | FileCheck --check-prefix=CHECK_ERROR_5 %s
11 // CHECK_ERROR_1: encountered unbalanced parentheses while parsing pipeline
12 // CHECK_ERROR_2: encountered extra closing ')' creating unbalanced parentheses while parsing pipeline
13 // CHECK_ERROR_3: expected ',' after parsing pipeline
14 // CHECK_ERROR_4: does not refer to a registered pass or pass pipeline
15 // CHECK_ERROR_5: Can't add pass '{{.*}}TestModulePass' restricted to 'builtin.module' on a PassManager intended to run on 'func.func', did you intend to nest?
17 // RUN: not mlir-opt %s -pass-pipeline='' -cse 2>&1 | FileCheck --check-prefix=CHECK_ERROR_6 %s
18 // CHECK_ERROR_6: '-pass-pipeline' option can't be used with individual pass options
20 // RUN: not mlir-opt %s -pass-pipeline='wrong-op()' 2>&1 | FileCheck --check-prefix=CHECK_ERROR_7 %s
21 // CHECK_ERROR_7: can't run 'wrong-op' pass manager on 'builtin.module' op
23 // RUN: mlir-opt %s -pass-pipeline='any(cse)' -dump-pass-pipeline 2>&1 | FileCheck %s -check-prefix=CHECK_ROUNDTRIP
24 // CHECK_ROUNDTRIP: any(cse)
36 // CHECK: Pipeline Collection : ['builtin.module', 'func.func']
37 // CHECK-NEXT: 'func.func' Pipeline
38 // CHECK-NEXT: TestFunctionPass
40 // CHECK-NEXT: DominanceInfo
41 // CHECK-NEXT: Canonicalizer
42 // CHECK-NEXT: 'builtin.module' Pipeline
43 // CHECK-NEXT: TestModulePass
44 // CHECK-NEXT: 'func.func' Pipeline
45 // CHECK-NEXT: TestFunctionPass
47 // TEXTUAL_CHECK: Pipeline Collection : ['builtin.module', 'func.func']
48 // TEXTUAL_CHECK-NEXT: 'func.func' Pipeline
49 // TEXTUAL_CHECK-NEXT: TestFunctionPass
50 // TEXTUAL_CHECK-NEXT: 'builtin.module' Pipeline
51 // TEXTUAL_CHECK-NEXT: TestModulePass
52 // TEXTUAL_CHECK-NEXT: 'func.func' Pipeline
53 // TEXTUAL_CHECK-NEXT: TestFunctionPass
55 // PIPELINE_STR_WITH_SPACES_CHECK: 'builtin.module' Pipeline
56 // PIPELINE_STR_WITH_SPACES_CHECK-NEXT: 'func.func' Pipeline
57 // PIPELINE_STR_WITH_SPACES_CHECK-NEXT: TestFunctionPass
58 // PIPELINE_STR_WITH_SPACES_CHECK-NEXT: PrintOpStats
60 // Check that generic pass pipelines are only merged when they aren't
61 // going to overlap with op-specific pipelines.
62 // GENERIC_MERGE_CHECK: Pipeline Collection : ['builtin.module', 'any']
63 // GENERIC_MERGE_CHECK-NEXT: 'any' Pipeline
64 // GENERIC_MERGE_CHECK-NEXT: TestInterfacePass
65 // GENERIC_MERGE_CHECK-NEXT: 'builtin.module' Pipeline
66 // GENERIC_MERGE_CHECK-NEXT: TestModulePass
67 // GENERIC_MERGE_CHECK-NEXT: 'any' Pipeline
68 // GENERIC_MERGE_CHECK-NEXT: TestInterfacePass
69 // GENERIC_MERGE_CHECK-NEXT: 'func.func' Pipeline
70 // GENERIC_MERGE_CHECK-NEXT: TestFunctionPass
71 // GENERIC_MERGE_CHECK-NEXT: 'any' Pipeline
72 // GENERIC_MERGE_CHECK-NEXT: Canonicalizer
73 // GENERIC_MERGE_CHECK-NEXT: 'func.func' Pipeline
74 // GENERIC_MERGE_CHECK-NEXT: CSE
75 // GENERIC_MERGE_CHECK-NEXT: (A) DominanceInfo