Skip to content

Commit 75e8e53

Browse files
committed
Fix tests
1 parent f8cff51 commit 75e8e53

File tree

5 files changed

+60
-4
lines changed

5 files changed

+60
-4
lines changed

flang/lib/Optimizer/OpenMP/LowerWorkshare.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,10 @@ static bool mustParallelizeOp(Operation *op) {
123123
//
124124
// Therefore, we skip if we encounter a nested omp.workshare.
125125
if (isa<omp::WorkshareOp>(op))
126-
WalkResult::skip();
126+
return WalkResult::skip();
127127
if (isa<omp::WorkshareLoopWrapperOp>(op))
128-
WalkResult::interrupt();
129-
WalkResult::advance();
128+
return WalkResult::interrupt();
129+
return WalkResult::advance();
130130
})
131131
.wasInterrupted();
132132
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// RUN: fir-opt --split-input-file --lower-workshare --allow-unregistered-dialect %s | FileCheck %s
22

3+
// Check that we correctly handle nowait
4+
35
// CHECK-LABEL: func.func @nonowait
46
func.func @nonowait(%arg0: !fir.ref<!fir.array<42xi32>>) {
57
// CHECK: omp.barrier

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: fir-opt --split-input-file --lower-workshare --allow-unregistered-dialect %s | FileCheck %s
22

33

4-
// tests if the correct values are stored
4+
// Check if we store the correct values
55

66
func.func @wsfunc() {
77
omp.parallel {

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
// RUN: fir-opt --split-input-file --lower-workshare --allow-unregistered-dialect %s | FileCheck %s
22

3+
// Check that we cleanup unused pure operations from either the parallel or
4+
// single regions
5+
36
func.func @wsfunc() {
47
%a = fir.alloca i32
58
omp.parallel {
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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+

0 commit comments

Comments
 (0)