forked from OSchip/llvm-project
[LLParser,NFC] Simplify forward GV refs update
Reviewed By: tejohnson Differential Revision: https://reviews.llvm.org/D85238
This commit is contained in:
parent
1139d899d5
commit
faeeed6f52
|
@ -7786,13 +7786,11 @@ bool LLParser::ParseTypeIdCompatibleVtableEntry(unsigned ID) {
|
|||
// Now that the TI vector is finalized, it is safe to save the locations
|
||||
// of any forward GV references that need updating later.
|
||||
for (auto I : IdToIndexMap) {
|
||||
auto &Infos = ForwardRefValueInfos[I.first];
|
||||
for (auto P : I.second) {
|
||||
assert(TI[P.first].VTableVI == EmptyVI &&
|
||||
"Forward referenced ValueInfo expected to be empty");
|
||||
auto FwdRef = ForwardRefValueInfos.insert(std::make_pair(
|
||||
I.first, std::vector<std::pair<ValueInfo *, LocTy>>()));
|
||||
FwdRef.first->second.push_back(
|
||||
std::make_pair(&TI[P.first].VTableVI, P.second));
|
||||
Infos.emplace_back(&TI[P.first].VTableVI, P.second);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8445,9 +8443,7 @@ bool LLParser::ParseAliasSummary(std::string Name, GlobalValue::GUID GUID,
|
|||
|
||||
// Record forward reference if the aliasee is not parsed yet.
|
||||
if (AliaseeVI.getRef() == FwdVIRef) {
|
||||
auto FwdRef = ForwardRefAliasees.insert(
|
||||
std::make_pair(GVId, std::vector<std::pair<AliasSummary *, LocTy>>()));
|
||||
FwdRef.first->second.push_back(std::make_pair(AS.get(), Loc));
|
||||
ForwardRefAliasees[GVId].emplace_back(AS.get(), Loc);
|
||||
} else {
|
||||
auto Summary = Index->findSummaryInModule(AliaseeVI, ModulePath);
|
||||
assert(Summary && "Aliasee must be a definition");
|
||||
|
@ -8588,13 +8584,11 @@ bool LLParser::ParseOptionalCalls(std::vector<FunctionSummary::EdgeTy> &Calls) {
|
|||
// Now that the Calls vector is finalized, it is safe to save the locations
|
||||
// of any forward GV references that need updating later.
|
||||
for (auto I : IdToIndexMap) {
|
||||
auto &Infos = ForwardRefValueInfos[I.first];
|
||||
for (auto P : I.second) {
|
||||
assert(Calls[P.first].first.getRef() == FwdVIRef &&
|
||||
"Forward referenced ValueInfo expected to be empty");
|
||||
auto FwdRef = ForwardRefValueInfos.insert(std::make_pair(
|
||||
I.first, std::vector<std::pair<ValueInfo *, LocTy>>()));
|
||||
FwdRef.first->second.push_back(
|
||||
std::make_pair(&Calls[P.first].first, P.second));
|
||||
Infos.emplace_back(&Calls[P.first].first, P.second);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8675,13 +8669,11 @@ bool LLParser::ParseOptionalVTableFuncs(VTableFuncList &VTableFuncs) {
|
|||
// Now that the VTableFuncs vector is finalized, it is safe to save the
|
||||
// locations of any forward GV references that need updating later.
|
||||
for (auto I : IdToIndexMap) {
|
||||
auto &Infos = ForwardRefValueInfos[I.first];
|
||||
for (auto P : I.second) {
|
||||
assert(VTableFuncs[P.first].FuncVI == EmptyVI &&
|
||||
"Forward referenced ValueInfo expected to be empty");
|
||||
auto FwdRef = ForwardRefValueInfos.insert(std::make_pair(
|
||||
I.first, std::vector<std::pair<ValueInfo *, LocTy>>()));
|
||||
FwdRef.first->second.push_back(
|
||||
std::make_pair(&VTableFuncs[P.first].FuncVI, P.second));
|
||||
Infos.emplace_back(&VTableFuncs[P.first].FuncVI, P.second);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8856,12 +8848,11 @@ bool LLParser::ParseOptionalRefs(std::vector<ValueInfo> &Refs) {
|
|||
// Now that the Refs vector is finalized, it is safe to save the locations
|
||||
// of any forward GV references that need updating later.
|
||||
for (auto I : IdToIndexMap) {
|
||||
auto &Infos = ForwardRefValueInfos[I.first];
|
||||
for (auto P : I.second) {
|
||||
assert(Refs[P.first].getRef() == FwdVIRef &&
|
||||
"Forward referenced ValueInfo expected to be empty");
|
||||
auto FwdRef = ForwardRefValueInfos.insert(std::make_pair(
|
||||
I.first, std::vector<std::pair<ValueInfo *, LocTy>>()));
|
||||
FwdRef.first->second.push_back(std::make_pair(&Refs[P.first], P.second));
|
||||
Infos.emplace_back(&Refs[P.first], P.second);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8951,13 +8942,11 @@ bool LLParser::ParseTypeTests(std::vector<GlobalValue::GUID> &TypeTests) {
|
|||
// Now that the TypeTests vector is finalized, it is safe to save the
|
||||
// locations of any forward GV references that need updating later.
|
||||
for (auto I : IdToIndexMap) {
|
||||
auto &Ids = ForwardRefTypeIds[I.first];
|
||||
for (auto P : I.second) {
|
||||
assert(TypeTests[P.first] == 0 &&
|
||||
"Forward referenced type id GUID expected to be 0");
|
||||
auto FwdRef = ForwardRefTypeIds.insert(std::make_pair(
|
||||
I.first, std::vector<std::pair<GlobalValue::GUID *, LocTy>>()));
|
||||
FwdRef.first->second.push_back(
|
||||
std::make_pair(&TypeTests[P.first], P.second));
|
||||
Ids.emplace_back(&TypeTests[P.first], P.second);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8992,13 +8981,11 @@ bool LLParser::ParseVFuncIdList(
|
|||
// Now that the VFuncIdList vector is finalized, it is safe to save the
|
||||
// locations of any forward GV references that need updating later.
|
||||
for (auto I : IdToIndexMap) {
|
||||
auto &Ids = ForwardRefTypeIds[I.first];
|
||||
for (auto P : I.second) {
|
||||
assert(VFuncIdList[P.first].GUID == 0 &&
|
||||
"Forward referenced type id GUID expected to be 0");
|
||||
auto FwdRef = ForwardRefTypeIds.insert(std::make_pair(
|
||||
I.first, std::vector<std::pair<GlobalValue::GUID *, LocTy>>()));
|
||||
FwdRef.first->second.push_back(
|
||||
std::make_pair(&VFuncIdList[P.first].GUID, P.second));
|
||||
Ids.emplace_back(&VFuncIdList[P.first].GUID, P.second);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9031,13 +9018,11 @@ bool LLParser::ParseConstVCallList(
|
|||
// Now that the ConstVCallList vector is finalized, it is safe to save the
|
||||
// locations of any forward GV references that need updating later.
|
||||
for (auto I : IdToIndexMap) {
|
||||
auto &Ids = ForwardRefTypeIds[I.first];
|
||||
for (auto P : I.second) {
|
||||
assert(ConstVCallList[P.first].VFunc.GUID == 0 &&
|
||||
"Forward referenced type id GUID expected to be 0");
|
||||
auto FwdRef = ForwardRefTypeIds.insert(std::make_pair(
|
||||
I.first, std::vector<std::pair<GlobalValue::GUID *, LocTy>>()));
|
||||
FwdRef.first->second.push_back(
|
||||
std::make_pair(&ConstVCallList[P.first].VFunc.GUID, P.second));
|
||||
Ids.emplace_back(&ConstVCallList[P.first].VFunc.GUID, P.second);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue