[PATCH] D108450: [clang][CodeGen] GetDefaultAlignTempAlloca uses preferred alignment

Andy Wingo via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 20 01:02:08 PDT 2021


wingo created this revision.
wingo added a reviewer: rjmccall.
wingo requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This function was defaulting to use the ABI alignment for the LLVM
type.  Here we change to use the preferred alignment.  This will allow
unification with GetTempAlloca, which if alignment isn't specified, uses
the preferred alignment.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108450

Files:
  clang/lib/CodeGen/CGExpr.cpp


Index: clang/lib/CodeGen/CGExpr.cpp
===================================================================
--- clang/lib/CodeGen/CGExpr.cpp
+++ clang/lib/CodeGen/CGExpr.cpp
@@ -122,7 +122,7 @@
 Address CodeGenFunction::CreateDefaultAlignTempAlloca(llvm::Type *Ty,
                                                       const Twine &Name) {
   CharUnits Align =
-    CharUnits::fromQuantity(CGM.getDataLayout().getABITypeAlignment(Ty));
+      CharUnits::fromQuantity(CGM.getDataLayout().getPrefTypeAlignment(Ty));
   return CreateTempAlloca(Ty, Align, Name);
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108450.367730.patch
Type: text/x-patch
Size: 561 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210820/ba4bad0b/attachment.bin>


More information about the cfe-commits mailing list