brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.3 KiB · 1746163 Raw
61 lines · plain
1// Run the canonicalize on each function, use the --log-mlir-actions-filter= option2// to filter which action should be logged.3 4func.func @a() {5    return6}7 8func.func @b() {9    return10}11 12func.func @c() {13    return14}15 16////////////////////////////////////17/// 1. All actions should be logged.18 19// RUN: mlir-opt %s --log-actions-to=- -pass-pipeline="builtin.module(func.func(test-stats-pass))" -o %t --mlir-disable-threading | FileCheck %s20// Specify the current file as filter, expect to see all actions.21// RUN: mlir-opt %s --log-mlir-actions-filter=%s --log-actions-to=- -pass-pipeline="builtin.module(func.func(test-stats-pass))" -o %t --mlir-disable-threading | FileCheck %s22 23// CHECK: [thread {{.*}}] begins (no breakpoint) Action `pass-execution`  running `{{.*}}TestStatisticPass` on Operation `func.func` (func.func @a() {...}24// CHECK-NEXT: [thread {{.*}}] completed `pass-execution`25// CHECK-NEXT: [thread {{.*}}] begins (no breakpoint) Action `pass-execution`  running `{{.*}}TestStatisticPass` on Operation `func.func` (func.func @b() {...}26// CHECK-NEXT: [thread {{.*}}] completed `pass-execution`27// CHECK-NEXT: [thread {{.*}}] begins (no breakpoint) Action `pass-execution`  running `{{.*}}TestStatisticPass` on Operation `func.func` (func.func @c() {...}28// CHECK-NEXT: [thread {{.*}}] completed `pass-execution`29 30////////////////////////////////////31/// 2. No match32 33// Specify a non-existing file as filter, expect to see no actions.34// RUN: mlir-opt %s --log-mlir-actions-filter=foo.mlir --log-actions-to=- -pass-pipeline="builtin.module(func.func(test-stats-pass))" -o %t --mlir-disable-threading | FileCheck %s --check-prefix=CHECK-NONE --allow-empty35// Filter on a non-matching line, expect to see no actions.36// RUN: mlir-opt %s --log-mlir-actions-filter=%s:1 --log-actions-to=- -pass-pipeline="builtin.module(func.func(test-stats-pass))" -o %t --mlir-disable-threading | FileCheck %s --check-prefix=CHECK-NONE --allow-empty37 38// Invalid Filter39// CHECK-NONE-NOT: Canonicalizer40 41////////////////////////////////////42/// 3. Matching filters43 44// Filter the second function only45// RUN: mlir-opt %s --log-mlir-actions-filter=%s:8 --log-actions-to=- -pass-pipeline="builtin.module(func.func(test-stats-pass))" -o %t --mlir-disable-threading | FileCheck %s --check-prefix=CHECK-SECOND46 47// CHECK-SECOND-NOT: @a48// CHECK-SECOND-NOT: @c49// CHECK-SECOND: [thread {{.*}}] begins (no breakpoint) Action `pass-execution`  running `{{.*}}TestStatisticPass` on Operation `func.func` (func.func @b() {...}50// CHECK-SECOND-NEXT: [thread {{.*}}] completed `pass-execution`51 52// Filter the first and third functions53// RUN: mlir-opt %s --log-mlir-actions-filter=%s:4,%s:12 --log-actions-to=- -pass-pipeline="builtin.module(func.func(test-stats-pass))" -o %t --mlir-disable-threading | FileCheck %s  --check-prefix=CHECK-FIRST-THIRD54 55// CHECK-FIRST-THIRD-NOT: Canonicalizer56// CHECK-FIRST-THIRD: [thread {{.*}}] begins (no breakpoint) Action `pass-execution`  running `{{.*}}TestStatisticPass` on Operation `func.func` (func.func @a() {...}57// CHECK-FIRST-THIRD-NEXT: [thread {{.*}}] completed `pass-execution`58// CHECK-FIRST-THIRD-NEXT: [thread {{.*}}] begins (no breakpoint) Action `pass-execution`  running `{{.*}}TestStatisticPass` on Operation `func.func` (func.func @c() {...}59// CHECK-FIRST-THIRD-NEXT: [thread {{.*}}] completed `pass-execution`60// CHECK-FIRST-THIRD-NOT: Canonicalizer61