58 lines · plain
1// RUN: fir-opt --split-input-file --lower-workshare --allow-unregistered-dialect %s | FileCheck %s2 3// Check that we cleanup unused pure operations from the parallel and single4// regions5 6// CHECK-LABEL: func.func @wsfunc() {7// CHECK: %[[VAL_0:.*]] = fir.alloca i328// CHECK: omp.parallel {9// CHECK: omp.single {10// CHECK: %[[VAL_1:.*]] = "test.test1"() : () -> i3211// CHECK: %[[VAL_2:.*]] = arith.constant 2 : index12// CHECK: %[[VAL_3:.*]] = arith.constant 3 : index13// CHECK: %[[VAL_4:.*]] = arith.addi %[[VAL_2]], %[[VAL_3]] : index14// CHECK: "test.test3"(%[[VAL_4]]) : (index) -> ()15// CHECK: omp.terminator16// CHECK: }17// CHECK: %[[VAL_5:.*]] = arith.constant 1 : index18// CHECK: %[[VAL_6:.*]] = arith.constant 42 : index19// 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.yield23// CHECK: }24// CHECK: }25// CHECK: omp.barrier26// CHECK: omp.terminator27// CHECK: }28// CHECK: return29// CHECK: }30func.func @wsfunc() {31 %a = fir.alloca i3232 omp.parallel {33 omp.workshare {34 %t1 = "test.test1"() : () -> i3235 36 %c1 = arith.constant 1 : index37 %c42 = arith.constant 42 : index38 39 %c2 = arith.constant 2 : index40 %c3 = arith.constant 3 : index41 %add = arith.addi %c2, %c3 : index42 "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.yield48 }49 }50 omp.terminator51 }52 omp.terminator53 }54 return55}56 57 58