aboutsummaryrefslogtreecommitdiff
path: root/mlir/test/Transforms/test-legalizer-full.mlir
diff options
context:
space:
mode:
Diffstat (limited to 'mlir/test/Transforms/test-legalizer-full.mlir')
-rw-r--r--mlir/test/Transforms/test-legalizer-full.mlir86
1 files changed, 11 insertions, 75 deletions
diff --git a/mlir/test/Transforms/test-legalizer-full.mlir b/mlir/test/Transforms/test-legalizer-full.mlir
index 5f1148c..42cec68 100644
--- a/mlir/test/Transforms/test-legalizer-full.mlir
+++ b/mlir/test/Transforms/test-legalizer-full.mlir
@@ -1,4 +1,4 @@
-// RUN: mlir-opt -allow-unregistered-dialect -test-legalize-patterns -test-legalize-mode=full -split-input-file -verify-diagnostics %s | FileCheck %s
+// RUN: mlir-opt -allow-unregistered-dialect -test-legalize-patterns="test-legalize-mode=full" -split-input-file -verify-diagnostics %s | FileCheck %s
// CHECK-LABEL: func @multi_level_mapping
func.func @multi_level_mapping() {
@@ -9,6 +9,8 @@ func.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.func @dropped_region_with_illegal_ops() {
@@ -19,6 +21,9 @@ func.func @dropped_region_with_illegal_ops() {
}) : () -> ()
"test.return"() : () -> ()
}
+
+// -----
+
// CHECK-LABEL: func @replace_non_root_illegal_op
func.func @replace_non_root_illegal_op() {
// CHECK-NEXT: "test.legal_op_b"
@@ -30,15 +35,20 @@ func.func @replace_non_root_illegal_op() {
// -----
// Test that children of recursively legal operations are ignored.
+
+// CHECK-LABEL: func @recursively_legal_invalid_op
func.func @recursively_legal_invalid_op() {
/// Operation that is statically legal.
builtin.module attributes {test.recursively_legal} {
+ // CHECK: "test.illegal_op_f"
%ignored = "test.illegal_op_f"() : () -> (i32)
}
/// Operation that is dynamically legal, i.e. the function has a pattern
/// applied to legalize the argument type before it becomes recursively legal.
builtin.module {
+ // CHECK: func @dynamic_func(%{{.*}}: f64)
func.func @dynamic_func(%arg: i64) attributes {test.recursively_legal} {
+ // CHECK: "test.illegal_op_f"
%ignored = "test.illegal_op_f"() : () -> (i32)
"test.return"() : () -> ()
}
@@ -52,25 +62,6 @@ func.func @recursively_legal_invalid_op() {
// expected-remark@+1 {{applyFullConversion failed}}
builtin.module {
- // Test that region cloning can be properly undone.
- func.func @test_undo_region_clone() {
- "test.region"() ({
- ^bb1(%i0: i64):
- "test.invalid"(%i0) : (i64) -> ()
- }) {legalizer.should_clone} : () -> ()
-
- // expected-error@+1 {{failed to legalize operation 'test.illegal_op_f'}}
- %ignored = "test.illegal_op_f"() : () -> (i32)
- "test.return"() : () -> ()
- }
-
-}
-
-// -----
-
-// expected-remark@+1 {{applyFullConversion failed}}
-builtin.module {
-
// Test that unknown operations can be dynamically legal.
func.func @test_unknown_dynamically_legal() {
"foo.unknown_op"() {test.dynamically_legal} : () -> ()
@@ -81,58 +72,3 @@ builtin.module {
}
}
-
-// -----
-
-// expected-remark@+1 {{applyFullConversion failed}}
-builtin.module {
-
- // Test that region inlining can be properly undone.
- func.func @test_undo_region_inline() {
- "test.region"() ({
- ^bb1(%i0: i64):
- // expected-error@+1 {{failed to legalize operation 'cf.br'}}
- cf.br ^bb2(%i0 : i64)
- ^bb2(%i1: i64):
- "test.invalid"(%i1) : (i64) -> ()
- }) {} : () -> ()
-
- "test.return"() : () -> ()
- }
-
-}
-
-// -----
-
-// expected-remark@+1 {{applyFullConversion failed}}
-builtin.module {
-
- // Test that multiple block erases can be properly undone.
- func.func @test_undo_block_erase() {
- // expected-error@+1 {{failed to legalize operation 'test.region'}}
- "test.region"() ({
- ^bb1(%i0: i64):
- cf.br ^bb3(%i0 : i64)
- ^bb2(%i1: i64):
- "test.invalid"(%i1) : (i64) -> ()
- ^bb3(%i2: i64):
- cf.br ^bb2(%i2 : i64)
- }) {legalizer.should_clone, legalizer.erase_old_blocks} : () -> ()
-
- "test.return"() : () -> ()
- }
-
-}
-
-// -----
-
-// expected-remark@+1 {{applyFullConversion failed}}
-builtin.module {
-
- func.func @create_unregistered_op_in_pattern() -> i32 {
- // expected-error@+1 {{failed to legalize operation 'test.illegal_op_g'}}
- %0 = "test.illegal_op_g"() : () -> (i32)
- "test.return"(%0) : (i32) -> ()
- }
-
-}