1// RUN: mlir-opt %s -test-scf-while-op-builder | FileCheck %s 2 3// CHECK-LABEL: @testMatchingTypes 4func.func @testMatchingTypes(%arg0 : i32) { 5 %0 = scf.while (%arg1 = %arg0) : (i32) -> (i32) { 6 %c10 = arith.constant 10 : i32 7 %1 = arith.cmpi slt, %arg1, %c10 : i32 8 scf.condition(%1) %arg1 : i32 9 } do { 10 ^bb0(%arg1: i32): 11 scf.yield %arg1 : i32 12 } 13 // Expect the same loop twice (the dummy added by the test pass and the 14 // original one). 15 // CHECK: %[[V0:.*]] = scf.while (%[[arg1:.*]] = %[[arg0:.*]]) : (i32) -> i32 { 16 // CHECK: %[[V1:.*]] = scf.while (%[[arg2:.*]] = %[[arg0]]) : (i32) -> i32 { 17 return 18} 19 20// CHECK-LABEL: @testNonMatchingTypes 21func.func @testNonMatchingTypes(%arg0 : i32) { 22 %c1 = arith.constant 1 : i32 23 %c10 = arith.constant 10 : i32 24 %0:2 = scf.while (%arg1 = %arg0) : (i32) -> (i32, i32) { 25 %1 = arith.cmpi slt, %arg1, %c10 : i32 26 scf.condition(%1) %arg1, %c1 : i32, i32 27 } do { 28 ^bb0(%arg1: i32, %arg2: i32): 29 %1 = arith.addi %arg1, %arg2 : i32 30 scf.yield %1 : i32 31 } 32 // Expect the same loop twice (the dummy added by the test pass and the 33 // original one). 34 // CHECK: %[[V0:.*]] = scf.while (%[[arg1:.*]] = %[[arg0:.*]]) : (i32) -> (i32, i32) { 35 // CHECK: %[[V1:.*]] = scf.while (%[[arg2:.*]] = %[[arg0]]) : (i32) -> (i32, i32) { 36 return 37} 38