diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -7786,13 +7786,11 @@ // 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>())); - 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 @@ // Record forward reference if the aliasee is not parsed yet. if (AliaseeVI.getRef() == FwdVIRef) { - auto FwdRef = ForwardRefAliasees.insert( - std::make_pair(GVId, std::vector>())); - 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 @@ // 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>())); - 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 @@ // 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>())); - 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 @@ // 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>())); - 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 @@ // 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>())); - 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 @@ // 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>())); - 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 @@ // 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>())); - 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); } }