Debian Codegraph @

flang/test/Transforms/DoConcurrent/locality_specifiers_simple.mlir

raw
1 // Tests mapping `local` locality specifier to `private` clauses for a simple
2 // case (not `init` or `copy` regions).
3
4 // RUN: fir-opt --omp-do-concurrent-conversion="map-to=host" %s | FileCheck %s
5
6 fir.local {type = local} @_QFlocal_spec_translationElocal_var_private_f32 : f32
7
8 func.func @_QPlocal_spec_translation() {
9 %3 = fir.alloca f32 {bindc_name = "local_var", uniq_name = "_QFlocal_spec_translationElocal_var"}
10 %4:2 = hlfir.declare %3 {uniq_name = "_QFlocal_spec_translationElocal_var"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
11
12 %c4_i32 = arith.constant 4 : index
13 %c11_i32 = arith.constant 11 : index
14 %c1 = arith.constant 1 : index
15
16 fir.do_concurrent {
17 %7 = fir.alloca i32 {bindc_name = "i"}
18 %8:2 = hlfir.declare %7 {uniq_name = "_QFlocal_spec_translationEi"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
19
20 fir.do_concurrent.loop (%arg0) = (%c4_i32) to (%c11_i32) step (%c1)
21 local(@_QFlocal_spec_translationElocal_var_private_f32 %4#0 -> %arg1 : !fir.ref<f32>) {
22 %9 = fir.convert %arg0 : (index) -> i32
23 fir.store %9 to %8#0 : !fir.ref<i32>
24
25 %10:2 = hlfir.declare %arg1 {uniq_name = "_QFlocal_spec_translationElocal_var"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
26 %cst = arith.constant 4.200000e+01 : f32
27 hlfir.assign %cst to %10#0 : f32, !fir.ref<f32>
28 }
29 }
30 return
31 }
32
33 // CHECK: omp.private {type = private} @[[PRIVATIZER:.*local_spec_translationElocal_var.*.omp]] : f32
34
35 // CHECK: func.func @_QPlocal_spec_translation
36 // CHECK: %[[LOCAL_VAR:.*]] = fir.alloca f32 {bindc_name = "local_var", {{.*}}}
37 // CHECK: %[[LOCAL_VAR_DECL:.*]]:2 = hlfir.declare %[[LOCAL_VAR]]
38 // CHECK: omp.parallel {
39 // CHECK: omp.wsloop private(@[[PRIVATIZER]] %[[LOCAL_VAR_DECL]]#0 -> %[[LOCAL_ARG:.*]] : !fir.ref<f32>) {
40 // CHECK: omp.loop_nest {{.*}} {
41 // CHECK: %[[PRIV_DECL:.*]]:2 = hlfir.declare %[[LOCAL_ARG]]
42 // CHECK: %[[C42:.*]] = arith.constant
43 // CHECK: hlfir.assign %[[C42]] to %[[PRIV_DECL]]#0
44 // CHECK: omp.yield
45 // CHECK: }
46 // CHECK: }
47 // CHECK: omp.terminator
48 // CHECK: }