1// RUN: mlir-opt %s -pass-pipeline='module(test-dynamic-pipeline{op-name=inner_mod1, dynamic-pipeline=func(cse,canonicalize)})'  --mlir-disable-threading  -print-ir-before-all 2>&1 | FileCheck %s --check-prefix=MOD1 --check-prefix=MOD1-ONLY --check-prefix=CHECK
2// RUN: mlir-opt %s -pass-pipeline='module(test-dynamic-pipeline{op-name=inner_mod2, dynamic-pipeline=func(cse,canonicalize)})'  --mlir-disable-threading  -print-ir-before-all 2>&1 | FileCheck %s --check-prefix=MOD2 --check-prefix=MOD2-ONLY --check-prefix=CHECK
3// RUN: mlir-opt %s -pass-pipeline='module(test-dynamic-pipeline{op-name=inner_mod1,inner_mod2, dynamic-pipeline=func(cse,canonicalize)})'  --mlir-disable-threading  -print-ir-before-all 2>&1 | FileCheck %s --check-prefix=MOD1 --check-prefix=MOD2 --check-prefix=CHECK
4// RUN: mlir-opt %s -pass-pipeline='module(test-dynamic-pipeline{dynamic-pipeline=func(cse,canonicalize)})'  --mlir-disable-threading  -print-ir-before-all 2>&1 | FileCheck %s --check-prefix=MOD1 --check-prefix=MOD2 --check-prefix=CHECK
5
6
7func @f() {
8  return
9}
10
11// CHECK: IR Dump Before
12// CHECK-SAME: TestDynamicPipelinePass
13// CHECK-NEXT: module @inner_mod1
14// MOD2-ONLY: dynamic-pipeline skip op name: inner_mod1
15module @inner_mod1 {
16// MOD1: Dump Before CSE
17// MOD1-NEXT: @foo
18// MOD1: Dump Before Canonicalizer
19// MOD1-NEXT: @foo
20  func @foo() {
21    return
22  }
23// MOD1: Dump Before CSE
24// MOD1-NEXT: @baz
25// MOD1: Dump Before Canonicalizer
26// MOD1-NEXT: @baz
27  func @baz() {
28    return
29  }
30}
31
32// CHECK: IR Dump Before
33// CHECK-SAME: TestDynamicPipelinePass
34// CHECK-NEXT: module @inner_mod2
35// MOD1-ONLY: dynamic-pipeline skip op name: inner_mod2
36module @inner_mod2 {
37// MOD2: Dump Before CSE
38// MOD2-NEXT: @foo
39// MOD2: Dump Before Canonicalizer
40// MOD2-NEXT: @foo
41  func @foo() {
42    return
43  }
44}
45