Skip to content

Commit 79ac799

Browse files
committed
Cleanup tests
1 parent 975a0d7 commit 79ac799

File tree

6 files changed

+55
-189
lines changed

6 files changed

+55
-189
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// RUN: fir-opt --lower-workshare --allow-unregistered-dialect %s | FileCheck %s
2+
3+
// Checks that fir.alloca is hoisted out and copyprivate'd
4+
func.func @wsfunc() {
5+
omp.workshare {
6+
%c1 = arith.constant 1 : index
7+
%c42 = arith.constant 42 : index
8+
%c1_i32 = arith.constant 1 : i32
9+
%alloc = fir.alloca i32
10+
fir.store %c1_i32 to %alloc : !fir.ref<i32>
11+
omp.workshare.loop_wrapper {
12+
omp.loop_nest (%arg1) : index = (%c1) to (%c42) inclusive step (%c1) {
13+
"test.test1"(%alloc) : (!fir.ref<i32>) -> ()
14+
omp.yield
15+
}
16+
omp.terminator
17+
}
18+
"test.test2"(%alloc) : (!fir.ref<i32>) -> ()
19+
omp.terminator
20+
}
21+
return
22+
}
23+
24+
// CHECK-LABEL: func.func private @_workshare_copy_i32(
25+
// CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<i32>,
26+
// CHECK-SAME: %[[VAL_1:.*]]: !fir.ref<i32>) {
27+
// CHECK: %[[VAL_2:.*]] = fir.load %[[VAL_0]] : !fir.ref<i32>
28+
// CHECK: fir.store %[[VAL_2]] to %[[VAL_1]] : !fir.ref<i32>
29+
// CHECK: return
30+
// CHECK: }
31+
32+
// CHECK-LABEL: func.func @wsfunc() {
33+
// CHECK: %[[VAL_0:.*]] = fir.alloca i32
34+
// CHECK: omp.single copyprivate(%[[VAL_0]] -> @_workshare_copy_i32 : !fir.ref<i32>) {
35+
// CHECK: %[[VAL_1:.*]] = arith.constant 1 : i32
36+
// CHECK: fir.store %[[VAL_1]] to %[[VAL_0]] : !fir.ref<i32>
37+
// CHECK: omp.terminator
38+
// CHECK: }
39+
// CHECK: %[[VAL_2:.*]] = arith.constant 1 : index
40+
// CHECK: %[[VAL_3:.*]] = arith.constant 42 : index
41+
// CHECK: omp.wsloop {
42+
// CHECK: omp.loop_nest (%[[VAL_4:.*]]) : index = (%[[VAL_2]]) to (%[[VAL_3]]) inclusive step (%[[VAL_2]]) {
43+
// CHECK: "test.test1"(%[[VAL_0]]) : (!fir.ref<i32>) -> ()
44+
// CHECK: omp.yield
45+
// CHECK: }
46+
// CHECK: omp.terminator
47+
// CHECK: }
48+
// CHECK: omp.single nowait {
49+
// CHECK: "test.test2"(%[[VAL_0]]) : (!fir.ref<i32>) -> ()
50+
// CHECK: omp.terminator
51+
// CHECK: }
52+
// CHECK: omp.barrier
53+
// CHECK: return
54+
// CHECK: }
55+

flang/test/Transforms/OpenMP/lower-workshare.mlir

Lines changed: 0 additions & 189 deletions
This file was deleted.

0 commit comments

Comments
 (0)