Lines Matching refs:GV
367 auto mayPreserveGlobal = [&](GlobalValue &GV) { in preserveDiscardableGVs() argument
368 if (!GV.isDiscardableIfUnused() || GV.isDeclaration() || in preserveDiscardableGVs()
369 !mustPreserveGV(GV)) in preserveDiscardableGVs()
371 if (GV.hasAvailableExternallyLinkage()) in preserveDiscardableGVs()
374 GV.getName() + "'").str()); in preserveDiscardableGVs()
375 if (GV.hasInternalLinkage()) in preserveDiscardableGVs()
377 GV.getName() + "'").str()); in preserveDiscardableGVs()
378 Used.push_back(&GV); in preserveDiscardableGVs()
380 for (auto &GV : TheModule) in preserveDiscardableGVs() local
381 mayPreserveGlobal(GV); in preserveDiscardableGVs()
382 for (auto &GV : TheModule.globals()) in preserveDiscardableGVs() local
383 mayPreserveGlobal(GV); in preserveDiscardableGVs()
384 for (auto &GV : TheModule.aliases()) in preserveDiscardableGVs() local
385 mayPreserveGlobal(GV); in preserveDiscardableGVs()
401 auto mustPreserveGV = [&](const GlobalValue &GV) -> bool { in applyScopeRestrictions() argument
403 if (!GV.hasName()) in applyScopeRestrictions()
410 MangledName.reserve(GV.getName().size() + 1); in applyScopeRestrictions()
411 Mang.getNameWithPrefix(MangledName, &GV, /*CannotUsePrivateLabel=*/false); in applyScopeRestrictions()
425 auto RecordLinkage = [&](const GlobalValue &GV) { in applyScopeRestrictions() argument
426 if (!GV.hasAvailableExternallyLinkage() && !GV.hasLocalLinkage() && in applyScopeRestrictions()
427 GV.hasName()) in applyScopeRestrictions()
428 ExternalSymbols.insert(std::make_pair(GV.getName(), GV.getLinkage())); in applyScopeRestrictions()
430 for (auto &GV : *MergedModule) in applyScopeRestrictions()
431 RecordLinkage(GV); in applyScopeRestrictions()
432 for (auto &GV : MergedModule->globals()) in applyScopeRestrictions() local
433 RecordLinkage(GV); in applyScopeRestrictions()
434 for (auto &GV : MergedModule->aliases()) in applyScopeRestrictions() local
435 RecordLinkage(GV); in applyScopeRestrictions()
458 auto externalize = [this](GlobalValue &GV) { in restoreLinkageForExternals() argument
459 if (!GV.hasLocalLinkage() || !GV.hasName()) in restoreLinkageForExternals()
462 auto I = ExternalSymbols.find(GV.getName()); in restoreLinkageForExternals()
466 GV.setLinkage(I->second); in restoreLinkageForExternals()