diff options
author | Alon Zakai <alonzakai@gmail.com> | 2014-02-25 11:35:53 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2014-02-25 11:39:07 -0800 |
commit | fb66cddee6d75d611176ba8ef768959ce96f112e (patch) | |
tree | 543f2c9694be14ff144f37ecc6ed3900a7e002f8 /lib | |
parent | a6745c14e681818058209040eacf5c82689e7980 (diff) |
workaround for nativeclient issue 3798, wrong alignment on copy of a byval struct argument
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/NaCl/ExpandByVal.cpp | 10 |
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()); |