[PATCH] D132247: [clang] Fix emitVoidPtrVAArg for non-zero default alloca address space

Jessica Clarke via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 15 12:27:07 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG74f207883bc5: [clang] Fix emitVoidPtrVAArg for non-zero default alloca address space (authored by jrtc27).

Changed prior to commit:
  https://reviews.llvm.org/D132247?vs=454033&id=522295#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132247/new/

https://reviews.llvm.org/D132247

Files:
  clang/lib/CodeGen/TargetInfo.cpp


Index: clang/lib/CodeGen/TargetInfo.cpp
===================================================================
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -401,8 +401,10 @@
 
   // Cast the address we've calculated to the right type.
   llvm::Type *DirectTy = CGF.ConvertTypeForMem(ValueTy), *ElementTy = DirectTy;
-  if (IsIndirect)
-    DirectTy = DirectTy->getPointerTo(0);
+  if (IsIndirect) {
+    unsigned AllocaAS = CGF.CGM.getDataLayout().getAllocaAddrSpace();
+    DirectTy = DirectTy->getPointerTo(AllocaAS);
+  }
 
   Address Addr = emitVoidPtrDirectVAArg(CGF, VAListAddr, DirectTy, DirectSize,
                                         DirectAlign, SlotSizeAndAlign,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132247.522295.patch
Type: text/x-patch
Size: 708 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230515/5e4be9e3/attachment.bin>


More information about the cfe-commits mailing list