Debian Codegraph @

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

raw
1 // RUN: fir-opt --split-input-file --lower-workshare --allow-unregistered-dialect %s | FileCheck %s
2
3 // Check that we cleanup unused pure operations from the parallel and single
4 // regions
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: }
25 // CHECK: omp.barrier
26 // CHECK: omp.terminator
27 // CHECK: }
28 // CHECK: return
29 // CHECK: }
30 func.func @wsfunc() {
31 %a = fir.alloca i32
32 omp.parallel {
33 omp.workshare {
34 %t1 = "test.test1"() : () -> i32
35
36 %c1 = arith.constant 1 : index
37 %c42 = arith.constant 42 : index
38
39 %c2 = arith.constant 2 : index
40 %c3 = arith.constant 3 : index
41 %add = arith.addi %c2, %c3 : index
42 "test.test3"(%add) : (index) -> ()
43
44 omp.workshare.loop_wrapper {
45 omp.loop_nest (%arg1) : index = (%c1) to (%c42) inclusive step (%c1) {
46 "test.test2"() : () -> ()
47 omp.yield
48 }
49 }
50 omp.terminator
51 }
52 omp.terminator
53 }
54 return
55 }
56
57