74 lines · plain
1// RUN: fir-opt --split-input-file --lower-workshare --allow-unregistered-dialect %s | FileCheck %s2 3 4// Check if we store the correct values5 6func.func @wsfunc() {7 omp.parallel {8 // CHECK: fir.alloca9 // CHECK: fir.alloca10 // CHECK: fir.alloca11 // CHECK: fir.alloca12 // CHECK: fir.alloca13 // CHECK-NOT: fir.alloca14 omp.workshare {15 16 %t1 = "test.test1"() : () -> i3217 // CHECK: %[[T1:.*]] = "test.test1"18 // CHECK: fir.store %[[T1]]19 %t2 = "test.test2"() : () -> i3220 // CHECK: %[[T2:.*]] = "test.test2"21 // CHECK: fir.store %[[T2]]22 %t3 = "test.test3"() : () -> i3223 // CHECK: %[[T3:.*]] = "test.test3"24 // CHECK-NOT: fir.store %[[T3]]25 %t4 = "test.test4"() : () -> i3226 // CHECK: %[[T4:.*]] = "test.test4"27 // CHECK: fir.store %[[T4]]28 %t5 = "test.test5"() : () -> i3229 // CHECK: %[[T5:.*]] = "test.test5"30 // CHECK: fir.store %[[T5]]31 %t6 = "test.test6"() : () -> i3232 // CHECK: %[[T6:.*]] = "test.test6"33 // CHECK-NOT: fir.store %[[T6]]34 35 36 "test.test1"(%t1) : (i32) -> ()37 "test.test1"(%t2) : (i32) -> ()38 "test.test1"(%t3) : (i32) -> ()39 40 %true = arith.constant true41 fir.if %true {42 "test.test2"(%t3) : (i32) -> ()43 }44 45 %c1_i32 = arith.constant 1 : i3246 47 %t5_pure_use = arith.addi %t5, %c1_i32 : i3248 49 %t6_mem_effect_use = "test.test8"(%t6) : (i32) -> i3250 // CHECK: %[[T6_USE:.*]] = "test.test8"51 // CHECK: fir.store %[[T6_USE]]52 53 %c42 = arith.constant 42 : index54 %c1 = arith.constant 1 : index55 omp.workshare.loop_wrapper {56 omp.loop_nest (%arg1) : index = (%c1) to (%c42) inclusive step (%c1) {57 "test.test10"(%t1) : (i32) -> ()58 "test.test10"(%t5_pure_use) : (i32) -> ()59 "test.test10"(%t6_mem_effect_use) : (i32) -> ()60 omp.yield61 }62 }63 64 "test.test10"(%t2) : (i32) -> ()65 fir.if %true {66 "test.test10"(%t4) : (i32) -> ()67 }68 omp.terminator69 }70 omp.terminator71 }72 return73}74