2019-10-09 06:44:34 +08:00
|
|
|
// RUN: mlir-opt -test-legalize-patterns -test-legalize-mode=full -split-input-file -verify-diagnostics %s | FileCheck %s
|
2019-09-17 01:37:48 +08:00
|
|
|
|
|
|
|
// CHECK-LABEL: func @multi_level_mapping
|
|
|
|
func @multi_level_mapping() {
|
|
|
|
// CHECK: "test.type_producer"() : () -> f64
|
|
|
|
// CHECK: "test.type_consumer"(%{{.*}}) : (f64) -> ()
|
|
|
|
%result = "test.type_producer"() : () -> i32
|
|
|
|
"test.type_consumer"(%result) : (i32) -> ()
|
|
|
|
"test.return"() : () -> ()
|
|
|
|
}
|
2019-10-09 06:44:34 +08:00
|
|
|
|
2019-10-11 03:01:45 +08:00
|
|
|
// 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"() : () -> ()
|
|
|
|
}
|
|
|
|
|
2019-10-09 06:44:34 +08:00
|
|
|
// -----
|
|
|
|
|
|
|
|
// Test that region cloning can be properly undone.
|
|
|
|
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"() : () -> ()
|
|
|
|
}
|