Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/LTO/LTO.cpp
Show First 20 Lines • Show All 976 Lines • ▼ Show 20 Lines | if (OldGV) { | ||||
OldGV->replaceAllUsesWith(ConstantExpr::getBitCast(GV, OldGV->getType())); | OldGV->replaceAllUsesWith(ConstantExpr::getBitCast(GV, OldGV->getType())); | ||||
GV->takeName(OldGV); | GV->takeName(OldGV); | ||||
OldGV->eraseFromParent(); | OldGV->eraseFromParent(); | ||||
} else { | } else { | ||||
GV->setName(I.first); | GV->setName(I.first); | ||||
} | } | ||||
} | } | ||||
// If allowed, upgrade public vcall visibility metadata to linkage unit | |||||
// visibility before whole program devirtualization in the optimizer. | |||||
updateVCallVisibilityInModule(*RegularLTO.CombinedModule, | |||||
Conf.HasWholeProgramVisibility); | |||||
if (Conf.PreOptModuleHook && | if (Conf.PreOptModuleHook && | ||||
!Conf.PreOptModuleHook(0, *RegularLTO.CombinedModule)) | !Conf.PreOptModuleHook(0, *RegularLTO.CombinedModule)) | ||||
return Error::success(); | return Error::success(); | ||||
if (!Conf.CodeGenOnly) { | if (!Conf.CodeGenOnly) { | ||||
for (const auto &R : GlobalResolutions) { | for (const auto &R : GlobalResolutions) { | ||||
if (!R.second.isPrevailingIRSymbol()) | if (!R.second.isPrevailingIRSymbol()) | ||||
continue; | continue; | ||||
▲ Show 20 Lines • Show All 301 Lines • ▼ Show 20 Lines | StringMap<FunctionImporter::ExportSetTy> ExportLists( | ||||
ThinLTO.ModuleMap.size()); | ThinLTO.ModuleMap.size()); | ||||
StringMap<std::map<GlobalValue::GUID, GlobalValue::LinkageTypes>> ResolvedODR; | StringMap<std::map<GlobalValue::GUID, GlobalValue::LinkageTypes>> ResolvedODR; | ||||
if (DumpThinCGSCCs) | if (DumpThinCGSCCs) | ||||
ThinLTO.CombinedIndex.dumpSCCs(outs()); | ThinLTO.CombinedIndex.dumpSCCs(outs()); | ||||
std::set<GlobalValue::GUID> ExportedGUIDs; | std::set<GlobalValue::GUID> ExportedGUIDs; | ||||
// If allowed, upgrade public vcall visibility to linkage unit visibility in | |||||
// the summaries before whole program devirtualization below. | |||||
updateVCallVisibilityInIndex(ThinLTO.CombinedIndex, | |||||
Conf.HasWholeProgramVisibility); | |||||
// Perform index-based WPD. This will return immediately if there are | // Perform index-based WPD. This will return immediately if there are | ||||
// no index entries in the typeIdMetadata map (e.g. if we are instead | // no index entries in the typeIdMetadata map (e.g. if we are instead | ||||
// performing IR-based WPD in hybrid regular/thin LTO mode). | // performing IR-based WPD in hybrid regular/thin LTO mode). | ||||
std::map<ValueInfo, std::vector<VTableSlotSummary>> LocalWPDTargetsMap; | std::map<ValueInfo, std::vector<VTableSlotSummary>> LocalWPDTargetsMap; | ||||
runWholeProgramDevirtOnIndex(ThinLTO.CombinedIndex, ExportedGUIDs, | runWholeProgramDevirtOnIndex(ThinLTO.CombinedIndex, ExportedGUIDs, | ||||
LocalWPDTargetsMap); | LocalWPDTargetsMap); | ||||
if (Conf.OptLevel > 0) | if (Conf.OptLevel > 0) | ||||
▲ Show 20 Lines • Show All 109 Lines • Show Last 20 Lines |