@@ -232,6 +232,8 @@ subroutine lastprivate()
232
232
! CHECK: omp.terminator
233
233
! CHECK: }
234
234
! CHECK: omp.terminator
235
+ ! CHECK: }
236
+ ! CHECK: return
235
237
! CHECK: }
236
238
237
239
! $omp sections lastprivate(x)
@@ -240,3 +242,45 @@ subroutine lastprivate()
240
242
30 x = x + 1
241
243
! $omp end sections
242
244
end subroutine
245
+
246
+ subroutine unstructured_sections_privatization ()
247
+ ! CHECK: %[[X:.*]] = fir.alloca f32 {bindc_name = "x", uniq_name = "_QFunstructured_sections_privatizationEx"}
248
+ ! CHECK: omp.sections {
249
+ ! CHECK: omp.section {
250
+ ! CHECK: %[[PRIVATE_X:.*]] = fir.alloca f32 {bindc_name = "x", pinned, uniq_name = "_QFunstructured_sections_privatizationEx"}
251
+ ! CHECK: cf.br ^bb1
252
+ ! CHECK: ^bb1: // pred: ^bb0
253
+ ! CHECK: %[[INNER_PRIVATE_X:.*]] = fir.load %[[PRIVATE_X]] : !fir.ref<f32>
254
+ ! CHECK: %[[constant:.*]] = arith.constant 1.000000e+00 : f32
255
+ ! CHECK: %[[result:.*]] = arith.addf %[[INNER_PRIVATE_X]], %[[constant]] fastmath<contract> : f32
256
+ ! CHECK: fir.store %[[result]] to %[[PRIVATE_X]] : !fir.ref<f32>
257
+ ! CHECK: omp.terminator
258
+ ! CHECK: }
259
+ ! CHECK: omp.terminator
260
+ ! CHECK: }
261
+ ! $omp sections private(x)
262
+ ! $omp section
263
+ goto 40
264
+ 40 x = x + 1
265
+ ! $omp end sections
266
+ ! CHECK: omp.sections {
267
+ ! CHECK: omp.section {
268
+ ! CHECK: %[[PRIVATE_X:.*]] = fir.alloca f32 {bindc_name = "x", pinned, uniq_name = "_QFunstructured_sections_privatizationEx"}
269
+ ! CHECK: %[[temp:.*]] = fir.load %[[X]] : !fir.ref<f32>
270
+ ! CHECK: fir.store %[[temp]] to %[[PRIVATE_X]] : !fir.ref<f32>
271
+ ! CHECK: cf.br ^bb1
272
+ ! CHECK: ^bb1: // pred: ^bb0
273
+ ! CHECK: %[[INNER_PRIVATE_X:.*]] = fir.load %[[PRIVATE_X]] : !fir.ref<f32>
274
+ ! CHECK: %[[constant:.*]] = arith.constant 1.000000e+00 : f32
275
+ ! CHECK: %[[result:.*]] = arith.addf %[[INNER_PRIVATE_X]], %[[constant]] fastmath<contract> : f32
276
+ ! CHECK: fir.store %[[result]] to %[[PRIVATE_X]] : !fir.ref<f32>
277
+ ! CHECK: omp.terminator
278
+ ! CHECK: }
279
+ ! CHECK: omp.terminator
280
+ ! CHECK: }
281
+ ! $omp sections firstprivate(x)
282
+ ! $omp section
283
+ goto 50
284
+ 50 x = x + 1
285
+ ! $omp end sections
286
+ end subroutine
0 commit comments