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
3
+ // Check that we cleanup unused pure operations from the parallel and single
4
+ // regions
5
5
6
+ // CHECK-LABEL: func.func @wsfunc() {
7
+ // CHECK: %[[VAL_0:.*]] = fir.alloca i32
8
+ // CHECK: omp.parallel {
9
+ // CHECK: omp.single {
10
+ // CHECK: %[[VAL_1:.*]] = "test.test1"() : () -> i32
11
+ // CHECK: %[[VAL_2:.*]] = arith.constant 2 : index
12
+ // CHECK: %[[VAL_3:.*]] = arith.constant 3 : index
13
+ // CHECK: %[[VAL_4:.*]] = arith.addi %[[VAL_2]], %[[VAL_3]] : index
14
+ // CHECK: "test.test3"(%[[VAL_4]]) : (index) -> ()
15
+ // CHECK: omp.terminator
16
+ // CHECK: }
17
+ // CHECK: %[[VAL_5:.*]] = arith.constant 1 : index
18
+ // CHECK: %[[VAL_6:.*]] = arith.constant 42 : index
19
+ // CHECK: omp.wsloop nowait {
20
+ // CHECK: omp.loop_nest (%[[VAL_7:.*]]) : index = (%[[VAL_5]]) to (%[[VAL_6]]) inclusive step (%[[VAL_5]]) {
21
+ // CHECK: "test.test2"() : () -> ()
22
+ // CHECK: omp.yield
23
+ // CHECK: }
24
+ // CHECK: omp.terminator
25
+ // CHECK: }
26
+ // CHECK: omp.barrier
27
+ // CHECK: omp.terminator
28
+ // CHECK: }
29
+ // CHECK: return
30
+ // CHECK: }
6
31
func.func @wsfunc () {
7
32
%a = fir.alloca i32
8
33
omp.parallel {
@@ -13,7 +38,9 @@ func.func @wsfunc() {
13
38
%c42 = arith.constant 42 : index
14
39
15
40
%c2 = arith.constant 2 : index
16
- " test.test3" (%c2 ) : (index ) -> ()
41
+ %c3 = arith.constant 3 : index
42
+ %add = arith.addi %c2 , %c3 : index
43
+ " test.test3" (%add ) : (index ) -> ()
17
44
18
45
omp.workshare_loop_wrapper {
19
46
omp.loop_nest (%arg1 ) : index = (%c1 ) to (%c42 ) inclusive step (%c1 ) {
@@ -29,27 +56,4 @@ func.func @wsfunc() {
29
56
return
30
57
}
31
58
32
- // CHECK-LABEL: func.func @wsfunc() {
33
- // CHECK: %[[VAL_0:.*]] = fir.alloca i32
34
- // CHECK: omp.parallel {
35
- // CHECK: omp.single {
36
- // CHECK: %[[VAL_1:.*]] = "test.test1"() : () -> i32
37
- // CHECK: %[[VAL_2:.*]] = arith.constant 2 : index
38
- // CHECK: "test.test3"(%[[VAL_2]]) : (index) -> ()
39
- // CHECK: omp.terminator
40
- // CHECK: }
41
- // CHECK: %[[VAL_3:.*]] = arith.constant 1 : index
42
- // CHECK: %[[VAL_4:.*]] = arith.constant 42 : index
43
- // CHECK: omp.wsloop nowait {
44
- // CHECK: omp.loop_nest (%[[VAL_5:.*]]) : index = (%[[VAL_3]]) to (%[[VAL_4]]) inclusive step (%[[VAL_3]]) {
45
- // CHECK: "test.test2"() : () -> ()
46
- // CHECK: omp.yield
47
- // CHECK: }
48
- // CHECK: omp.terminator
49
- // CHECK: }
50
- // CHECK: omp.barrier
51
- // CHECK: omp.terminator
52
- // CHECK: }
53
- // CHECK: return
54
- // CHECK: }
55
59
0 commit comments