File tree Expand file tree Collapse file tree 5 files changed +60
-4
lines changed Expand file tree Collapse file tree 5 files changed +60
-4
lines changed Original file line number Diff line number Diff line change @@ -123,10 +123,10 @@ static bool mustParallelizeOp(Operation *op) {
123
123
//
124
124
// Therefore, we skip if we encounter a nested omp.workshare.
125
125
if (isa<omp::WorkshareOp>(op))
126
- WalkResult::skip ();
126
+ return WalkResult::skip ();
127
127
if (isa<omp::WorkshareLoopWrapperOp>(op))
128
- WalkResult::interrupt ();
129
- WalkResult::advance ();
128
+ return WalkResult::interrupt ();
129
+ return WalkResult::advance ();
130
130
})
131
131
.wasInterrupted ();
132
132
}
Original file line number Diff line number Diff line change 1
1
// RUN: fir-opt --split-input-file --lower-workshare --allow-unregistered-dialect %s | FileCheck %s
2
2
3
+ // Check that we correctly handle nowait
4
+
3
5
// CHECK-LABEL: func.func @nonowait
4
6
func.func @nonowait (%arg0: !fir.ref <!fir.array <42 xi32 >>) {
5
7
// CHECK: omp.barrier
Original file line number Diff line number Diff line change 1
1
// RUN: fir-opt --split-input-file --lower-workshare --allow-unregistered-dialect %s | FileCheck %s
2
2
3
3
4
- // tests if the correct values are stored
4
+ // Check if we store the correct values
5
5
6
6
func.func @wsfunc () {
7
7
omp.parallel {
Original file line number Diff line number Diff line change 1
1
// RUN: fir-opt --split-input-file --lower-workshare --allow-unregistered-dialect %s | FileCheck %s
2
2
3
+ // Check that we cleanup unused pure operations from either the parallel or
4
+ // single regions
5
+
3
6
func.func @wsfunc () {
4
7
%a = fir.alloca i32
5
8
omp.parallel {
Original file line number Diff line number Diff line change
1
+ // RUN: fir-opt --split-input-file --lower-workshare --allow-unregistered-dialect %s | FileCheck %s
2
+
3
+ // Checks that the omp.workshare_loop_wrapper binds to the correct omp.workshare
4
+
5
+ func.func @wsfunc () {
6
+ %c1 = arith.constant 1 : index
7
+ %c42 = arith.constant 42 : index
8
+ omp.parallel {
9
+ omp.workshare nowait {
10
+ omp.parallel {
11
+ omp.workshare nowait {
12
+ omp.workshare_loop_wrapper {
13
+ omp.loop_nest (%arg1 ) : index = (%c1 ) to (%c42 ) inclusive step (%c1 ) {
14
+ " test.test2" () : () -> ()
15
+ omp.yield
16
+ }
17
+ omp.terminator
18
+ }
19
+ omp.terminator
20
+ }
21
+ omp.terminator
22
+ }
23
+ omp.terminator
24
+ }
25
+ omp.terminator
26
+ }
27
+ return
28
+ }
29
+
30
+ // CHECK-LABEL: func.func @wsfunc() {
31
+ // CHECK: %[[VAL_0:.*]] = arith.constant 1 : index
32
+ // CHECK: %[[VAL_1:.*]] = arith.constant 42 : index
33
+ // CHECK: omp.parallel {
34
+ // CHECK: omp.single nowait {
35
+ // CHECK: omp.parallel {
36
+ // CHECK: omp.wsloop nowait {
37
+ // CHECK: omp.loop_nest (%[[VAL_2:.*]]) : index = (%[[VAL_0]]) to (%[[VAL_1]]) inclusive step (%[[VAL_0]]) {
38
+ // CHECK: "test.test2"() : () -> ()
39
+ // CHECK: omp.yield
40
+ // CHECK: }
41
+ // CHECK: omp.terminator
42
+ // CHECK: }
43
+ // CHECK: omp.terminator
44
+ // CHECK: }
45
+ // CHECK: omp.terminator
46
+ // CHECK: }
47
+ // CHECK: omp.terminator
48
+ // CHECK: }
49
+ // CHECK: return
50
+ // CHECK: }
51
+
You can’t perform that action at this time.
0 commit comments