diff options
author | Dan Gohman <sunfish@google.com> | 2014-02-13 19:02:20 -0800 |
---|---|---|
committer | Dan Gohman <sunfish@google.com> | 2014-02-14 11:38:16 -0800 |
commit | f3359807242e95f9e94bb35c0d90a73c794f1af0 (patch) | |
tree | fd0aec9771d0f1d1713e0abc77c0575349237b21 /lib | |
parent | 3b35f56469fb3a5b15fc0fc77e51c9603b1f9c24 (diff) |
Preserve alignment information when splitting loads and stores.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/NaCl/ExpandI64.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/Transforms/NaCl/ExpandI64.cpp b/lib/Transforms/NaCl/ExpandI64.cpp index ae3b67e6e7..6034880613 100644 --- a/lib/Transforms/NaCl/ExpandI64.cpp +++ b/lib/Transforms/NaCl/ExpandI64.cpp @@ -389,7 +389,10 @@ bool ExpandI64::splitInst(Instruction *I) { Instruction *Add = i == 0 ? AI : CopyDebug(BinaryOperator::Create(Instruction::Add, AI, ConstantInt::get(i32, 4*i), "", I), I); Instruction *Ptr = CopyDebug(new IntToPtrInst(Add, i32P, "", I), I); LoadInst *Chunk = new LoadInst(Ptr, "", I); CopyDebug(Chunk, I); - Chunk->setAlignment(std::min(4U, LI->getAlignment())); + Chunk->setAlignment(MinAlign(LI->getAlignment() == 0 ? + DL->getABITypeAlignment(LI->getType()) : + LI->getAlignment(), + 4*i)); Chunk->setVolatile(LI->isVolatile()); Chunk->setOrdering(LI->getOrdering()); Chunk->setSynchScope(LI->getSynchScope()); @@ -406,7 +409,10 @@ bool ExpandI64::splitInst(Instruction *I) { Instruction *Add = i == 0 ? AI : CopyDebug(BinaryOperator::Create(Instruction::Add, AI, ConstantInt::get(i32, 4*i), "", I), I); Instruction *Ptr = CopyDebug(new IntToPtrInst(Add, i32P, "", I), I); StoreInst *Chunk = new StoreInst(InputChunks[i], Ptr, I); - Chunk->setAlignment(std::min(4U, SI->getAlignment())); + Chunk->setAlignment(MinAlign(SI->getAlignment() == 0 ? + DL->getABITypeAlignment(SI->getValueOperand()->getType()) : + SI->getAlignment(), + 4*i)); Chunk->setVolatile(SI->isVolatile()); Chunk->setOrdering(SI->getOrdering()); Chunk->setSynchScope(SI->getSynchScope()); |