[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 04:56:18 PDT 2023


ABataev added inline comments.


================
Comment at: clang/lib/CodeGen/CGDecl.cpp:589
+        : AddrSizePair(AddrSizePair) {}
+    void Emit(CodeGenFunction &CGF, Flags Flags) override {
+      CGOpenMPRuntimeGPU &RT =
----------------
Name of the variable hides the type, potential warning or even error


================
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)) {
----------------
I think you can drop triple checks and rely completely on RT.isDelayedVariableLengthDecl(*this, &D) result here


================
Comment at: clang/lib/CodeGen/CodeGenFunction.cpp:2164-2174
+bool CodeGenFunction::hasVLASize(const VariableArrayType *type) {
+  QualType elementType;
+  do {
+    elementType = type->getElementType();
+    llvm::Value *vlaSize = VLASizeMap[type->getSizeExpr()];
+    if (!vlaSize)
+      return false;
----------------
Fix var naming


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