38 lines · plain
1// RUN: mlir-opt %s -test-scf-while-op-builder | FileCheck %s2 3// CHECK-LABEL: @testMatchingTypes4func.func @testMatchingTypes(%arg0 : i32) {5 %0 = scf.while (%arg1 = %arg0) : (i32) -> (i32) {6 %c10 = arith.constant 10 : i327 %1 = arith.cmpi slt, %arg1, %c10 : i328 scf.condition(%1) %arg1 : i329 } do {10 ^bb0(%arg1: i32):11 scf.yield %arg1 : i3212 }13 // Expect the same loop twice (the dummy added by the test pass and the14 // original one).15 // CHECK: %[[V0:.*]] = scf.while (%[[arg1:.*]] = %[[arg0:.*]]) : (i32) -> i32 {16 // CHECK: %[[V1:.*]] = scf.while (%[[arg2:.*]] = %[[arg0]]) : (i32) -> i32 {17 return18}19 20// CHECK-LABEL: @testNonMatchingTypes21func.func @testNonMatchingTypes(%arg0 : i32) {22 %c1 = arith.constant 1 : i3223 %c10 = arith.constant 10 : i3224 %0:2 = scf.while (%arg1 = %arg0) : (i32) -> (i32, i32) {25 %1 = arith.cmpi slt, %arg1, %c10 : i3226 scf.condition(%1) %arg1, %c1 : i32, i3227 } do {28 ^bb0(%arg1: i32, %arg2: i32):29 %1 = arith.addi %arg1, %arg2 : i3230 scf.yield %1 : i3231 }32 // Expect the same loop twice (the dummy added by the test pass and the33 // original one).34 // CHECK: %[[V0:.*]] = scf.while (%[[arg1:.*]] = %[[arg0:.*]]) : (i32) -> (i32, i32) {35 // CHECK: %[[V1:.*]] = scf.while (%[[arg2:.*]] = %[[arg0]]) : (i32) -> (i32, i32) {36 return37}38