|
| 1 | +// Tests that `fir.local` ops are able to provide an alloca block when required. |
| 2 | + |
| 3 | +// RUN: fir-opt %s -convert-hlfir-to-fir | FileCheck %s |
| 4 | + |
| 5 | +fir.declare_reduction @add_reduction_byref_box_heap_UxUxf32 : !fir.ref<!fir.box<!fir.heap<!fir.array<?x?xf32>>>> alloc { |
| 6 | + %0 = fir.alloca !fir.box<!fir.heap<!fir.array<?x?xf32>>> |
| 7 | + fir.yield(%0 : !fir.ref<!fir.box<!fir.heap<!fir.array<?x?xf32>>>>) |
| 8 | +} init { |
| 9 | +^bb0(%arg0: !fir.ref<!fir.box<!fir.heap<!fir.array<?x?xf32>>>>, %arg1: !fir.ref<!fir.box<!fir.heap<!fir.array<?x?xf32>>>>): |
| 10 | + %cst = arith.constant 0.000000e+00 : f32 |
| 11 | + %0 = fir.load %arg1 : !fir.ref<!fir.box<!fir.heap<!fir.array<?x?xf32>>>> |
| 12 | + hlfir.assign %cst to %0 : f32, !fir.box<!fir.heap<!fir.array<?x?xf32>>> |
| 13 | + fir.yield(%arg1 : !fir.ref<!fir.box<!fir.heap<!fir.array<?x?xf32>>>>) |
| 14 | +} combiner { |
| 15 | +^bb0(%arg0: !fir.ref<!fir.box<!fir.heap<!fir.array<?x?xf32>>>>, %arg1: !fir.ref<!fir.box<!fir.heap<!fir.array<?x?xf32>>>>): |
| 16 | + fir.yield(%arg0 : !fir.ref<!fir.box<!fir.heap<!fir.array<?x?xf32>>>>) |
| 17 | +} |
| 18 | + |
| 19 | +// CHECK-LABEL: fir.declare_reduction @add_reduction_byref_box_heap_UxUxf32 : !fir.ref<!fir.box<!fir.heap<!fir.array<?x?xf32>>>> alloc { |
| 20 | +// CHECK: %[[VAL_0:.*]] = fir.alloca !fir.box<!fir.heap<!fir.array<?x?xf32>>> |
| 21 | +// CHECK: fir.yield(%[[VAL_0]] : !fir.ref<!fir.box<!fir.heap<!fir.array<?x?xf32>>>>) |
| 22 | + |
| 23 | +// CHECK-LABEL: } init { |
| 24 | +// CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref<!fir.box<!fir.heap<!fir.array<?x?xf32>>>>, %[[VAL_1:.*]]: !fir.ref<!fir.box<!fir.heap<!fir.array<?x?xf32>>>>): |
| 25 | +// CHECK: %[[VAL_2:.*]] = fir.alloca !fir.box<!fir.heap<!fir.array<?x?xf32>>> |
| 26 | +// CHECK: fir.yield(%[[VAL_1]] : !fir.ref<!fir.box<!fir.heap<!fir.array<?x?xf32>>>>) |
| 27 | + |
| 28 | +// CHECK-LABEL: } combiner { |
| 29 | +// CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref<!fir.box<!fir.heap<!fir.array<?x?xf32>>>>, %[[VAL_1:.*]]: !fir.ref<!fir.box<!fir.heap<!fir.array<?x?xf32>>>>): |
| 30 | +// CHECK: fir.yield(%[[VAL_0]] : !fir.ref<!fir.box<!fir.heap<!fir.array<?x?xf32>>>>) |
| 31 | +// CHECK: } |
0 commit comments