Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Lower / OpenMP / threadprivate-use-association-2.f90
blobe07ec420984e3db4de1a8a2951dbfab45799bb48
1 ! This test checks lowering of OpenMP Threadprivate Directive.
2 ! Test for threadprivate variable double use in use association.
4 !RUN: %flang_fc1 -emit-fir -fopenmp %s -o - | FileCheck %s
5 !RUN: bbc -emit-fir -fopenmp %s -o - | FileCheck %s
7 ! CHECK-LABEL: fir.global @_QMmEx : i32
8 module m
9 integer :: x
10 !$omp threadprivate(x)
11 end
13 ! CHECK-LABEL: func.func @_QMm2Ptest() {
14 ! CHECK: %[[VAL_0:.*]] = fir.address_of(@_QMmEx) : !fir.ref<i32>
15 ! CHECK: %[[VAL_1:.*]] = omp.threadprivate %[[VAL_0]] : !fir.ref<i32> -> !fir.ref<i32>
16 ! CHECK: fir.call @_QPbar(%[[VAL_1]]) {{.*}}: (!fir.ref<i32>) -> ()
17 ! CHECK: return
18 ! CHECK: }
20 ! CHECK-LABEL: func.func @_QMm2FtestPinternal_test() {
21 ! CHECK: %[[VAL_0:.*]] = fir.address_of(@_QMmEx) : !fir.ref<i32>
22 ! CHECK: %[[VAL_1:.*]] = omp.threadprivate %[[VAL_0]] : !fir.ref<i32> -> !fir.ref<i32>
23 ! CHECK: fir.call @_QPbar(%[[VAL_1]]) {{.*}}: (!fir.ref<i32>) -> ()
24 ! CHECK: return
25 ! CHECK: }
27 module m2
28 use m
29 contains
30 subroutine test()
31 use m
32 call bar(x)
33 contains
34 subroutine internal_test()
35 use m
36 call bar(x)
37 end
38 end
39 end