summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Bitcode')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp53
-rw-r--r--llvm/lib/Bitcode/Writer/BitcodeWriter.cpp61
2 files changed, 5 insertions, 109 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 78504cc64e2..fe051e7a912 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -748,9 +748,6 @@ private:
bool HasRelBF);
Error parseEntireSummary(unsigned ID);
Error parseModuleStringTable();
- void parseTypeIdMetadataSummaryRecord(ArrayRef<uint64_t> Record);
- void parseTypeIdGVInfo(ArrayRef<uint64_t> Record, size_t &Slot,
- TypeIdGVInfo &TypeId);
std::pair<ValueInfo, GlobalValue::GUID>
getValueInfoFromValueId(unsigned ValueId);
@@ -5227,24 +5224,6 @@ static void parseTypeIdSummaryRecord(ArrayRef<uint64_t> Record,
parseWholeProgramDevirtResolution(Record, Strtab, Slot, TypeId);
}
-void ModuleSummaryIndexBitcodeReader::parseTypeIdGVInfo(
- ArrayRef<uint64_t> Record, size_t &Slot, TypeIdGVInfo &TypeId) {
- uint64_t Offset = Record[Slot++];
- ValueInfo Callee = getValueInfoFromValueId(Record[Slot++]).first;
- TypeId.push_back({Offset, Callee});
-}
-
-void ModuleSummaryIndexBitcodeReader::parseTypeIdMetadataSummaryRecord(
- ArrayRef<uint64_t> Record) {
- size_t Slot = 0;
- TypeIdGVInfo &TypeId = TheIndex.getOrInsertTypeIdMetadataSummary(
- {Strtab.data() + Record[Slot], static_cast<size_t>(Record[Slot + 1])});
- Slot += 2;
-
- while (Slot < Record.size())
- parseTypeIdGVInfo(Record, Slot, TypeId);
-}
-
static void setImmutableRefs(std::vector<ValueInfo> &Refs, unsigned Count) {
// Read-only refs are in the end of the refs list.
for (unsigned RefNo = Refs.size() - Count; RefNo < Refs.size(); ++RefNo)
@@ -5462,34 +5441,6 @@ Error ModuleSummaryIndexBitcodeReader::parseEntireSummary(unsigned ID) {
TheIndex.addGlobalValueSummary(GUID.first, std::move(FS));
break;
}
- // FS_PERMODULE_VTABLE_GLOBALVAR_INIT_REFS: [valueid, flags, varflags,
- // numrefs, numrefs x valueid,
- // n x (valueid, offset)]
- case bitc::FS_PERMODULE_VTABLE_GLOBALVAR_INIT_REFS: {
- unsigned ValueID = Record[0];
- uint64_t RawFlags = Record[1];
- GlobalVarSummary::GVarFlags GVF = getDecodedGVarFlags(Record[2]);
- unsigned NumRefs = Record[3];
- unsigned RefListStartIndex = 4;
- unsigned VTableListStartIndex = RefListStartIndex + NumRefs;
- auto Flags = getDecodedGVSummaryFlags(RawFlags, Version);
- std::vector<ValueInfo> Refs = makeRefList(
- ArrayRef<uint64_t>(Record).slice(RefListStartIndex, NumRefs));
- VTableFuncList VTableFuncs;
- for (unsigned I = VTableListStartIndex, E = Record.size(); I != E; ++I) {
- ValueInfo Callee = getValueInfoFromValueId(Record[I]).first;
- uint64_t Offset = Record[++I];
- VTableFuncs.push_back({Callee, Offset});
- }
- auto VS =
- llvm::make_unique<GlobalVarSummary>(Flags, GVF, std::move(Refs));
- VS->setModulePath(getThisModule()->first());
- VS->setVTableFuncs(VTableFuncs);
- auto GUID = getValueInfoFromValueId(ValueID);
- VS->setOriginalName(GUID.second);
- TheIndex.addGlobalValueSummary(GUID.first, std::move(VS));
- break;
- }
// FS_COMBINED: [valueid, modid, flags, instcount, fflags, numrefs,
// numrefs x valueid, n x (valueid)]
// FS_COMBINED_PROFILE: [valueid, modid, flags, instcount, fflags, numrefs,
@@ -5659,10 +5610,6 @@ Error ModuleSummaryIndexBitcodeReader::parseEntireSummary(unsigned ID) {
case bitc::FS_TYPE_ID:
parseTypeIdSummaryRecord(Record, Strtab, TheIndex);
break;
-
- case bitc::FS_TYPE_ID_METADATA:
- parseTypeIdMetadataSummaryRecord(Record);
- break;
}
}
llvm_unreachable("Exit infinite loop");
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index 56656c74906..ba4f932e2e6 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -215,8 +215,7 @@ private:
const Function &F);
void writeModuleLevelReferences(const GlobalVariable &V,
SmallVector<uint64_t, 64> &NameVals,
- unsigned FSModRefsAbbrev,
- unsigned FSModVTableRefsAbbrev);
+ unsigned FSModRefsAbbrev);
void assignValueId(GlobalValue::GUID ValGUID) {
GUIDToValueIdMap[ValGUID] = ++GlobalValueId;
@@ -3529,18 +3528,6 @@ static void writeTypeIdSummaryRecord(SmallVector<uint64_t, 64> &NameVals,
W.second);
}
-static void writeTypeIdMetadataSummaryRecord(
- SmallVector<uint64_t, 64> &NameVals, StringTableBuilder &StrtabBuilder,
- const std::string &Id, const TypeIdGVInfo &Summary, ValueEnumerator &VE) {
- NameVals.push_back(StrtabBuilder.add(Id));
- NameVals.push_back(Id.size());
-
- for (auto &P : Summary) {
- NameVals.push_back(P.first);
- NameVals.push_back(VE.getValueID(P.second.getValue()));
- }
-}
-
// Helper to emit a single function summary record.
void ModuleBitcodeWriterBase::writePerModuleFunctionSummaryRecord(
SmallVector<uint64_t, 64> &NameVals, GlobalValueSummary *Summary,
@@ -3585,7 +3572,7 @@ void ModuleBitcodeWriterBase::writePerModuleFunctionSummaryRecord(
// and emit them in a summary record.
void ModuleBitcodeWriterBase::writeModuleLevelReferences(
const GlobalVariable &V, SmallVector<uint64_t, 64> &NameVals,
- unsigned FSModRefsAbbrev, unsigned FSModVTableRefsAbbrev) {
+ unsigned FSModRefsAbbrev) {
auto VI = Index->getValueInfo(V.getGUID());
if (!VI || VI.getSummaryList().empty()) {
// Only declarations should not have a summary (a declaration might however
@@ -3599,10 +3586,6 @@ void ModuleBitcodeWriterBase::writeModuleLevelReferences(
NameVals.push_back(getEncodedGVSummaryFlags(VS->flags()));
NameVals.push_back(getEncodedGVarFlags(VS->varflags()));
- auto VTableFuncs = VS->vTableFuncs();
- if (!VTableFuncs.empty())
- NameVals.push_back(VS->refs().size());
-
unsigned SizeBeforeRefs = NameVals.size();
for (auto &RI : VS->refs())
NameVals.push_back(VE.getValueID(RI.getValue()));
@@ -3610,20 +3593,8 @@ void ModuleBitcodeWriterBase::writeModuleLevelReferences(
// been initialized from a DenseSet.
llvm::sort(NameVals.begin() + SizeBeforeRefs, NameVals.end());
- if (!VTableFuncs.empty()) {
- // VTableFuncs pairs should already be sorted by offset.
- for (auto &P : VTableFuncs) {
- NameVals.push_back(VE.getValueID(P.first.getValue()));
- NameVals.push_back(P.second);
- }
- }
-
- if (VTableFuncs.empty())
- Stream.EmitRecord(bitc::FS_PERMODULE_GLOBALVAR_INIT_REFS, NameVals,
- FSModRefsAbbrev);
- else
- Stream.EmitRecord(bitc::FS_PERMODULE_VTABLE_GLOBALVAR_INIT_REFS, NameVals,
- FSModVTableRefsAbbrev);
+ Stream.EmitRecord(bitc::FS_PERMODULE_GLOBALVAR_INIT_REFS, NameVals,
+ FSModRefsAbbrev);
NameVals.clear();
}
@@ -3704,17 +3675,6 @@ void ModuleBitcodeWriterBase::writePerModuleGlobalValueSummary() {
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
unsigned FSModRefsAbbrev = Stream.EmitAbbrev(std::move(Abbv));
- // Abbrev for FS_PERMODULE_VTABLE_GLOBALVAR_INIT_REFS.
- Abbv = std::make_shared<BitCodeAbbrev>();
- Abbv->Add(BitCodeAbbrevOp(bitc::FS_PERMODULE_VTABLE_GLOBALVAR_INIT_REFS));
- Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // valueid
- Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // flags
- Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 4)); // numrefs
- // numrefs x valueid, n x (valueid , offset)
- Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
- Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
- unsigned FSModVTableRefsAbbrev = Stream.EmitAbbrev(std::move(Abbv));
-
// Abbrev for FS_ALIAS.
Abbv = std::make_shared<BitCodeAbbrev>();
Abbv->Add(BitCodeAbbrevOp(bitc::FS_ALIAS));
@@ -3747,8 +3707,7 @@ void ModuleBitcodeWriterBase::writePerModuleGlobalValueSummary() {
// Capture references from GlobalVariable initializers, which are outside
// of a function scope.
for (const GlobalVariable &G : M.globals())
- writeModuleLevelReferences(G, NameVals, FSModRefsAbbrev,
- FSModVTableRefsAbbrev);
+ writeModuleLevelReferences(G, NameVals, FSModRefsAbbrev);
for (const GlobalAlias &A : M.aliases()) {
auto *Aliasee = A.getBaseObject();
@@ -3766,16 +3725,6 @@ void ModuleBitcodeWriterBase::writePerModuleGlobalValueSummary() {
NameVals.clear();
}
- if (!Index->typeIdMetadataMap().empty()) {
- SmallVector<uint64_t, 64> NameVals;
- for (auto &S : Index->typeIdMetadataMap()) {
- writeTypeIdMetadataSummaryRecord(NameVals, StrtabBuilder, S.first,
- S.second, VE);
- Stream.EmitRecord(bitc::FS_TYPE_ID_METADATA, NameVals);
- NameVals.clear();
- }
- }
-
Stream.ExitBlock();
}
OpenPOWER on IntegriCloud