[clangd] Re-land "support outgoing calls in call hierarchy" (#117673)
[llvm-project.git] / flang / test / Semantics / OpenMP / implicit-dsa.f90
bloba7ed834b0f1c60b9265224450506a9dc2d8938cd
1 ! RUN: %python %S/../test_symbols.py %s %flang_fc1 -fopenmp
3 ! Test symbols generated in block constructs that have implicitly
4 ! determined DSAs.
6 ! Basic cases.
7 !DEF: /implicit_dsa_test1 (Subroutine) Subprogram
8 subroutine implicit_dsa_test1
9 !DEF: /implicit_dsa_test1/i ObjectEntity INTEGER(4)
10 !DEF: /implicit_dsa_test1/x ObjectEntity INTEGER(4)
11 !DEF: /implicit_dsa_test1/y ObjectEntity INTEGER(4)
12 !DEF: /implicit_dsa_test1/z ObjectEntity INTEGER(4)
13 integer i, x, y, z
15 !$omp task private(y) shared(z)
16 !DEF: /implicit_dsa_test1/OtherConstruct1/x (OmpFirstPrivate, OmpImplicit) HostAssoc INTEGER(4)
17 !DEF: /implicit_dsa_test1/OtherConstruct1/y (OmpPrivate) HostAssoc INTEGER(4)
18 !DEF: /implicit_dsa_test1/OtherConstruct1/z (OmpShared) HostAssoc INTEGER(4)
19 x = y + z
20 !$omp end task
22 !$omp task default(shared)
23 !DEF: /implicit_dsa_test1/OtherConstruct2/x HostAssoc INTEGER(4)
24 !DEF: /implicit_dsa_test1/OtherConstruct2/y HostAssoc INTEGER(4)
25 !DEF: /implicit_dsa_test1/OtherConstruct2/z HostAssoc INTEGER(4)
26 x = y + z
27 !$omp end task
29 !$omp taskloop
30 !DEF: /implicit_dsa_test1/OtherConstruct3/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
31 do i = 0, 10
32 !DEF: /implicit_dsa_test1/OtherConstruct3/x (OmpFirstPrivate, OmpImplicit) HostAssoc INTEGER(4)
33 !DEF: /implicit_dsa_test1/OtherConstruct3/y (OmpFirstPrivate, OmpImplicit) HostAssoc INTEGER(4)
34 !REF: /implicit_dsa_test1/OtherConstruct3/i
35 x = y + i
36 end do
37 !$omp end taskloop
38 end subroutine
40 ! Nested task with implicit firstprivate DSA variable.
41 !DEF: /implicit_dsa_test2 (Subroutine) Subprogram
42 subroutine implicit_dsa_test2
43 !DEF: /implicit_dsa_test2/x ObjectEntity INTEGER(4)
44 integer x
46 !$omp task
47 !$omp task
48 !DEF: /implicit_dsa_test2/OtherConstruct1/OtherConstruct1/x (OmpFirstPrivate, OmpImplicit) HostAssoc INTEGER(4)
49 x = 1
50 !$omp end task
51 !$omp end task
52 end subroutine
54 ! Nested tasks with implicit shared DSA variables.
55 !DEF: /implicit_dsa_test3 (Subroutine) Subprogram
56 subroutine implicit_dsa_test3
57 !DEF: /implicit_dsa_test3/x ObjectEntity INTEGER(4)
58 !DEF: /implicit_dsa_test3/y ObjectEntity INTEGER(4)
59 !DEF: /implicit_dsa_test3/z ObjectEntity INTEGER(4)
60 integer x, y, z
62 !$omp parallel
63 !$omp task
64 !DEF: /implicit_dsa_test3/OtherConstruct1/OtherConstruct1/x HostAssoc INTEGER(4)
65 x = 1
66 !DEF: /implicit_dsa_test3/OtherConstruct1/OtherConstruct1/y HostAssoc INTEGER(4)
67 y = 1
68 !$omp end task
70 !$omp task firstprivate(x)
71 !DEF: /implicit_dsa_test3/OtherConstruct1/OtherConstruct2/x (OmpFirstPrivate) HostAssoc INTEGER(4)
72 x = 1
73 !DEF: /implicit_dsa_test3/OtherConstruct1/OtherConstruct2/z HostAssoc INTEGER(4)
74 z = 1
75 !$omp end task
76 !$omp end parallel
77 end subroutine
79 ! Task with implicit firstprivate DSA variables, enclosed in private context.
80 !DEF: /implicit_dsa_test4 (Subroutine) Subprogram
81 subroutine implicit_dsa_test4
82 !DEF: /implicit_dsa_test4/x ObjectEntity INTEGER(4)
83 !DEF: /implicit_dsa_test4/y ObjectEntity INTEGER(4)
84 !DEF: /implicit_dsa_test4/z ObjectEntity INTEGER(4)
85 integer x, y, z
87 !$omp parallel default(private)
88 !$omp task
89 !DEF: /implicit_dsa_test4/OtherConstruct1/OtherConstruct1/x (OmpFirstPrivate, OmpImplicit) HostAssoc INTEGER(4)
90 x = 0
91 !DEF: /implicit_dsa_test4/OtherConstruct1/OtherConstruct1/z (OmpFirstPrivate, OmpImplicit) HostAssoc INTEGER(4)
92 z = 1
93 !$omp end task
95 !$omp task
96 !DEF: /implicit_dsa_test4/OtherConstruct1/OtherConstruct2/x (OmpFirstPrivate, OmpImplicit) HostAssoc INTEGER(4)
97 x = 1
98 !DEF: /implicit_dsa_test4/OtherConstruct1/OtherConstruct2/y (OmpFirstPrivate, OmpImplicit) HostAssoc INTEGER(4)
99 y = 0
100 !$omp end task
101 !$omp end parallel
102 end subroutine
104 ! Inner parallel using implicit firstprivate symbol.
105 !DEF: /implicit_dsa_test5 (Subroutine) Subprogram
106 subroutine implicit_dsa_test5
107 !DEF: /implicit_dsa_test5/x ObjectEntity INTEGER(4)
108 integer x
110 !$omp parallel default(private)
111 !$omp task
112 !$omp parallel
113 !DEF: /implicit_dsa_test5/OtherConstruct1/OtherConstruct1/OtherConstruct1/x HostAssoc INTEGER(4)
114 x = 1
115 !$omp end parallel
116 !$omp end task
117 !$omp end parallel
118 end subroutine
120 ! Constructs nested inside a task with implicit DSA variables.
121 !DEF: /implicit_dsa_test6 (Subroutine) Subprogram
122 subroutine implicit_dsa_test6
123 !DEF: /implicit_dsa_test6/x ObjectEntity INTEGER(4)
124 !DEF: /implicit_dsa_test6/y ObjectEntity INTEGER(4)
125 !DEF: /implicit_dsa_test6/z ObjectEntity INTEGER(4)
126 integer x, y, z
128 !$omp task
129 !$omp parallel default(private)
130 !DEF: /implicit_dsa_test6/OtherConstruct1/OtherConstruct1/x (OmpPrivate) HostAssoc INTEGER(4)
131 !DEF: /implicit_dsa_test6/OtherConstruct1/OtherConstruct1/y (OmpPrivate) HostAssoc INTEGER(4)
132 x = y
133 !$omp end parallel
135 !$omp parallel default(firstprivate) shared(y)
136 !DEF: /implicit_dsa_test6/OtherConstruct1/OtherConstruct2/y (OmpShared) HostAssoc INTEGER(4)
137 !DEF: /implicit_dsa_test6/OtherConstruct1/OtherConstruct2/x (OmpFirstPrivate) HostAssocINTEGER(4)
138 !DEF: /implicit_dsa_test6/OtherConstruct1/OtherConstruct2/z (OmpFirstPrivate) HostAssocINTEGER(4)
139 y = x + z
140 !$omp end parallel
141 !$omp end task
142 end subroutine
144 ! Test taskgroup - it uses the same scope as task.
145 !DEF: /implicit_dsa_test7 (Subroutine) Subprogram
146 subroutine implicit_dsa_test7
147 !DEF: /implicit_dsa_test7/x ObjectEntity INTEGER(4)
148 !DEF: /implicit_dsa_test7/y ObjectEntity INTEGER(4)
149 integer x, y
151 !$omp task
152 !$omp taskgroup
153 !DEF: /implicit_dsa_test7/OtherConstruct1/x (OmpFirstPrivate, OmpImplicit) HostAssoc INTEGER(4)
154 !DEF: /implicit_dsa_test7/OtherConstruct1/y (OmpFirstPrivate, OmpImplicit) HostAssoc INTEGER(4)
155 x = y
156 !$omp end taskgroup
157 !$omp end task
158 end subroutine