aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/Module.cpp
diff options
context:
space:
mode:
authorWilliam S. Moses <gh@wsmoses.com>2022-03-05 18:04:19 -0500
committerWilliam S. Moses <gh@wsmoses.com>2022-03-06 18:34:25 -0500
commit87ec6f41bba6d72a3408e71cf19ae56feff523bc (patch)
treeede35827ff590022acd34289dfcee6fc44de7eaf /clang/lib/Basic/Module.cpp
parentfb75afd730fc43474dcfba68d718410226c662ac (diff)
downloadllvm-87ec6f41bba6d72a3408e71cf19ae56feff523bc.zip
llvm-87ec6f41bba6d72a3408e71cf19ae56feff523bc.tar.gz
llvm-87ec6f41bba6d72a3408e71cf19ae56feff523bc.tar.bz2
[OpenMPIRBuilder] Allocate temporary at the correct block in a nested parallel
The OpenMPIRBuilder has a bug. Specifically, suppose you have two nested openmp parallel regions (writing with MLIR for ease) ``` omp.parallel { %a = ... omp.parallel { use(%a) } } ``` As OpenMP only permits pointer-like inputs, the builder will wrap all of the inputs into a stack allocation, and then pass this allocation to the inner parallel. For example, we would want to get something like the following: ``` omp.parallel { %a = ... %tmp = alloc store %tmp[] = %a kmpc_fork(outlined, %tmp) } ``` However, in practice, this is not what currently occurs in the context of nested parallel regions. Specifically to the OpenMPIRBuilder, the entirety of the function (at the LLVM level) is currently inlined with blocks marking the corresponding start and end of each region. ``` entry: ... parallel1: %a = ... ... parallel2: use(%a) ... endparallel2: ... endparallel1: ... ``` When the allocation is inserted, it presently inserted into the parent of the entire function (e.g. entry) rather than the parent allocation scope to the function being outlined. If we were outlining parallel2, the corresponding alloca location would be parallel1. This causes a variety of bugs, including https://github.com/llvm/llvm-project/issues/54165 as one example. This PR allows the stack allocation to be created at the correct allocation block, and thus remedies such issues. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D121061
Diffstat (limited to 'clang/lib/Basic/Module.cpp')
0 files changed, 0 insertions, 0 deletions