brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 7af5635 Raw
26 lines · plain
1! Test lowering of transformational intrinsic to HLFIR what matters here2! is not to test each transformational, but to check how their3! lowering interfaces with the rest of lowering.4! RUN: bbc -emit-hlfir -o - %s | FileCheck %s5 6subroutine test_transformational_implemented_with_runtime_allocation(x)7  real :: x(10, 10)8  ! MINLOC result is allocated inside the runtime and returned in9  ! a descriptor that was passed by reference to the runtime.10  ! Lowering goes via a hlfir.minloc intrinsic.11 12  ! After bufferization, this will allow the buffer created by the13  ! runtime to be passed to takes_array_arg without creating any14  ! other temporaries and to be deallocated after the call.15  call takes_array_arg(minloc(x))16end subroutine17! CHECK-LABEL: func.func @_QPtest_transformational_implemented_with_runtime_allocation(18! CHECK-SAME:                                                                          %[[ARG0:.*]]: !fir.ref<!fir.array<10x10xf32>> {fir.bindc_name = "x"}) {19! CHECK:  %[[VAL_1:.*]]:2 = hlfir.declare %[[ARG0]](%{{.*}}) dummy_scope %{{[0-9]+}} arg {{[0-9]+}} {uniq_name = "_QFtest_transformational_implemented_with_runtime_allocationEx"}20! CHECK:  %[[VAL_2:.*]] = hlfir.minloc %[[VAL_1]]#021! CHECK:  %[[VAL_3:.*]] = hlfir.shape_of %[[VAL_2]]22! CHECK:  %[[VAL_4:.*]]:3 = hlfir.associate %[[VAL_2]](%[[VAL_3]]) {adapt.valuebyref}23! CHECK:  fir.call @_QPtakes_array_arg(%[[VAL_4]]#0)24! CHECK:  hlfir.end_associate %[[VAL_4]]#1, %[[VAL_4]]#2 : !fir.ref<!fir.array<2xi32>>, i125! CHECK:  hlfir.destroy %[[VAL_2]] : !hlfir.expr<2xi32>26