32 lines · plain
1// RUN: mlir-opt %s --pass-pipeline='builtin.module(func.func(sroa))' --split-input-file | FileCheck %s2 3// Verifies that allocators with multiple slots are handled properly.4 5// CHECK-LABEL: func.func @multi_slot_alloca6func.func @multi_slot_alloca() -> (i32, i32) {7 %0 = arith.constant 0 : index8 %1, %2 = test.multi_slot_alloca : () -> (memref<2xi32>, memref<4xi32>)9 // CHECK-COUNT-2: test.multi_slot_alloca : () -> memref<i32>10 %3 = memref.load %1[%0] {first}: memref<2xi32>11 %4 = memref.load %2[%0] {second} : memref<4xi32>12 return %3, %4 : i32, i3213}14 15// -----16 17// Verifies that a multi slot allocator can be partially destructured.18 19func.func private @consumer(memref<2xi32>)20 21// CHECK-LABEL: func.func @multi_slot_alloca_only_second22func.func @multi_slot_alloca_only_second() -> (i32, i32) {23 %0 = arith.constant 0 : index24 // CHECK: test.multi_slot_alloca : () -> memref<2xi32>25 // CHECK: test.multi_slot_alloca : () -> memref<i32>26 %1, %2 = test.multi_slot_alloca : () -> (memref<2xi32>, memref<4xi32>)27 func.call @consumer(%1) : (memref<2xi32>) -> ()28 %3 = memref.load %1[%0] : memref<2xi32>29 %4 = memref.load %2[%0] : memref<4xi32>30 return %3, %4 : i32, i3231}32