Andy Ly | 55f2e24 | 2019-08-06 18:08:22 | [diff] [blame] | 1 | // RUN: mlir-opt %s -canonicalize | FileCheck %s |
| 2 | |
Andy Ly | 6a501e3 | 2019-08-26 16:44:09 | [diff] [blame^] | 3 | // CHECK-LABEL: func @remove_op_with_inner_ops_pattern |
| 4 | func @remove_op_with_inner_ops_pattern() { |
Andy Ly | 55f2e24 | 2019-08-06 18:08:22 | [diff] [blame] | 5 | // CHECK-NEXT: return |
Andy Ly | 6a501e3 | 2019-08-26 16:44:09 | [diff] [blame^] | 6 | "test.op_with_region_pattern"() ({ |
Andy Ly | 55f2e24 | 2019-08-06 18:08:22 | [diff] [blame] | 7 | "foo.op_with_region_terminator"() : () -> () |
| 8 | }) : () -> () |
| 9 | return |
| 10 | } |
Andy Ly | 6a501e3 | 2019-08-26 16:44:09 | [diff] [blame^] | 11 | |
| 12 | // CHECK-LABEL: func @remove_op_with_inner_ops_fold_no_side_effect |
| 13 | func @remove_op_with_inner_ops_fold_no_side_effect() { |
| 14 | // CHECK-NEXT: return |
| 15 | "test.op_with_region_fold_no_side_effect"() ({ |
| 16 | "foo.op_with_region_terminator"() : () -> () |
| 17 | }) : () -> () |
| 18 | return |
| 19 | } |
| 20 | |
| 21 | // CHECK-LABEL: func @remove_op_with_inner_ops_fold |
| 22 | // CHECK-SAME: (%[[ARG_0:[a-z0-9]*]]: i32) |
| 23 | func @remove_op_with_inner_ops_fold(%arg0 : i32) -> (i32) { |
| 24 | // CHECK-NEXT: return %[[ARG_0]] |
| 25 | %0 = "test.op_with_region_fold"(%arg0) ({ |
| 26 | "foo.op_with_region_terminator"() : () -> () |
| 27 | }) : (i32) -> (i32) |
| 28 | return %0 : i32 |
| 29 | } |