aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Transforms/NaCl/ExpandByVal.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Transforms/NaCl/ExpandByVal.cpp b/lib/Transforms/NaCl/ExpandByVal.cpp
index 0220cafb88..07fdf89570 100644
--- a/lib/Transforms/NaCl/ExpandByVal.cpp
+++ b/lib/Transforms/NaCl/ExpandByVal.cpp
@@ -139,6 +139,16 @@ static bool ExpandCall(DataLayout *DL, InstType *Call) {
// the alignment attribute specifies "the alignment of the stack
// slot to form and the known alignment of the pointer specified
// to the call site".
+
+ // XXX EMSCRIPTEN: we also need to take into account the "intrinsic"
+ // alignment of the structure being copied. The
+ // arg align may be "0" but the struct could only be
+ // 2-byte aligned for example. This seems to contradict
+ // the quote above, so this might be a bug elsewhere
+ // in LLVM. FIXME
+ // https://code.google.com/p/nativeclient/issues/detail?id=3798
+ Alignment = AllocAlignment;
+
Instruction *MemCpy = Builder.CreateMemCpy(CopyBuf, ArgPtr, ArgSize,
Alignment);
MemCpy->setDebugLoc(Call->getDebugLoc());