aboutsummaryrefslogtreecommitdiff
path: root/lib/Bytecode/Writer/Writer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Bytecode/Writer/Writer.cpp')
-rw-r--r--lib/Bytecode/Writer/Writer.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/Bytecode/Writer/Writer.cpp b/lib/Bytecode/Writer/Writer.cpp
index 7d578f966e..ed43bc9e2e 100644
--- a/lib/Bytecode/Writer/Writer.cpp
+++ b/lib/Bytecode/Writer/Writer.cpp
@@ -919,6 +919,8 @@ void BytecodeWriter::outputModuleInfoBlock(const Module *M) {
assert(Slot >= Type::FirstDerivedTyID && "Derived type not in range!");
assert(((Slot << 5) >> 5) == Slot && "Slot # too big!");
unsigned ID = (Slot << 5) + 1;
+ if (I->isExternal()) // If external, we don't have an FunctionInfo block.
+ ID |= 1 << 4;
output_vbr(ID);
}
output_vbr((unsigned)Table.getSlot(Type::VoidTy) << 5);
@@ -942,12 +944,12 @@ void BytecodeWriter::outputInstructions(const Function *F) {
}
void BytecodeWriter::outputFunction(const Function *F) {
- BytecodeBlock FunctionBlock(BytecodeFormat::FunctionBlockID, *this);
- output_vbr(getEncodedLinkage(F));
-
// If this is an external function, there is nothing else to emit!
if (F->isExternal()) return;
+ BytecodeBlock FunctionBlock(BytecodeFormat::FunctionBlockID, *this);
+ output_vbr(getEncodedLinkage(F));
+
// Get slot information about the function...
Table.incorporateFunction(F);