Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ enum {
FUNCTION_INST_UNREACHABLE_ABBREV,
FUNCTION_INST_GEP_ABBREV,
FUNCTION_DEBUG_RECORD_VALUE_ABBREV,
FUNCTION_DEBUG_LOC_ABBREV,
};

/// Abstract class to manage the bitcode writing, subclassed for each bitcode
Expand Down Expand Up @@ -3675,7 +3676,7 @@ void ModuleBitcodeWriter::writeFunction(
// in the VST.
FunctionToBitcodeIndex[&F] = Stream.GetCurrentBitNo();

Stream.EnterSubblock(bitc::FUNCTION_BLOCK_ID, 4);
Stream.EnterSubblock(bitc::FUNCTION_BLOCK_ID, 5);
VE.incorporateFunction(F);

SmallVector<unsigned, 64> Vals;
Expand Down Expand Up @@ -3724,7 +3725,8 @@ void ModuleBitcodeWriter::writeFunction(
Vals.push_back(VE.getMetadataOrNullID(DL->getScope()));
Vals.push_back(VE.getMetadataOrNullID(DL->getInlinedAt()));
Vals.push_back(DL->isImplicitCode());
Stream.EmitRecord(bitc::FUNC_CODE_DEBUG_LOC, Vals);
Stream.EmitRecord(bitc::FUNC_CODE_DEBUG_LOC, Vals,
FUNCTION_DEBUG_LOC_ABBREV);
Vals.clear();
LastDL = DL;
}
Expand Down Expand Up @@ -4055,6 +4057,19 @@ void ModuleBitcodeWriter::writeBlockInfo() {
FUNCTION_DEBUG_RECORD_VALUE_ABBREV)
llvm_unreachable("Unexpected abbrev ordering! 1");
}
{
auto Abbv = std::make_shared<BitCodeAbbrev>();
Abbv->Add(BitCodeAbbrevOp(bitc::FUNC_CODE_DEBUG_LOC));
// NOTE: No IsDistinct field for FUNC_CODE_DEBUG_LOC.
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
if (Stream.EmitBlockInfoAbbrev(bitc::FUNCTION_BLOCK_ID, Abbv) !=
FUNCTION_DEBUG_LOC_ABBREV)
llvm_unreachable("Unexpected abbrev ordering!");
}
Stream.ExitBlock();
}

Expand Down
Loading