diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-11-23 21:28:24 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-11-23 21:28:24 -0800 |
commit | 4a051cb4ea767d49e690136fc4ec8ffe648d7c8c (patch) | |
tree | 66a8844c600ec05e25f57f96eec421135c782329 /lib/Target/CppBackend/CPPBackend.cpp | |
parent | fec33965e0ef1ce9f1e81483f758e8807ba63992 (diff) |
alignment fixes
Diffstat (limited to 'lib/Target/CppBackend/CPPBackend.cpp')
-rw-r--r-- | lib/Target/CppBackend/CPPBackend.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Target/CppBackend/CPPBackend.cpp b/lib/Target/CppBackend/CPPBackend.cpp index 6d5af3ebaa..47bda5e676 100644 --- a/lib/Target/CppBackend/CPPBackend.cpp +++ b/lib/Target/CppBackend/CPPBackend.cpp @@ -1497,9 +1497,9 @@ std::string CppWriter::generateInstruction(const Instruction *I) { const Value *P = SI->getPointerOperand(); const Value *V = SI->getValueOperand(); std::string VS = getValueAsStr(V); - unsigned Bytes = V->getType()->getIntegerBitWidth()/8; + unsigned Bytes = V->getType()->getPrimitiveSizeInBits()/8; unsigned Alignment = SI->getAlignment(); - if (Bytes <= Alignment) { + if (Bytes <= Alignment || Alignment == 0) { text = getPtrUse(P) + " = " + VS + ";"; } else { // unaligned in some manner |