1 // RUN: fir-opt --split-input-file --lower-workshare --allow-unregistered-dialect %s | FileCheck %s
3 // Check that we cleanup unused pure operations from the parallel and single
6 // CHECK-LABEL: func.func @wsfunc() {
7 // CHECK: %[[VAL_0:.*]] = fir.alloca i32
8 // CHECK: omp.parallel {
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
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"() : () -> ()
26 // CHECK: omp.terminator
34 %t1 = "test.test1"() : () -> i32
36 %c1 = arith.constant 1 : index
37 %c42 = arith.constant 42 : index
39 %c2 = arith.constant 2 : index
40 %c3 = arith.constant 3 : index
41 %add = arith.addi %c2, %c3 : index
42 "test.test3"(%add) : (index) -> ()
44 omp.workshare.loop_wrapper {
45 omp.loop_nest (%arg1) : index = (%c1) to (%c42) inclusive step (%c1) {
46 "test.test2"() : () -> ()