Skip to content

Commit fed4884

Browse files
committed
Add test for cfg workshare bufferization
1 parent 754d54b commit fed4884

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// RUN: fir-opt --bufferize-hlfir %s 2>&1 | FileCheck %s
2+
3+
// CHECK: warning: omp workshare with unstructured control flow currently unsupported.
4+
func.func @warn_cfg(%arg: !fir.ref<!fir.array<42xi32>>, %idx : index) {
5+
omp.workshare {
6+
^bb1:
7+
%c42 = arith.constant 42 : index
8+
%c1_i32 = arith.constant 1 : i32
9+
%shape = fir.shape %c42 : (index) -> !fir.shape<1>
10+
%array:2 = hlfir.declare %arg(%shape) {uniq_name = "array"} : (!fir.ref<!fir.array<42xi32>>, !fir.shape<1>) -> (!fir.ref<!fir.array<42xi32>>, !fir.ref<!fir.array<42xi32>>)
11+
%elemental = hlfir.elemental %shape unordered : (!fir.shape<1>) -> !hlfir.expr<42xi32> {
12+
^bb0(%i: index):
13+
hlfir.yield_element %c1_i32 : i32
14+
}
15+
hlfir.assign %elemental to %array#0 : !hlfir.expr<42xi32>, !fir.ref<!fir.array<42xi32>>
16+
hlfir.destroy %elemental : !hlfir.expr<42xi32>
17+
cf.br ^bb2
18+
^bb2:
19+
omp.terminator
20+
}
21+
return
22+
}

0 commit comments

Comments
 (0)