Commit e8016d3
committed
[Flang][MLIR][OpenMP] Fix Target Data if (present(...)) causing LLVM-IR branching error
Currently if we generate code for the below target data map that uses an optional mapping:
!$omp target data if(present(a)) map(alloc:a)
do i = 1, 10
a(i) = i
end do
!$omp end target data
We yield an LLVM-IR error as the branch for the else path is not generated. This occurs because we enter the NoDupPriv path of the call back function when
generating the else branch, however, the emitBranch function needs to be
set to a block for it to functionally generate and link in a follow up branch.
The NoDupPriv path currently doesn't do this, while it's not supposed to
generate anything (as far as I am aware) we still need to at least set the
builders placement back so that it emits the appropriate follow up branch.
This avoids the missing terminator LLVM-IR verification error by correctly
generating the follow up branch.1 parent aeffc01 commit e8016d3
File tree
2 files changed
+32
-0
lines changed- mlir/lib/Target/LLVMIR/Dialect/OpenMP
- offload/test/offloading/fortran
2 files changed
+32
-0
lines changedLines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3727 | 3727 | | |
3728 | 3728 | | |
3729 | 3729 | | |
| 3730 | + | |
| 3731 | + | |
| 3732 | + | |
3730 | 3733 | | |
3731 | 3734 | | |
3732 | 3735 | | |
| |||
Lines changed: 29 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
0 commit comments