[PATCH] D148805: [Clang][OpenMP] Avoid emitting a __kmpc_alloc_shared for implicit casts which do not have their address taken
Gheorghe-Teodor Bercea via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 20 08:06:08 PDT 2023
doru1004 added inline comments.
================
Comment at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp:448
return;
- if (E->getCastKind() == CK_ArrayToPointerDecay) {
- const bool SavedAllEscaped = AllEscaped;
----------------
ABataev wrote:
> I think you need to check that the array is allocated in the parallel context, otherwise there might be a crash, if it is allocated in the target context and many threads would like to access it.
I believe that this is how this condition got here: the inability to check that particular aspect (since we are in a function and the target/parallel is not visible) so basically just emit it as kmpc_alloc_shared conservatively. The more I think about it the more I believe we should leave this as is and not change it. The solution might be to improve the optimization of these cases rather than the emission itself.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148805/new/
https://reviews.llvm.org/D148805
More information about the cfe-commits
mailing list