[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 10:16:16 PDT 2023
ABataev added inline comments.
================
Comment at: clang/lib/CodeGen/CGDecl.cpp:590-591
+ void Emit(CodeGenFunction &CGF, Flags EmissionFlags) override {
+ CGOpenMPRuntimeGPU &RT =
+ *(static_cast<CGOpenMPRuntimeGPU *>(&CGF.CGM.getOpenMPRuntime()));
+ RT.getKmpcFreeShared(CGF, AddrSizePair);
----------------
```
auto &RT = static_cast<CGOpenMPRuntimeGPU &>(...);
```
================
Comment at: clang/lib/CodeGen/CGDecl.cpp:1605-1606
+ if (getLangOpts().OpenMPIsDevice) {
+ CGOpenMPRuntimeGPU &RT =
+ *(static_cast<CGOpenMPRuntimeGPU *>(&CGM.getOpenMPRuntime()));
+ if (RT.isDelayedVariableLengthDecl(*this, &D)) {
----------------
No need to cast to CGOpenMPRuntimeGPU since isDelayedVariableLengthDecl is a member of CGOpenMPRuntime.
================
Comment at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp:1116-1120
+ for (const auto *DelayedD : I->getSecond().DelayedVariableLengthDecls)
+ if (DelayedD == VD)
+ return true;
+
+ return false;
----------------
```
return llvm::is_contained(I->getSecond().DelayedVariableLengthDecls, VD);
```
================
Comment at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp:1152
+ CodeGenFunction &CGF,
+ std::pair<llvm::Value *, llvm::Value *> AddrSizePair) {
+ // Deallocate the memory for each globalized VLA object
----------------
pass it here and in other places as const reference
================
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);
+
----------------
1. Is it possible that VariableArrayType does not have VLA size?
2. Fix param name
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