43 lines · plain
1! Tests `do concurrent` mapping when mapped value(s) depend on values defined2! outside the target region; e.g. the size of the array is dynamic. This needs3! to be handled by localizing these region outsiders by either cloning them in4! the region or in case we cannot do that, map them and use the mapped values.5 6! RUN: %flang_fc1 -emit-hlfir -fopenmp -fdo-concurrent-to-openmp=device %s -o - \7! RUN: | FileCheck %s8 9subroutine foo(n)10 implicit none11 integer :: n12 integer :: i13 integer, dimension(n) :: a14 15 do concurrent(i=1:10)16 a(i) = i17 end do18end subroutine19 20! CHECK-DAG: %[[I_DECL:.*]]:2 = hlfir.declare %{{.*}} {uniq_name = "_QFfooEi"}21! CHECK-DAG: %[[A_DECL:.*]]:2 = hlfir.declare %{{.*}}(%{{.*}}) {uniq_name = "_QFfooEa"}22 23! CHECK-DAG: %[[I_MAP:.*]] = omp.map.info var_ptr(%[[I_DECL]]#1 : {{.*}}) {{.*}} {name = "_QFfooEi"}24! CHECK-DAG: %[[A_MAP:.*]] = omp.map.info var_ptr(%[[A_DECL]]#1 : {{.*}}) {{.*}} {name = "_QFfooEa"}25! CHECK-DAG: %[[N_MAP:.*]] = omp.map.info var_ptr(%{{.*}} : {{.*}}) {{.*}} {name = "_QFfooEa.extent.dim0"}26 27! CHECK: omp.target28! CHECK-SAME: map_entries(29! CHECK-SAME: %{{[[:alnum:]]+}} -> %{{[^,]+}},30! CHECK-SAME: %{{[[:alnum:]]+}} -> %{{[^,]+}},31! CHECK-SAME: %{{[[:alnum:]]+}} -> %{{[^,]+}},32! CHECK-SAME: %[[I_MAP]] -> %[[I_ARG:arg[0-9]*]],33! CHECK-SAME: %[[A_MAP]] -> %[[A_ARG:arg[0-9]*]],34! CHECK-SAME: %[[N_MAP]] -> %[[N_ARG:arg[0-9]*]] : {{.*}})35! CHECK-SAME: {{.*}} {36 37! CHECK-DAG: %{{.*}} = hlfir.declare %[[I_ARG]]38! CHECK-DAG: %{{.*}} = hlfir.declare %[[A_ARG]]39! CHECK-DAG: %{{.*}} = fir.load %[[N_ARG]]40 41! CHECK: omp.terminator42! CHECK: }43