Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

Commit

Permalink
Remove extra vararg store alignment.
Browse files Browse the repository at this point in the history
kripken added this in 6198caf but it's not needed anymore (and was incorrect): the code was putting varargs on the stack as a packed struct which caused misaligned reads and writes, I fixed the issue by making the struct non-packed and using the target's prefered alignment for each element instead. The alloca should be aligned to the target's preference too, so everything should now be neatly aligned. This pass runs pre-opt, so the optimizer can figure out the alignment of all the loads and stores and foster further harmony in the memory.
  • Loading branch information
jfbastien committed Apr 22, 2015
1 parent efe8231 commit 301c4da
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/Transforms/NaCl/ExpandVarArgs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,8 @@ static bool ExpandVarArgCall(Module *M, InstType *Call, DataLayout *DL) {
IRB.CreateMemCpy(Ptr, Arg, DL->getTypeAllocSize(
Arg->getType()->getPointerElementType()),
/*Align=*/1);
else {
StoreInst *S = IRB.CreateStore(Arg, Ptr);
S->setAlignment(4); // EMSCRIPTEN: pnacl stack is only 4-byte aligned
}
else
IRB.CreateStore(Arg, Ptr);
++Index;
}

Expand Down

0 comments on commit 301c4da

Please sign in to comment.