brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.3 KiB · 82dd742 Raw
68 lines · plain
1// RUN: mlir-opt -allow-unregistered-dialect -split-input-file -test-legalize-patterns="allow-pattern-rollback=0 build-materializations=0 attach-debug-materialization-kind=1" -verify-diagnostics %s | FileCheck %s --check-prefix=CHECK-KIND2 3// CHECK-LABEL: func @dropped_input_in_use4// CHECK-KIND-LABEL: func @dropped_input_in_use5func.func @dropped_input_in_use(%arg: i16, %arg2: i64) {6  // CHECK-NEXT: %[[cast:.*]] = "test.cast"() : () -> i167  // CHECK-NEXT: "work"(%[[cast]]) : (i16)8  // CHECK-KIND-NEXT: %[[cast:.*]] = builtin.unrealized_conversion_cast to i16 {__kind__ = "source"}9  // CHECK-KIND-NEXT: "work"(%[[cast]]) : (i16)10  // expected-remark@+1 {{op 'work' is not legalizable}}11  "work"(%arg) : (i16) -> ()12}13 14// -----15 16// CHECK-KIND-LABEL: func @test_lookup_without_converter17//       CHECK-KIND:   %[[producer:.*]] = "test.valid_producer"() : () -> i1618//       CHECK-KIND:   %[[cast:.*]] = builtin.unrealized_conversion_cast %[[producer]] : i16 to f64 {__kind__ = "target"}19//       CHECK-KIND:   "test.valid_consumer"(%[[cast]]) : (f64) -> ()20//       CHECK-KIND:   "test.valid_consumer"(%[[producer]]) : (i16) -> ()21func.func @test_lookup_without_converter() {22  %0 = "test.replace_with_valid_producer"() {type = i16} : () -> (i64)23  "test.replace_with_valid_consumer"(%0) {with_converter} : (i64) -> ()24  // Make sure that the second "replace_with_valid_consumer" lowering does not25  // lookup the materialization that was created for the above op.26  "test.replace_with_valid_consumer"(%0) : (i64) -> ()27  // expected-remark@+1 {{op 'func.return' is not legalizable}}28  return29}30 31// -----32 33// CHECK-LABEL: func @remap_moved_region_args34func.func @remap_moved_region_args() {35  // CHECK-NEXT: return36  // CHECK-NEXT: ^bb1(%[[arg0:.*]]: i64, %[[arg1:.*]]: i16, %[[arg2:.*]]: i64, %[[arg3:.*]]: f32):37  // CHECK-NEXT: %[[cast1:.*]]:2 = builtin.unrealized_conversion_cast %[[arg3]] : f32 to f16, f1638  // CHECK-NEXT: %[[cast2:.*]] = builtin.unrealized_conversion_cast %[[arg2]] : i64 to f6439  // CHECK-NEXT: %[[cast3:.*]] = builtin.unrealized_conversion_cast %[[arg0]] : i64 to f6440  // CHECK-NEXT: %[[cast4:.*]] = "test.cast"(%[[cast1]]#0, %[[cast1]]#1) : (f16, f16) -> f3241  // CHECK-NEXT: "test.valid"(%[[cast3]], %[[cast2]], %[[cast4]]) : (f64, f64, f32)42  "test.region"() ({43    ^bb1(%i0: i64, %unused: i16, %i1: i64, %2: f32):44      "test.invalid"(%i0, %i1, %2) : (i64, i64, f32) -> ()45  }) : () -> ()46  // expected-remark@+1 {{op 'func.return' is not legalizable}}47  return48}49 50// -----51 52// CHECK-LABEL: func @remap_cloned_region_args53func.func @remap_cloned_region_args() {54  // CHECK-NEXT: return55  // CHECK-NEXT: ^bb1(%[[arg0:.*]]: i64, %[[arg1:.*]]: i16, %[[arg2:.*]]: i64, %[[arg3:.*]]: f32):56  // CHECK-NEXT: %[[cast1:.*]]:2 = builtin.unrealized_conversion_cast %[[arg3]] : f32 to f16, f1657  // CHECK-NEXT: %[[cast2:.*]] = builtin.unrealized_conversion_cast %[[arg2]] : i64 to f6458  // CHECK-NEXT: %[[cast3:.*]] = builtin.unrealized_conversion_cast %[[arg0]] : i64 to f6459  // CHECK-NEXT: %[[cast4:.*]] = "test.cast"(%[[cast1]]#0, %[[cast1]]#1) : (f16, f16) -> f3260  // CHECK-NEXT: "test.valid"(%[[cast3]], %[[cast2]], %[[cast4]]) : (f64, f64, f32)61  "test.region"() ({62    ^bb1(%i0: i64, %unused: i16, %i1: i64, %2: f32):63      "test.invalid"(%i0, %i1, %2) : (i64, i64, f32) -> ()64  }) {legalizer.should_clone} : () -> ()65  // expected-remark@+1 {{op 'func.return' is not legalizable}}66  return67}68