| 1 |
// RUN: fir-opt --lower-workshare --allow-unregistered-dialect %s | FileCheck %s |
| 2 |
|
| 3 |
// Check that the safe to parallelize `fir.declare` op will not be parallelized |
| 4 |
// due to its operand %alloc not being reloaded outside the omp.single. |
| 5 |
|
| 6 |
func.func @foo() { |
| 7 |
%c0 = arith.constant 0 : index |
| 8 |
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.terminator |
| 14 |
} |
| 15 |
return |
| 16 |
} |
| 17 |
|
| 18 |
// CHECK: omp.single nowait |
| 19 |
// CHECK: fir.allocmem |
| 20 |
// CHECK: fir.shape |
| 21 |
// CHECK: fir.declare |
| 22 |
// CHECK: fir.freemem |
| 23 |
// CHECK: omp.terminator |
| 24 |
// CHECK: } |
| 25 |
// CHECK: omp.barrier |