Debian Codegraph @

flang/test/Lower/OpenMP/DelayedPrivatization/target-private-simple.f90

raw
1 ! Tests delayed privatization for `targets ... private(..)` for simple variables.
2
3 ! RUN: %flang_fc1 -emit-hlfir -fopenmp -mmlir --openmp-enable-delayed-privatization-staging \
4 ! RUN: -o - %s 2>&1 | FileCheck %s
5 ! RUN: bbc -emit-hlfir -fopenmp --openmp-enable-delayed-privatization-staging -o - %s 2>&1 \
6 ! RUN: | FileCheck %s
7
8 subroutine target_simple
9 implicit none
10 integer :: simple_var
11
12 !$omp target private(simple_var)
13 simple_var = 10
14 !$omp end target
15 end subroutine target_simple
16
17 ! CHECK-LABEL: omp.private {type = private}
18 ! CHECK-SAME: @[[VAR_PRIVATIZER_SYM:.*]] : !fir.ref<i32> alloc {
19 ! CHECK: ^bb0(%[[PRIV_ARG:.*]]: !fir.ref<i32>):
20 ! CHECK: %[[PRIV_ALLOC:.*]] = fir.alloca i32 {bindc_name = "simple_var", {{.*}}}
21 ! CHECK: %[[PRIV_DECL:.*]]:2 = hlfir.declare %[[PRIV_ALLOC]]
22 ! CHECK: omp.yield(%[[PRIV_DECL]]#0 : !fir.ref<i32>)
23 ! CHECK: }
24
25 ! CHECK-LABEL: func.func @_QPtarget_simple() {
26 ! CHECK: %[[VAR_ALLOC:.*]] = fir.alloca i32 {bindc_name = "simple_var", {{.*}}}
27 ! CHECK: %[[VAR_DECL:.*]]:2 = hlfir.declare %[[VAR_ALLOC]]
28
29 ! CHECK: omp.target private(
30 ! CHECK-SAME: @[[VAR_PRIVATIZER_SYM]] %[[VAR_DECL]]#0 -> %{{.*}} : !fir.ref<i32>) {
31 ! CHECK: ^bb0(%[[REG_ARG:.*]]: !fir.ref<i32>):
32 ! CHECK: %[[REG_DECL:.*]]:2 = hlfir.declare %[[REG_ARG]]
33 ! CHECK: %[[C10:.*]] = arith.constant 10
34 ! CHECK: hlfir.assign %[[C10]] to %[[REG_DECL]]#0
35 ! CHECK: omp.terminator
36 ! CHECK: }
37
38 ! CHECK: return
39 ! CHECK: }
40