Issue |
129202
|
Summary |
[MLIR][OpenMP] Translaton of `omp.target` is broken when `private` variables are cleaned up
|
Labels |
mlir
|
Assignees |
bhandarkar-pranav
|
Reporter |
bhandarkar-pranav
|
```
$> cat reproducer.mlir
module attributes {omp.is_target_device = false, omp.requires = #omp<clause_requires none>, omp.target_triples = [], omp.version = #om\
p.version<version = 11>} {
llvm.func @free(!llvm.ptr)
llvm.func @malloc(i64) -> !llvm.ptr
omp.private {type = private} @_QFtarget_allocatableEnon_alloc_var_private_box_10xi32 : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, \
array<1 x array<3 x i64>>)> init {
^bb0(%arg0: !llvm.ptr, %arg1: !llvm.ptr):
omp.yield(%arg1 : !llvm.ptr)
} dealloc {
^bb0(%arg0: !llvm.ptr):
llvm.br ^bb1
^bb1: // 2 preds: ^bb0, ^bb1
omp.yield
}
llvm.func @target_allocatable_(%arg0: !llvm.ptr {fir.bindc_name = "lb", llvm.nocapture}, %arg1: !llvm.ptr {fir.bindc_name = "ub", ll\
vm.nocapture}) attributes {fir.internal_name = "_QPtarget_allocatable"} {
%2 = llvm.mlir.constant(1 : i64) : i64
%5 = llvm.alloca %2 x !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>)> : (i64) -> !llvm.ptr
omp.target private(@_QFtarget_allocatableEnon_alloc_var_private_box_10xi32 %5 -> %arg2 : !llvm.ptr) {
omp.terminator
}
llvm.return
}
}
```
Command to reproduce the problem
```
mlir-translate -mlir-to-llvmir -allow-unregistered-dialect ./reproducer.mlir
Basic Block in function '__omp_offloading_10304_b734e3e_target_allocatable__l16' does not have terminator!
label %omp.region.cont1
```
This happens because after translating the `dealloc` regions of `omp.private` in the translation of `omp.target` we do not return the corret `InsertPoint`
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs