[PATCH] D153883: [Clang][OpenMP] Delay emission of __kmpc_alloc_shared for escaped VLAs
Gheorghe-Teodor Bercea via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 5 14:04:38 PDT 2023
doru1004 added inline comments.
================
Comment at: clang/lib/CodeGen/CGDecl.cpp:1606
+ CGOpenMPRuntimeGPU &RT =
+ *(static_cast<CGOpenMPRuntimeGPU *>(&CGM.getOpenMPRuntime()));
+ if (RT.isDelayedVariableLengthDecl(*this, &D)) {
----------------
ABataev wrote:
> ABataev wrote:
> > 1. use `static_cast<CGOpenMPRuntimeGPU &>(CGM.getOpenMPRuntime())`
> > 2. It will crash if your device is not GPU. Better to make `getKmpcAllocShared` and `getKmpcFreeShared` virtual (just like `isDelayedVariableLengthDecl`) in base CGOpenMPRuntime, since it may be required not only for GPU-based devices.
> Check the second item, please, better to make all new member function virtual and handle it for non-GPU devices too
The support I am adding is only meant for GPUs. I am not sure why we need to consider non-GPUs. There already exists a VLA handling for non-GPUs and that one should be used.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D153883/new/
https://reviews.llvm.org/D153883
More information about the cfe-commits
mailing list