diff options
| author | River Riddle <riverriddle@google.com> | 2019-10-10 12:01:45 -0700 |
|---|---|---|
| committer | Jacques Pienaar <jpienaar@google.com> | 2019-10-10 17:06:25 -0700 |
| commit | 438dc176b14dca318fb6c69250b1ec12666501d2 (patch) | |
| tree | 65810209b688c2ed7701294d93b480b8951794fa /mlir/test/Transforms | |
| parent | ea34c2a7a4eba46a1ab7d81ed6c6159b852510da (diff) | |
| download | bcm5719-llvm-438dc176b14dca318fb6c69250b1ec12666501d2.tar.gz bcm5719-llvm-438dc176b14dca318fb6c69250b1ec12666501d2.zip | |
Remove the need to convert operations in regions of operations that have been replaced.
When an operation with regions gets replaced, we currently require that all of the remaining nested operations are still converted even though they are going to be replaced when the rewrite is finished. This cl adds a tracking for a minimal set of operations that are known to be "dead". This allows for ignoring the legalization of operations that are won't survive after conversion.
PiperOrigin-RevId: 274009003
Diffstat (limited to 'mlir/test/Transforms')
| -rw-r--r-- | mlir/test/Transforms/test-legalizer-full.mlir | 11 | ||||
| -rw-r--r-- | mlir/test/Transforms/test-legalizer.mlir | 4 |
2 files changed, 13 insertions, 2 deletions
diff --git a/mlir/test/Transforms/test-legalizer-full.mlir b/mlir/test/Transforms/test-legalizer-full.mlir index 8d0ba3e89ce..79494c798e1 100644 --- a/mlir/test/Transforms/test-legalizer-full.mlir +++ b/mlir/test/Transforms/test-legalizer-full.mlir @@ -9,6 +9,17 @@ func @multi_level_mapping() { "test.return"() : () -> () } +// Test that operations that are erased don't need to be legalized. +// CHECK-LABEL: func @dropped_region_with_illegal_ops +func @dropped_region_with_illegal_ops() { + // CHECK-NEXT: test.return + "test.drop_op"() ({ + %ignored = "test.illegal_op_f"() : () -> (i32) + "test.return"() : () -> () + }) : () -> () + "test.return"() : () -> () +} + // ----- // Test that region cloning can be properly undone. diff --git a/mlir/test/Transforms/test-legalizer.mlir b/mlir/test/Transforms/test-legalizer.mlir index 36901450545..1e563257902 100644 --- a/mlir/test/Transforms/test-legalizer.mlir +++ b/mlir/test/Transforms/test-legalizer.mlir @@ -136,9 +136,9 @@ func @fail_to_convert_illegal_op_in_region() { // CHECK-LABEL: func @fail_to_convert_region func @fail_to_convert_region() { - // CHECK-NEXT: "test.drop_op" + // CHECK-NEXT: "test.region" // CHECK-NEXT: ^bb{{.*}}(%{{.*}}: i64): - "test.drop_op"() ({ + "test.region"() ({ ^bb1(%i0: i64): // expected-error@+1 {{failed to legalize operation 'test.region_builder'}} "test.region_builder"() : () -> () |

