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

2023-07-06 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
doru1004 closed this revision. doru1004 added a comment. Commit: 1370e568dea84c4ea65fe5c01ef4f4ccc751 CHANGES SINCE LAST ACTION https://reviews.llvm.org/D153883/new/ https://reviews.llvm.org/D153883

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

2023-07-06 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
doru1004 added a comment. @ABataev thank you for the review! I have now fixed the last nit and will commit the patch soon! CHANGES SINCE LAST ACTION https://reviews.llvm.org/D153883/new/ https://reviews.llvm.org/D153883 ___ cfe-commits mailing

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

2023-07-06 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
doru1004 updated this revision to Diff 537706. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D153883/new/ https://reviews.llvm.org/D153883 Files: clang/lib/CodeGen/CGDecl.cpp clang/lib/CodeGen/CGOpenMPRuntime.h clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp

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

2023-07-06 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev accepted this revision. ABataev added a comment. This revision is now accepted and ready to land. LG with a nit Comment at: clang/lib/CodeGen/CGDecl.cpp:19 #include "CGOpenMPRuntime.h" +#include "CGOpenMPRuntimeGPU.h" #include "CodeGenFunction.h" You

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

2023-07-05 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
doru1004 updated this revision to Diff 537498. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D153883/new/ https://reviews.llvm.org/D153883 Files: clang/lib/CodeGen/CGDecl.cpp clang/lib/CodeGen/CGOpenMPRuntime.h clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp

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

2023-07-05 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments. Comment at: clang/lib/CodeGen/CGDecl.cpp:591 + auto = + *(static_cast(())); + RT.getKmpcFreeShared(CGF, AddrSizePair); Same, just CGOpenMPRuntime = CGM.getOpenMPRuntime(); Comment at:

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

2023-07-05 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
doru1004 added inline comments. Comment at: clang/lib/CodeGen/CGOpenMPRuntime.h:699-710 + /// Get call to __kmpc_alloc_shared + virtual std::pair + getKmpcAllocShared(CodeGenFunction , const VarDecl *VD) { +llvm_unreachable("not implemented"); + } + + /// Get call to

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

2023-07-05 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments. Comment at: clang/lib/CodeGen/CGDecl.cpp:1606 + CGOpenMPRuntimeGPU = + *(static_cast(())); + if (RT.isDelayedVariableLengthDecl(*this, )) { doru1004 wrote: > ABataev wrote: > > ABataev wrote: > > > 1. use

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

2023-07-05 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
doru1004 added inline comments. Comment at: clang/lib/CodeGen/CGDecl.cpp:1606 + CGOpenMPRuntimeGPU = + *(static_cast(())); + if (RT.isDelayedVariableLengthDecl(*this, )) { ABataev wrote: > ABataev wrote: > > 1. use

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

2023-07-05 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments. Comment at: clang/lib/CodeGen/CGDecl.cpp:1606 + CGOpenMPRuntimeGPU = + *(static_cast(())); + if (RT.isDelayedVariableLengthDecl(*this, )) { ABataev wrote: > 1. use `static_cast(CGM.getOpenMPRuntime())` > 2. It

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

2023-07-05 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
doru1004 updated this revision to Diff 537485. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D153883/new/ https://reviews.llvm.org/D153883 Files: clang/lib/CodeGen/CGDecl.cpp clang/lib/CodeGen/CGOpenMPRuntime.h

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

2023-07-05 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
doru1004 updated this revision to Diff 537478. doru1004 marked an inline comment as done. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D153883/new/ https://reviews.llvm.org/D153883 Files: clang/lib/CodeGen/CGDecl.cpp

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

2023-07-03 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments. Comment at: clang/lib/CodeGen/CGDecl.cpp:1606 + CGOpenMPRuntimeGPU = + *(static_cast(())); + if (RT.isDelayedVariableLengthDecl(*this, )) { 1. use `static_cast(CGM.getOpenMPRuntime())` 2. It will crash if your

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

2023-06-30 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
doru1004 added a comment. In any case the patch is good to go. It no longer relies on VLA size checks. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D153883/new/ https://reviews.llvm.org/D153883 ___ cfe-commits mailing list

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

2023-06-30 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
doru1004 added a comment. @ABataev This is as close as I could get it to what you wanted. I don't know how to get hold of the target directive so late in the emission process i.e. in markedAsEscaped function. The target directive doesn't get visited in the var checked for escaped vars so I

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

2023-06-30 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
doru1004 updated this revision to Diff 536489. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D153883/new/ https://reviews.llvm.org/D153883 Files: clang/lib/CodeGen/CGDecl.cpp clang/lib/CodeGen/CGOpenMPRuntime.h clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp

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

2023-06-30 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
doru1004 added inline comments. Comment at: clang/lib/CodeGen/CodeGenFunction.h:2806 + /// Return true if all the emissions for the VLA size have occured. + bool hasVLASize(const VariableArrayType *type); + ABataev wrote: > doru1004 wrote: > > doru1004 wrote:

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

2023-06-30 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments. Comment at: clang/lib/CodeGen/CodeGenFunction.h:2806 + /// Return true if all the emissions for the VLA size have occured. + bool hasVLASize(const VariableArrayType *type); + doru1004 wrote: > doru1004 wrote: > > ABataev wrote: >

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

2023-06-30 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
doru1004 added inline comments. Comment at: clang/lib/CodeGen/CodeGenFunction.h:2806 + /// Return true if all the emissions for the VLA size have occured. + bool hasVLASize(const VariableArrayType *type); + doru1004 wrote: > ABataev wrote: > > doru1004 wrote:

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

2023-06-30 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
doru1004 added inline comments. Comment at: clang/lib/CodeGen/CodeGenFunction.h:2806 + /// Return true if all the emissions for the VLA size have occured. + bool hasVLASize(const VariableArrayType *type); + ABataev wrote: > doru1004 wrote: > > doru1004 wrote:

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

2023-06-30 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments. Comment at: clang/lib/CodeGen/CodeGenFunction.h:2806 + /// Return true if all the emissions for the VLA size have occured. + bool hasVLASize(const VariableArrayType *type); + doru1004 wrote: > doru1004 wrote: > > doru1004 wrote:

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

2023-06-30 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
doru1004 added inline comments. Comment at: clang/lib/CodeGen/CodeGenFunction.h:2806 + /// Return true if all the emissions for the VLA size have occured. + bool hasVLASize(const VariableArrayType *type); + doru1004 wrote: > doru1004 wrote: > > ABataev wrote:

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

2023-06-30 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
doru1004 added inline comments. Comment at: clang/lib/CodeGen/CodeGenFunction.h:2806 + /// Return true if all the emissions for the VLA size have occured. + bool hasVLASize(const VariableArrayType *type); + doru1004 wrote: > ABataev wrote: > > doru1004 wrote:

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

2023-06-30 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
doru1004 added inline comments. Comment at: clang/lib/CodeGen/CodeGenFunction.h:2806 + /// Return true if all the emissions for the VLA size have occured. + bool hasVLASize(const VariableArrayType *type); + ABataev wrote: > doru1004 wrote: > > ABataev wrote: >

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

2023-06-30 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments. Comment at: clang/lib/CodeGen/CodeGenFunction.h:2806 + /// Return true if all the emissions for the VLA size have occured. + bool hasVLASize(const VariableArrayType *type); + doru1004 wrote: > ABataev wrote: > > doru1004 wrote: >

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

2023-06-30 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
doru1004 updated this revision to Diff 536326. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D153883/new/ https://reviews.llvm.org/D153883 Files: clang/lib/CodeGen/CGDecl.cpp clang/lib/CodeGen/CGOpenMPRuntime.h

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

2023-06-30 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
doru1004 added inline comments. Comment at: clang/lib/CodeGen/CodeGenFunction.h:2806 + /// Return true if all the emissions for the VLA size have occured. + bool hasVLASize(const VariableArrayType *type); + ABataev wrote: > doru1004 wrote: > > ABataev wrote: >

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

2023-06-30 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments. Comment at: clang/lib/CodeGen/CodeGenFunction.cpp:2168 +ElementType = VLAType->getElementType(); +llvm::Value *VLASize = VLASizeMap[VLAType->getSizeExpr()]; +if (!VLASize) Use VLASizeMap.find() instead

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

2023-06-30 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
doru1004 updated this revision to Diff 536322. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D153883/new/ https://reviews.llvm.org/D153883 Files: clang/lib/CodeGen/CGDecl.cpp clang/lib/CodeGen/CGOpenMPRuntime.h

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

2023-06-30 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
doru1004 added inline comments. Comment at: clang/lib/CodeGen/CGDecl.cpp:1605-1606 +if (getLangOpts().OpenMPIsDevice) { + CGOpenMPRuntimeGPU = + *(static_cast(())); + if (RT.isDelayedVariableLengthDecl(*this, )) { ABataev wrote: > No need

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

2023-06-30 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
doru1004 updated this revision to Diff 536321. doru1004 marked 4 inline comments as done. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D153883/new/ https://reviews.llvm.org/D153883 Files: clang/lib/CodeGen/CGDecl.cpp

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

2023-06-30 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments. Comment at: clang/lib/CodeGen/CodeGenFunction.h:2806 + /// Return true if all the emissions for the VLA size have occured. + bool hasVLASize(const VariableArrayType *type); + doru1004 wrote: > ABataev wrote: > > 1. Is it possible

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

2023-06-30 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
doru1004 added inline comments. Comment at: clang/lib/CodeGen/CodeGenFunction.h:2806 + /// Return true if all the emissions for the VLA size have occured. + bool hasVLASize(const VariableArrayType *type); + ABataev wrote: > 1. Is it possible that

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

2023-06-30 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments. Comment at: clang/lib/CodeGen/CGDecl.cpp:590-591 +void Emit(CodeGenFunction , Flags EmissionFlags) override { + CGOpenMPRuntimeGPU = + *(static_cast(())); + RT.getKmpcFreeShared(CGF, AddrSizePair); ``` auto

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

2023-06-30 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
doru1004 marked 3 inline comments as done. doru1004 added inline comments. Comment at: clang/lib/CodeGen/CGDecl.cpp:1605-1609 +(CGM.getContext().getTargetInfo().getTriple().isAMDGPU() || + CGM.getContext().getTargetInfo().getTriple().isNVPTX())) { +

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

2023-06-30 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
doru1004 updated this revision to Diff 536288. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D153883/new/ https://reviews.llvm.org/D153883 Files: clang/lib/CodeGen/CGDecl.cpp clang/lib/CodeGen/CGOpenMPRuntime.h

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

2023-06-30 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments. Comment at: clang/lib/CodeGen/CGDecl.cpp:1605-1609 +(CGM.getContext().getTargetInfo().getTriple().isAMDGPU() || + CGM.getContext().getTargetInfo().getTriple().isNVPTX())) { + CGOpenMPRuntimeGPU = + *(static_cast(()));

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

2023-06-30 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
doru1004 added inline comments. Comment at: clang/lib/CodeGen/CGDecl.cpp:1605-1609 +(CGM.getContext().getTargetInfo().getTriple().isAMDGPU() || + CGM.getContext().getTargetInfo().getTriple().isNVPTX())) { + CGOpenMPRuntimeGPU = +

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

2023-06-30 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments. Comment at: clang/lib/CodeGen/CGDecl.cpp:589 +: AddrSizePair(AddrSizePair) {} +void Emit(CodeGenFunction , Flags Flags) override { + CGOpenMPRuntimeGPU = Name of the variable hides the type, potential warning or

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

2023-06-29 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
doru1004 added a comment. I have modified the patch to only do one thing rather than several things as the previous patch. Essentially this patch now only handles the delayed emission of the __kmpc_alloc_shared for the VLA which it could not emit in the Prolog of the function. This is now very

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

2023-06-29 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
doru1004 updated this revision to Diff 536059. doru1004 retitled this revision from "[Clang][OpenMP] Enable use of __kmpc_alloc_shared for VLAs defined in AMD GPU offloaded regions" to "[Clang][OpenMP] Delay emission of __kmpc_alloc_shared for escaped VLAs ". doru1004 edited the summary of this