// RUN: fir-opt -flang-licm --split-input-file %s | FileCheck %s // Test that the box is qualified as present when it is // passed through arguments of acc.compute_region. // CHECK-LABEL: func.func @test_( // CHECK-SAME: %[[ARG0:.*]]: !fir.box> {fir.bindc_name = "x"}, // CHECK-SAME: %[[ARG1:.*]]: index {fir.bindc_name = "n"}) { // CHECK: %[[DUMMY_SCOPE_0:.*]] = fir.dummy_scope : !fir.dscope // CHECK: %[[DECLARE_0:.*]] = fir.declare %[[ARG0]] dummy_scope %[[DUMMY_SCOPE_0]] arg 1 {uniq_name = "_QFtestEx"} : (!fir.box>, !fir.dscope) -> !fir.box> // CHECK: %[[REBOX_0:.*]] = fir.rebox %[[DECLARE_0]] : (!fir.box>) -> !fir.box> // CHECK: %[[COPYIN_0:.*]] = acc.copyin var(%[[REBOX_0]] : !fir.box>) -> !fir.box> {dataClause = #acc, implicit = true, name = "x"} // CHECK: acc.kernel_environment dataOperands(%[[COPYIN_0]] : !fir.box>) { // CHECK: acc.compute_region ins(%[[VAL_0:.*]] = %[[ARG1]], %[[VAL_1:.*]] = %[[COPYIN_0]]) : (index, !fir.box>) { // CHECK: %[[BOX_ADDR_0:.*]] = fir.box_addr %[[VAL_1]] : (!fir.box>) -> !fir.ref> // CHECK: %[[CONVERT_0:.*]] = fir.convert %[[BOX_ADDR_0]] : (!fir.ref>) -> memref // CHECK: %[[BOX_DIMS_0:.*]]:3 = fir.box_dims %[[VAL_1]], %{{.*}} : (!fir.box>, index) -> (index, index, index) // CHECK: scf.for %[[VAL_2:.*]] = {{.*}} { // CHECK: %[[BOX_ELESIZE_0:.*]] = fir.box_elesize %[[VAL_1]] : (!fir.box>) -> index // CHECK: %[[DIVSI_0:.*]] = arith.divsi %[[BOX_DIMS_0]]#2, %[[BOX_ELESIZE_0]] : index // CHECK: %[[REINTERPRET_CAST_0:.*]] = memref.reinterpret_cast %[[CONVERT_0]] to offset: [0], sizes: {{\[}}%[[BOX_DIMS_0]]#1], strides: {{\[}}%[[DIVSI_0]]] : memref to memref> // CHECK: memref.store %{{.*}}, %[[REINTERPRET_CAST_0]]{{\[}}%[[VAL_2]]] : memref> // CHECK: } // CHECK: acc.yield // CHECK: } {origin = "acc.kernels"} // CHECK: } // CHECK: acc.copyout accVar(%[[COPYIN_0]] : !fir.box>) to var(%[[REBOX_0]] : !fir.box>) {dataClause = #acc, implicit = true, name = "x"} // CHECK: return // CHECK: } func.func @test_(%arg0: !fir.box> {fir.bindc_name = "x"}, %arg1: index {fir.bindc_name = "n"}) { %0 = fir.dummy_scope : !fir.dscope %4 = fir.declare %arg0 dummy_scope %0 arg 1 {uniq_name = "_QFtestEx"} : (!fir.box>, !fir.dscope) -> !fir.box> %5 = fir.rebox %4 : (!fir.box>) -> !fir.box> %7 = acc.copyin var(%5 : !fir.box>) -> !fir.box> {dataClause = #acc, implicit = true, name = "x"} acc.kernel_environment dataOperands(%7 : !fir.box>) { acc.compute_region ins(%arg2 = %arg1, %arg3 = %7) : (index, !fir.box>) { %c1 = arith.constant 1 : index %cst = arith.constant 0.000000e+00 : f32 %c0 = arith.constant 0 : index scf.for %arg4 = %c0 to %arg2 step %c1 { %13 = fir.box_addr %arg3 : (!fir.box>) -> !fir.ref> %14 = fir.convert %13 : (!fir.ref>) -> memref %17 = fir.box_elesize %arg3 : (!fir.box>) -> index %18:3 = fir.box_dims %arg3, %c0 : (!fir.box>, index) -> (index, index, index) %19 = arith.divsi %18#2, %17 : index %reinterpret_cast = memref.reinterpret_cast %14 to offset: [0], sizes: [%18#1], strides: [%19] : memref to memref> memref.store %cst, %reinterpret_cast[%arg4] : memref> } acc.yield } {origin = "acc.kernels"} } acc.copyout accVar(%7 : !fir.box>) to var(%5 : !fir.box>) {dataClause = #acc, implicit = true, name = "x"} return }