summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bytecode
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-04-09 03:37:36 +0000
committerChris Lattner <sabre@nondot.org>2007-04-09 03:37:36 +0000
commita2e2e5640a8e0d34429f6a916255ec9d9cdef30e (patch)
treef1fc72ee29a77e7dbba47b6b7024d839a7815dd0 /llvm/lib/Bytecode
parent7ae03fc5fba17db7b0cf4ec0387707e9593fa9f7 (diff)
downloadbcm5719-llvm-a2e2e5640a8e0d34429f6a916255ec9d9cdef30e.tar.gz
bcm5719-llvm-a2e2e5640a8e0d34429f6a916255ec9d9cdef30e.zip
Fix a bug that caused alignment information to occasionally get stripped off
of an allocation instruction when writing to bytecode. llvm-svn: 35796
Diffstat (limited to 'llvm/lib/Bytecode')
-rw-r--r--llvm/lib/Bytecode/Writer/Writer.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/llvm/lib/Bytecode/Writer/Writer.cpp b/llvm/lib/Bytecode/Writer/Writer.cpp
index e0aa110d5cc..925ae1f4644 100644
--- a/llvm/lib/Bytecode/Writer/Writer.cpp
+++ b/llvm/lib/Bytecode/Writer/Writer.cpp
@@ -429,8 +429,14 @@ void BytecodeWriter::outputInstructionFormat0(const Instruction *I,
output_typeid(Type); // Result type
unsigned NumArgs = I->getNumOperands();
- output_vbr(NumArgs + (isa<CastInst>(I) || isa<InvokeInst>(I) ||
- isa<CmpInst>(I) || isa<VAArgInst>(I) || Opcode == 58));
+ bool HasExtraArg = false;
+ if (isa<CastInst>(I) || isa<InvokeInst>(I) ||
+ isa<CmpInst>(I) || isa<VAArgInst>(I) || Opcode == 58)
+ HasExtraArg = true;
+ if (const AllocationInst *AI = dyn_cast<AllocationInst>(I))
+ HasExtraArg = AI->getAlignment() != 0;
+
+ output_vbr(NumArgs + HasExtraArg);
if (!isa<GetElementPtrInst>(&I)) {
for (unsigned i = 0; i < NumArgs; ++i)
@@ -445,6 +451,9 @@ void BytecodeWriter::outputInstructionFormat0(const Instruction *I,
} else if (Opcode == 58) { // Call escape sequence
output_vbr((cast<CallInst>(I)->getCallingConv() << 1) |
unsigned(cast<CallInst>(I)->isTailCall()));
+ } else if (const AllocationInst *AI = dyn_cast<AllocationInst>(I)) {
+ if (AI->getAlignment())
+ output_vbr((unsigned)Log2_32(AI->getAlignment())+1);
}
} else {
output_vbr(Table.getSlot(I->getOperand(0)));
OpenPOWER on IntegriCloud