29 lines · plain
1// RUN: mlir-opt %s -test-remapped-value | FileCheck %s2 3// Simple test that exercises ConvertPatternRewriter::getRemappedValue.4 5// CHECK-LABEL: func @remap_input_1_to_16// CHECK-SAME: (%[[ARG:.*]]: i32)7// CHECK-NEXT: %[[VAL:.*]] = "test.one_variadic_out_one_variadic_in1"(%[[ARG]], %[[ARG]])8// CHECK-NEXT: "test.one_variadic_out_one_variadic_in1"(%[[VAL]], %[[VAL]])9 10func.func @remap_input_1_to_1(%arg0: i32) {11 %0 = "test.one_variadic_out_one_variadic_in1"(%arg0) : (i32) -> i3212 %1 = "test.one_variadic_out_one_variadic_in1"(%0) : (i32) -> i3213 "test.return"() : () -> ()14}15 16// Test the case where an operation is converted before its operands are.17 18// CHECK-LABEL: func @remap_unconverted19// CHECK-NEXT: %[[VAL:.*]] = "test.type_producer"() : () -> f6420// CHECK-NEXT: "test.type_consumer"(%[[VAL]]) : (f64)21func.func @remap_unconverted() {22 %region_result = "test.remapped_value_region"() ({23 %result = "test.type_producer"() : () -> f3224 "test.return"(%result) : (f32) -> ()25 }) : () -> (f32)26 "test.type_consumer"(%region_result) : (f32) -> ()27 "test.return"() : () -> ()28}29