aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Gohman <sunfish@mozilla.com>2014-03-03 15:11:09 -0800
committerDan Gohman <sunfish@mozilla.com>2014-03-03 15:33:21 -0800
commitfa1c90b56aa3697fb0868ccea0befc0be3f89921 (patch)
tree2e140f1ef015115fdefdbef3068c57af2babe4e5
parent4d5e2f7194cc98be51ffbfc5a253be928290972e (diff)
Fix alignment of vararg buffer allocas.
Since we do 8-byte loads for va_arg of double, make sure the vararg buffer alloca is 8-byte aligned.
-rw-r--r--lib/Transforms/NaCl/ExpandVarArgs.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Transforms/NaCl/ExpandVarArgs.cpp b/lib/Transforms/NaCl/ExpandVarArgs.cpp
index 1b605b79ee..6f41046850 100644
--- a/lib/Transforms/NaCl/ExpandVarArgs.cpp
+++ b/lib/Transforms/NaCl/ExpandVarArgs.cpp
@@ -240,7 +240,8 @@ static bool ExpandVarArgCall(InstType *Call, DataLayout *DL) {
// start of the function so that we don't leak space if the function
// is called in a loop.
Function *Func = Call->getParent()->getParent();
- Instruction *Buf = new AllocaInst(VarArgsTy, "vararg_buffer");
+ AllocaInst *Buf = new AllocaInst(VarArgsTy, "vararg_buffer");
+ Buf->setAlignment(8); // XXX EMSCRIPTEN: Align for 8-byte aligned doubles.
Func->getEntryBlock().getInstList().push_front(Buf);
// Call llvm.lifetime.start/end intrinsics to indicate that Buf is