aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGDecl.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2011-11-03 20:31:28 +0000
committerEli Friedman <eli.friedman@gmail.com>2011-11-03 20:31:28 +0000
commitddfb8d1026d8f9001d8111bd8a96d89301aa11cd (patch)
tree2658d2c78df6c8ad4008d8cdd3240a5b375c011d /lib/CodeGen/CGDecl.cpp
parente6825d39e89362105171c013f4018c4d1134ad6f (diff)
Fix the alignment on scalar parameter variables so that it matches what the AST thinks it should be. Per report on cfe-dev.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143645 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDecl.cpp')
-rw-r--r--lib/CodeGen/CGDecl.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/CodeGen/CGDecl.cpp b/lib/CodeGen/CGDecl.cpp
index a6147ea765..384d92a9bf 100644
--- a/lib/CodeGen/CGDecl.cpp
+++ b/lib/CodeGen/CGDecl.cpp
@@ -1442,7 +1442,10 @@ void CodeGenFunction::EmitParmDecl(const VarDecl &D, llvm::Value *Arg,
DeclPtr = Arg;
} else {
// Otherwise, create a temporary to hold the value.
- DeclPtr = CreateMemTemp(Ty, D.getName() + ".addr");
+ llvm::AllocaInst *Alloc = CreateTempAlloca(ConvertTypeForMem(Ty),
+ D.getName() + ".addr");
+ Alloc->setAlignment(getContext().getDeclAlign(&D).getQuantity());
+ DeclPtr = Alloc;
bool doStore = true;