40 lines · plain
1! Test delayed privatization for variables that are storage associated via `EQUIVALENCE`.2 3! RUN: %flang_fc1 -emit-hlfir -fopenmp -mmlir --enable-delayed-privatization \4! RUN: -o - %s 2>&1 | FileCheck %s5! RUN: bbc -emit-hlfir -fopenmp --enable-delayed-privatization -o - %s 2>&1 \6! RUN: | FileCheck %s7 8subroutine private_common9 real x, y10 equivalence (x,y)11 !$omp parallel firstprivate(x)12 x = 3.1413 !$omp end parallel14end subroutine15 16! TODO: the copy region for pointers is incorrect. OpenMP 5.2 says17!18! > If the original list item has the POINTER attribute, the new list items19! > receive the same association status as the original list item20!21! Currently the original pointer is unconditionally loaded, which is undefined22! behavior if that pointer is not associated.23 24! CHECK: omp.private {type = firstprivate} @[[X_PRIVATIZER:.*]] : ![[X_TYPE:fir.ptr<f32>]] copy {25! CHECK: ^bb0(%[[ORIG_PTR:.*]]: ![[X_TYPE]], %[[PRIV_REF:.*]]: ![[X_TYPE]]):26! CHECK: %[[ORIG_VAL:.*]] = fir.load %[[ORIG_PTR]] : !fir.ptr<f32>27! CHECK: hlfir.assign %[[ORIG_VAL]] to %[[PRIV_REF]] : f32, ![[X_TYPE]]28! CHECK: omp.yield(%[[PRIV_REF]] : ![[X_TYPE]])29! CHECK: }30 31! CHECK: func.func @_QPprivate_common() {32! CHECK: omp.parallel private(@[[X_PRIVATIZER]] %{{.*}}#0 -> %[[PRIV_ARG:.*]] : ![[X_TYPE]]) {33! CHECK: %[[REG_DECL:.*]]:2 = hlfir.declare %[[PRIV_ARG]] {{{.*}}} : (![[X_TYPE]]) -> ({{.*}})34! CHECK: %[[CST:.*]] = arith.constant {{.*}}35! CHECK: hlfir.assign %[[CST]] to %[[REG_DECL]]#0 : {{.*}}36! CHECK: omp.terminator37! CHECK: }38! CHECK: return39! CHECK: }40