[clang] 4fb0c08 - [clang][CodeGen] GetDefaultAlignTempAlloca uses preferred alignment
Andy Wingo via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 23 06:09:47 PDT 2021
Author: Andy Wingo
Date: 2021-08-23T14:55:58+02:00
New Revision: 4fb0c083429ad3119096b3fadf01954952b68a25
URL: https://github.com/llvm/llvm-project/commit/4fb0c083429ad3119096b3fadf01954952b68a25
DIFF: https://github.com/llvm/llvm-project/commit/4fb0c083429ad3119096b3fadf01954952b68a25.diff
LOG: [clang][CodeGen] GetDefaultAlignTempAlloca uses preferred alignment
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.
Differential Revision: https://reviews.llvm.org/D108450
Added:
Modified:
clang/lib/CodeGen/CGExpr.cpp
Removed:
################################################################################
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 83f5f42431e0..8548a9e75f4b 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -122,7 +122,7 @@ llvm::AllocaInst *CodeGenFunction::CreateTempAlloca(llvm::Type *Ty,
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);
}
More information about the cfe-commits
mailing list