From: Chris Lattner Date: Mon, 9 Apr 2007 03:37:36 +0000 (+0000) Subject: Fix a bug that caused alignment information to occasionally get stripped off X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=39a6a36c5adf25b174e5381ea769264767e90582;p=oota-llvm.git Fix a bug that caused alignment information to occasionally get stripped off of an allocation instruction when writing to bytecode. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35796 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Bytecode/Writer/Writer.cpp b/lib/Bytecode/Writer/Writer.cpp index e0aa110d5cc..925ae1f4644 100644 --- a/lib/Bytecode/Writer/Writer.cpp +++ b/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(I) || isa(I) || - isa(I) || isa(I) || Opcode == 58)); + bool HasExtraArg = false; + if (isa(I) || isa(I) || + isa(I) || isa(I) || Opcode == 58) + HasExtraArg = true; + if (const AllocationInst *AI = dyn_cast(I)) + HasExtraArg = AI->getAlignment() != 0; + + output_vbr(NumArgs + HasExtraArg); if (!isa(&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(I)->getCallingConv() << 1) | unsigned(cast(I)->isTailCall())); + } else if (const AllocationInst *AI = dyn_cast(I)) { + if (AI->getAlignment()) + output_vbr((unsigned)Log2_32(AI->getAlignment())+1); } } else { output_vbr(Table.getSlot(I->getOperand(0)));