brintos

brintos / llvm-project-archived public Read only

0
0
Text · 900 B · 31db821 Raw
26 lines · plain
1// RUN: fir-opt --lower-workshare --allow-unregistered-dialect %s | FileCheck %s2 3// Check that the safe to parallelize `fir.declare` op will not be parallelized4// due to its operand %alloc not being reloaded outside the omp.single.5 6func.func @foo() {7  %c0 = arith.constant 0 : index8  omp.workshare {9    %alloc = fir.allocmem !fir.array<?xf32>, %c0 {bindc_name = ".tmp.forall", uniq_name = ""}10    %shape = fir.shape %c0 : (index) -> !fir.shape<1>11    %declare = fir.declare %alloc(%shape) {uniq_name = ".tmp.forall"} : (!fir.heap<!fir.array<?xf32>>, !fir.shape<1>) -> !fir.heap<!fir.array<?xf32>>12    fir.freemem %alloc : !fir.heap<!fir.array<?xf32>>13    omp.terminator14  }15  return16}17 18// CHECK:    omp.single nowait19// CHECK:      fir.allocmem20// CHECK:      fir.shape21// CHECK:      fir.declare22// CHECK:      fir.freemem23// CHECK:      omp.terminator24// CHECK:    }25// CHECK:    omp.barrier26