41 lines · plain
1! Tests that when a loop bound is used in the body, that the mapped version of2! the loop bound (rather than the host-eval one) is the one used inside the loop.3 4! RUN: %flang_fc1 -emit-hlfir -fopenmp -fdo-concurrent-to-openmp=device %s -o - \5! RUN: | FileCheck %s6! RUN: bbc -emit-hlfir -fopenmp -fdo-concurrent-to-openmp=device %s -o - \7! RUN: | FileCheck %s8 9subroutine foo(a, n)10 implicit none11 integer :: i, n12 real, dimension(n) :: a13 14 do concurrent (i=1:n)15 a(i) = n16 end do17end subroutine18 19! CHECK-LABEL: func.func @_QPfoo20! CHECK: omp.target21! CHECK-SAME: host_eval(%{{.*}} -> %{{.*}}, %{{.*}} -> %[[N_HOST_EVAL:.*]], %{{.*}} -> %{{.*}} : index, index, index)22! CHECK-SAME: map_entries({{[^[:space:]]*}} -> {{[^[:space:]]*}},23! CHECK-SAME: {{[^[:space:]]*}} -> {{[^[:space:]]*}}, {{[^[:space:]]*}} -> {{[^[:space:]]*}},24! CHECK-SAME: {{[^[:space:]]*}} -> {{[^[:space:]]*}}, {{[^[:space:]]*}} -> %[[N_MAP_ARG:[^[:space:]]*]], {{.*}}) {25! CHECK: %[[N_MAPPED:.*]]:2 = hlfir.declare %[[N_MAP_ARG]] {uniq_name = "_QFfooEn"}26! CHECK: omp.teams {27! CHECK: omp.parallel {28! CHECK: omp.distribute {29! CHECK: omp.wsloop {30! CHECK: omp.loop_nest (%{{.*}}) : index = (%{{.*}}) to (%[[N_HOST_EVAL]]) inclusive step (%{{.*}}) {31! CHECK: %[[N_VAL:.*]] = fir.load %[[N_MAPPED]]#0 : !fir.ref<i32>32! CHECK: %[[N_VAL_CVT:.*]] = fir.convert %[[N_VAL]] : (i32) -> f3233! CHECK: hlfir.assign %[[N_VAL_CVT]] to {{.*}}34! CHECK-NEXT: omp.yield35! CHECK: }36! CHECK: }37! CHECK: }38! CHECK: }39! CHECK: }40! CHECK: }41