[PATCH] D153883: [Clang][OpenMP] Delay emission of __kmpc_alloc_shared for escaped VLAs

Alexey Bataev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 30 08:25:06 PDT 2023


ABataev added inline comments.


================
Comment at: clang/lib/CodeGen/CGDecl.cpp:1605-1609
+        (CGM.getContext().getTargetInfo().getTriple().isAMDGPU() ||
+         CGM.getContext().getTargetInfo().getTriple().isNVPTX())) {
+      CGOpenMPRuntimeGPU &RT =
+          *(static_cast<CGOpenMPRuntimeGPU *>(&CGM.getOpenMPRuntime()));
+      if (RT.isDelayedVariableLengthDecl(*this, &D)) {
----------------
doru1004 wrote:
> ABataev wrote:
> > I think you can drop triple checks and rely completely on RT.isDelayedVariableLengthDecl(*this, &D) result here
> I tried it but there is a lit test (which I cannot identify) that hangs when offloading to the host (I think) so it has to be an actual GPU. Any ideas?
Make isDelayedVariableLengthDecl virtual in base OpenMPRuntime and make it return false by default, and true in base implementation for GPU. This should fix the problem, I hope


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