10b57cec5SDimitry Andric //===- lib/Transforms/Utils/FunctionImportUtils.cpp - Importing utilities -===// 20b57cec5SDimitry Andric // 30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 60b57cec5SDimitry Andric // 70b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 80b57cec5SDimitry Andric // 90b57cec5SDimitry Andric // This file implements the FunctionImportGlobalProcessing class, used 100b57cec5SDimitry Andric // to perform the necessary global value handling for function importing. 110b57cec5SDimitry Andric // 120b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 130b57cec5SDimitry Andric 140b57cec5SDimitry Andric #include "llvm/Transforms/Utils/FunctionImportUtils.h" 150b57cec5SDimitry Andric using namespace llvm; 160b57cec5SDimitry Andric 170b57cec5SDimitry Andric /// Checks if we should import SGV as a definition, otherwise import as a 180b57cec5SDimitry Andric /// declaration. 190b57cec5SDimitry Andric bool FunctionImportGlobalProcessing::doImportAsDefinition( 20480093f4SDimitry Andric const GlobalValue *SGV) { 21480093f4SDimitry Andric if (!isPerformingImport()) 22480093f4SDimitry Andric return false; 230b57cec5SDimitry Andric 240b57cec5SDimitry Andric // Only import the globals requested for importing. 250b57cec5SDimitry Andric if (!GlobalsToImport->count(const_cast<GlobalValue *>(SGV))) 260b57cec5SDimitry Andric return false; 270b57cec5SDimitry Andric 280b57cec5SDimitry Andric assert(!isa<GlobalAlias>(SGV) && 290b57cec5SDimitry Andric "Unexpected global alias in the import list."); 300b57cec5SDimitry Andric 310b57cec5SDimitry Andric // Otherwise yes. 320b57cec5SDimitry Andric return true; 330b57cec5SDimitry Andric } 340b57cec5SDimitry Andric 350b57cec5SDimitry Andric bool FunctionImportGlobalProcessing::shouldPromoteLocalToGlobal( 36480093f4SDimitry Andric const GlobalValue *SGV, ValueInfo VI) { 370b57cec5SDimitry Andric assert(SGV->hasLocalLinkage()); 38fcaf7f86SDimitry Andric 39fcaf7f86SDimitry Andric // Ifuncs and ifunc alias does not have summary. 40fcaf7f86SDimitry Andric if (isa<GlobalIFunc>(SGV) || 41fcaf7f86SDimitry Andric (isa<GlobalAlias>(SGV) && 42fcaf7f86SDimitry Andric isa<GlobalIFunc>(cast<GlobalAlias>(SGV)->getAliaseeObject()))) 43fcaf7f86SDimitry Andric return false; 44fcaf7f86SDimitry Andric 450b57cec5SDimitry Andric // Both the imported references and the original local variable must 460b57cec5SDimitry Andric // be promoted. 470b57cec5SDimitry Andric if (!isPerformingImport() && !isModuleExporting()) 480b57cec5SDimitry Andric return false; 490b57cec5SDimitry Andric 500b57cec5SDimitry Andric if (isPerformingImport()) { 510b57cec5SDimitry Andric assert((!GlobalsToImport->count(const_cast<GlobalValue *>(SGV)) || 520b57cec5SDimitry Andric !isNonRenamableLocal(*SGV)) && 530b57cec5SDimitry Andric "Attempting to promote non-renamable local"); 540b57cec5SDimitry Andric // We don't know for sure yet if we are importing this value (as either 550b57cec5SDimitry Andric // a reference or a def), since we are simply walking all values in the 560b57cec5SDimitry Andric // module. But by necessity if we end up importing it and it is local, 570b57cec5SDimitry Andric // it must be promoted, so unconditionally promote all values in the 580b57cec5SDimitry Andric // importing module. 590b57cec5SDimitry Andric return true; 600b57cec5SDimitry Andric } 610b57cec5SDimitry Andric 620b57cec5SDimitry Andric // When exporting, consult the index. We can have more than one local 630b57cec5SDimitry Andric // with the same GUID, in the case of same-named locals in different but 640b57cec5SDimitry Andric // same-named source files that were compiled in their respective directories 650b57cec5SDimitry Andric // (so the source file name and resulting GUID is the same). Find the one 660b57cec5SDimitry Andric // in this module. 670b57cec5SDimitry Andric auto Summary = ImportIndex.findSummaryInModule( 68480093f4SDimitry Andric VI, SGV->getParent()->getModuleIdentifier()); 690b57cec5SDimitry Andric assert(Summary && "Missing summary for global value when exporting"); 700b57cec5SDimitry Andric auto Linkage = Summary->linkage(); 710b57cec5SDimitry Andric if (!GlobalValue::isLocalLinkage(Linkage)) { 720b57cec5SDimitry Andric assert(!isNonRenamableLocal(*SGV) && 730b57cec5SDimitry Andric "Attempting to promote non-renamable local"); 740b57cec5SDimitry Andric return true; 750b57cec5SDimitry Andric } 760b57cec5SDimitry Andric 770b57cec5SDimitry Andric return false; 780b57cec5SDimitry Andric } 790b57cec5SDimitry Andric 800b57cec5SDimitry Andric #ifndef NDEBUG 810b57cec5SDimitry Andric bool FunctionImportGlobalProcessing::isNonRenamableLocal( 820b57cec5SDimitry Andric const GlobalValue &GV) const { 830b57cec5SDimitry Andric if (!GV.hasLocalLinkage()) 840b57cec5SDimitry Andric return false; 850b57cec5SDimitry Andric // This needs to stay in sync with the logic in buildModuleSummaryIndex. 860b57cec5SDimitry Andric if (GV.hasSection()) 870b57cec5SDimitry Andric return true; 880b57cec5SDimitry Andric if (Used.count(const_cast<GlobalValue *>(&GV))) 890b57cec5SDimitry Andric return true; 900b57cec5SDimitry Andric return false; 910b57cec5SDimitry Andric } 920b57cec5SDimitry Andric #endif 930b57cec5SDimitry Andric 94480093f4SDimitry Andric std::string 95480093f4SDimitry Andric FunctionImportGlobalProcessing::getPromotedName(const GlobalValue *SGV) { 96480093f4SDimitry Andric assert(SGV->hasLocalLinkage()); 970b57cec5SDimitry Andric // For locals that must be promoted to global scope, ensure that 980b57cec5SDimitry Andric // the promoted name uniquely identifies the copy in the original module, 99480093f4SDimitry Andric // using the ID assigned during combined index creation. 1000b57cec5SDimitry Andric return ModuleSummaryIndex::getGlobalNameForLocal( 1010b57cec5SDimitry Andric SGV->getName(), 1020b57cec5SDimitry Andric ImportIndex.getModuleHash(SGV->getParent()->getModuleIdentifier())); 1030b57cec5SDimitry Andric } 1040b57cec5SDimitry Andric 1050b57cec5SDimitry Andric GlobalValue::LinkageTypes 1060b57cec5SDimitry Andric FunctionImportGlobalProcessing::getLinkage(const GlobalValue *SGV, 1070b57cec5SDimitry Andric bool DoPromote) { 1080b57cec5SDimitry Andric // Any local variable that is referenced by an exported function needs 1090b57cec5SDimitry Andric // to be promoted to global scope. Since we don't currently know which 1100b57cec5SDimitry Andric // functions reference which local variables/functions, we must treat 1110b57cec5SDimitry Andric // all as potentially exported if this module is exporting anything. 1120b57cec5SDimitry Andric if (isModuleExporting()) { 1130b57cec5SDimitry Andric if (SGV->hasLocalLinkage() && DoPromote) 1140b57cec5SDimitry Andric return GlobalValue::ExternalLinkage; 1150b57cec5SDimitry Andric return SGV->getLinkage(); 1160b57cec5SDimitry Andric } 1170b57cec5SDimitry Andric 1180b57cec5SDimitry Andric // Otherwise, if we aren't importing, no linkage change is needed. 1190b57cec5SDimitry Andric if (!isPerformingImport()) 1200b57cec5SDimitry Andric return SGV->getLinkage(); 1210b57cec5SDimitry Andric 1220b57cec5SDimitry Andric switch (SGV->getLinkage()) { 1230b57cec5SDimitry Andric case GlobalValue::LinkOnceODRLinkage: 1240b57cec5SDimitry Andric case GlobalValue::ExternalLinkage: 1250b57cec5SDimitry Andric // External and linkonce definitions are converted to available_externally 1260b57cec5SDimitry Andric // definitions upon import, so that they are available for inlining 1270b57cec5SDimitry Andric // and/or optimization, but are turned into declarations later 1280b57cec5SDimitry Andric // during the EliminateAvailableExternally pass. 1290b57cec5SDimitry Andric if (doImportAsDefinition(SGV) && !isa<GlobalAlias>(SGV)) 1300b57cec5SDimitry Andric return GlobalValue::AvailableExternallyLinkage; 1310b57cec5SDimitry Andric // An imported external declaration stays external. 1320b57cec5SDimitry Andric return SGV->getLinkage(); 1330b57cec5SDimitry Andric 1340b57cec5SDimitry Andric case GlobalValue::AvailableExternallyLinkage: 1350b57cec5SDimitry Andric // An imported available_externally definition converts 1360b57cec5SDimitry Andric // to external if imported as a declaration. 1370b57cec5SDimitry Andric if (!doImportAsDefinition(SGV)) 1380b57cec5SDimitry Andric return GlobalValue::ExternalLinkage; 1390b57cec5SDimitry Andric // An imported available_externally declaration stays that way. 1400b57cec5SDimitry Andric return SGV->getLinkage(); 1410b57cec5SDimitry Andric 1420b57cec5SDimitry Andric case GlobalValue::LinkOnceAnyLinkage: 1430b57cec5SDimitry Andric case GlobalValue::WeakAnyLinkage: 1440b57cec5SDimitry Andric // Can't import linkonce_any/weak_any definitions correctly, or we might 1450b57cec5SDimitry Andric // change the program semantics, since the linker will pick the first 1460b57cec5SDimitry Andric // linkonce_any/weak_any definition and importing would change the order 1470b57cec5SDimitry Andric // they are seen by the linker. The module linking caller needs to enforce 1480b57cec5SDimitry Andric // this. 1490b57cec5SDimitry Andric assert(!doImportAsDefinition(SGV)); 1500b57cec5SDimitry Andric // If imported as a declaration, it becomes external_weak. 1510b57cec5SDimitry Andric return SGV->getLinkage(); 1520b57cec5SDimitry Andric 1530b57cec5SDimitry Andric case GlobalValue::WeakODRLinkage: 1540b57cec5SDimitry Andric // For weak_odr linkage, there is a guarantee that all copies will be 1550b57cec5SDimitry Andric // equivalent, so the issue described above for weak_any does not exist, 1560b57cec5SDimitry Andric // and the definition can be imported. It can be treated similarly 1570b57cec5SDimitry Andric // to an imported externally visible global value. 1580b57cec5SDimitry Andric if (doImportAsDefinition(SGV) && !isa<GlobalAlias>(SGV)) 1590b57cec5SDimitry Andric return GlobalValue::AvailableExternallyLinkage; 1600b57cec5SDimitry Andric else 1610b57cec5SDimitry Andric return GlobalValue::ExternalLinkage; 1620b57cec5SDimitry Andric 1630b57cec5SDimitry Andric case GlobalValue::AppendingLinkage: 1640b57cec5SDimitry Andric // It would be incorrect to import an appending linkage variable, 1650b57cec5SDimitry Andric // since it would cause global constructors/destructors to be 1660b57cec5SDimitry Andric // executed multiple times. This should have already been handled 1670b57cec5SDimitry Andric // by linkIfNeeded, and we will assert in shouldLinkFromSource 1680b57cec5SDimitry Andric // if we try to import, so we simply return AppendingLinkage. 1690b57cec5SDimitry Andric return GlobalValue::AppendingLinkage; 1700b57cec5SDimitry Andric 1710b57cec5SDimitry Andric case GlobalValue::InternalLinkage: 1720b57cec5SDimitry Andric case GlobalValue::PrivateLinkage: 1730b57cec5SDimitry Andric // If we are promoting the local to global scope, it is handled 1740b57cec5SDimitry Andric // similarly to a normal externally visible global. 1750b57cec5SDimitry Andric if (DoPromote) { 1760b57cec5SDimitry Andric if (doImportAsDefinition(SGV) && !isa<GlobalAlias>(SGV)) 1770b57cec5SDimitry Andric return GlobalValue::AvailableExternallyLinkage; 1780b57cec5SDimitry Andric else 1790b57cec5SDimitry Andric return GlobalValue::ExternalLinkage; 1800b57cec5SDimitry Andric } 1810b57cec5SDimitry Andric // A non-promoted imported local definition stays local. 1820b57cec5SDimitry Andric // The ThinLTO pass will eventually force-import their definitions. 1830b57cec5SDimitry Andric return SGV->getLinkage(); 1840b57cec5SDimitry Andric 1850b57cec5SDimitry Andric case GlobalValue::ExternalWeakLinkage: 1860b57cec5SDimitry Andric // External weak doesn't apply to definitions, must be a declaration. 1870b57cec5SDimitry Andric assert(!doImportAsDefinition(SGV)); 1880b57cec5SDimitry Andric // Linkage stays external_weak. 1890b57cec5SDimitry Andric return SGV->getLinkage(); 1900b57cec5SDimitry Andric 1910b57cec5SDimitry Andric case GlobalValue::CommonLinkage: 1920b57cec5SDimitry Andric // Linkage stays common on definitions. 1930b57cec5SDimitry Andric // The ThinLTO pass will eventually force-import their definitions. 1940b57cec5SDimitry Andric return SGV->getLinkage(); 1950b57cec5SDimitry Andric } 1960b57cec5SDimitry Andric 1970b57cec5SDimitry Andric llvm_unreachable("unknown linkage type"); 1980b57cec5SDimitry Andric } 1990b57cec5SDimitry Andric 2000b57cec5SDimitry Andric void FunctionImportGlobalProcessing::processGlobalForThinLTO(GlobalValue &GV) { 2010b57cec5SDimitry Andric 2020b57cec5SDimitry Andric ValueInfo VI; 2030b57cec5SDimitry Andric if (GV.hasName()) { 2040b57cec5SDimitry Andric VI = ImportIndex.getValueInfo(GV.getGUID()); 2050b57cec5SDimitry Andric // Set synthetic function entry counts. 2060b57cec5SDimitry Andric if (VI && ImportIndex.hasSyntheticEntryCounts()) { 2070b57cec5SDimitry Andric if (Function *F = dyn_cast<Function>(&GV)) { 2080b57cec5SDimitry Andric if (!F->isDeclaration()) { 2090b57cec5SDimitry Andric for (auto &S : VI.getSummaryList()) { 2108bcb0991SDimitry Andric auto *FS = cast<FunctionSummary>(S->getBaseObject()); 2110b57cec5SDimitry Andric if (FS->modulePath() == M.getModuleIdentifier()) { 2120b57cec5SDimitry Andric F->setEntryCount(Function::ProfileCount(FS->entryCount(), 2130b57cec5SDimitry Andric Function::PCT_Synthetic)); 2140b57cec5SDimitry Andric break; 2150b57cec5SDimitry Andric } 2160b57cec5SDimitry Andric } 2170b57cec5SDimitry Andric } 2180b57cec5SDimitry Andric } 2190b57cec5SDimitry Andric } 2200b57cec5SDimitry Andric } 2210b57cec5SDimitry Andric 222480093f4SDimitry Andric // We should always have a ValueInfo (i.e. GV in index) for definitions when 223480093f4SDimitry Andric // we are exporting, and also when importing that value. 224480093f4SDimitry Andric assert(VI || GV.isDeclaration() || 225480093f4SDimitry Andric (isPerformingImport() && !doImportAsDefinition(&GV))); 226480093f4SDimitry Andric 2270b57cec5SDimitry Andric // Mark read/write-only variables which can be imported with specific 2280b57cec5SDimitry Andric // attribute. We can't internalize them now because IRMover will fail 2290b57cec5SDimitry Andric // to link variable definitions to their external declarations during 2300b57cec5SDimitry Andric // ThinLTO import. We'll internalize read-only variables later, after 2310b57cec5SDimitry Andric // import is finished. See internalizeGVsAfterImport. 2320b57cec5SDimitry Andric // 2330b57cec5SDimitry Andric // If global value dead stripping is not enabled in summary then 2340b57cec5SDimitry Andric // propagateConstants hasn't been run. We can't internalize GV 2350b57cec5SDimitry Andric // in such case. 236480093f4SDimitry Andric if (!GV.isDeclaration() && VI && ImportIndex.withAttributePropagation()) { 237480093f4SDimitry Andric if (GlobalVariable *V = dyn_cast<GlobalVariable>(&GV)) { 238480093f4SDimitry Andric // We can have more than one local with the same GUID, in the case of 239480093f4SDimitry Andric // same-named locals in different but same-named source files that were 240480093f4SDimitry Andric // compiled in their respective directories (so the source file name 241480093f4SDimitry Andric // and resulting GUID is the same). Find the one in this module. 242480093f4SDimitry Andric // Handle the case where there is no summary found in this module. That 243480093f4SDimitry Andric // can happen in the distributed ThinLTO backend, because the index only 244480093f4SDimitry Andric // contains summaries from the source modules if they are being imported. 245480093f4SDimitry Andric // We might have a non-null VI and get here even in that case if the name 246480093f4SDimitry Andric // matches one in this module (e.g. weak or appending linkage). 247480093f4SDimitry Andric auto *GVS = dyn_cast_or_null<GlobalVarSummary>( 248480093f4SDimitry Andric ImportIndex.findSummaryInModule(VI, M.getModuleIdentifier())); 249480093f4SDimitry Andric if (GVS && 250480093f4SDimitry Andric (ImportIndex.isReadOnly(GVS) || ImportIndex.isWriteOnly(GVS))) { 251480093f4SDimitry Andric V->addAttribute("thinlto-internalize"); 252480093f4SDimitry Andric // Objects referenced by writeonly GV initializer should not be 253480093f4SDimitry Andric // promoted, because there is no any kind of read access to them 254480093f4SDimitry Andric // on behalf of this writeonly GV. To avoid promotion we convert 255480093f4SDimitry Andric // GV initializer to 'zeroinitializer'. This effectively drops 256480093f4SDimitry Andric // references in IR module (not in combined index), so we can 257480093f4SDimitry Andric // ignore them when computing import. We do not export references 258480093f4SDimitry Andric // of writeonly object. See computeImportForReferencedGlobals 259480093f4SDimitry Andric if (ImportIndex.isWriteOnly(GVS)) 260480093f4SDimitry Andric V->setInitializer(Constant::getNullValue(V->getValueType())); 261480093f4SDimitry Andric } 262480093f4SDimitry Andric } 2630b57cec5SDimitry Andric } 2640b57cec5SDimitry Andric 265480093f4SDimitry Andric if (GV.hasLocalLinkage() && shouldPromoteLocalToGlobal(&GV, VI)) { 2660b57cec5SDimitry Andric // Save the original name string before we rename GV below. 2670b57cec5SDimitry Andric auto Name = GV.getName().str(); 268480093f4SDimitry Andric GV.setName(getPromotedName(&GV)); 269480093f4SDimitry Andric GV.setLinkage(getLinkage(&GV, /* DoPromote */ true)); 270480093f4SDimitry Andric assert(!GV.hasLocalLinkage()); 2710b57cec5SDimitry Andric GV.setVisibility(GlobalValue::HiddenVisibility); 2720b57cec5SDimitry Andric 2730b57cec5SDimitry Andric // If we are renaming a COMDAT leader, ensure that we record the COMDAT 2740b57cec5SDimitry Andric // for later renaming as well. This is required for COFF. 2750b57cec5SDimitry Andric if (const auto *C = GV.getComdat()) 2760b57cec5SDimitry Andric if (C->getName() == Name) 2770b57cec5SDimitry Andric RenamedComdats.try_emplace(C, M.getOrInsertComdat(GV.getName())); 2780b57cec5SDimitry Andric } else 2790b57cec5SDimitry Andric GV.setLinkage(getLinkage(&GV, /* DoPromote */ false)); 2800b57cec5SDimitry Andric 2815ffd83dbSDimitry Andric // When ClearDSOLocalOnDeclarations is true, clear dso_local if GV is 2825ffd83dbSDimitry Andric // converted to a declaration, to disable direct access. Don't do this if GV 2835ffd83dbSDimitry Andric // is implicitly dso_local due to a non-default visibility. 284fe6060f1SDimitry Andric if (ClearDSOLocalOnDeclarations && 285fe6060f1SDimitry Andric (GV.isDeclarationForLinker() || 286fe6060f1SDimitry Andric (isPerformingImport() && !doImportAsDefinition(&GV))) && 2875ffd83dbSDimitry Andric !GV.isImplicitDSOLocal()) { 2885ffd83dbSDimitry Andric GV.setDSOLocal(false); 289fe6060f1SDimitry Andric } else if (VI && VI.isDSOLocal(ImportIndex.withDSOLocalPropagation())) { 2905ffd83dbSDimitry Andric // If all summaries are dso_local, symbol gets resolved to a known local 2915ffd83dbSDimitry Andric // definition. 2925ffd83dbSDimitry Andric GV.setDSOLocal(true); 2935ffd83dbSDimitry Andric if (GV.hasDLLImportStorageClass()) 2945ffd83dbSDimitry Andric GV.setDLLStorageClass(GlobalValue::DefaultStorageClass); 2955ffd83dbSDimitry Andric } 2965ffd83dbSDimitry Andric 2970b57cec5SDimitry Andric // Remove functions imported as available externally defs from comdats, 2980b57cec5SDimitry Andric // as this is a declaration for the linker, and will be dropped eventually. 2990b57cec5SDimitry Andric // It is illegal for comdats to contain declarations. 3000b57cec5SDimitry Andric auto *GO = dyn_cast<GlobalObject>(&GV); 3010b57cec5SDimitry Andric if (GO && GO->isDeclarationForLinker() && GO->hasComdat()) { 3020b57cec5SDimitry Andric // The IRMover should not have placed any imported declarations in 3030b57cec5SDimitry Andric // a comdat, so the only declaration that should be in a comdat 3040b57cec5SDimitry Andric // at this point would be a definition imported as available_externally. 3050b57cec5SDimitry Andric assert(GO->hasAvailableExternallyLinkage() && 3060b57cec5SDimitry Andric "Expected comdat on definition (possibly available external)"); 3070b57cec5SDimitry Andric GO->setComdat(nullptr); 3080b57cec5SDimitry Andric } 3090b57cec5SDimitry Andric } 3100b57cec5SDimitry Andric 3110b57cec5SDimitry Andric void FunctionImportGlobalProcessing::processGlobalsForThinLTO() { 3120b57cec5SDimitry Andric for (GlobalVariable &GV : M.globals()) 3130b57cec5SDimitry Andric processGlobalForThinLTO(GV); 3140b57cec5SDimitry Andric for (Function &SF : M) 3150b57cec5SDimitry Andric processGlobalForThinLTO(SF); 3160b57cec5SDimitry Andric for (GlobalAlias &GA : M.aliases()) 3170b57cec5SDimitry Andric processGlobalForThinLTO(GA); 3180b57cec5SDimitry Andric 3190b57cec5SDimitry Andric // Replace any COMDATS that required renaming (because the COMDAT leader was 3200b57cec5SDimitry Andric // promoted and renamed). 3210b57cec5SDimitry Andric if (!RenamedComdats.empty()) 3220b57cec5SDimitry Andric for (auto &GO : M.global_objects()) 3230b57cec5SDimitry Andric if (auto *C = GO.getComdat()) { 3240b57cec5SDimitry Andric auto Replacement = RenamedComdats.find(C); 3250b57cec5SDimitry Andric if (Replacement != RenamedComdats.end()) 3260b57cec5SDimitry Andric GO.setComdat(Replacement->second); 3270b57cec5SDimitry Andric } 3280b57cec5SDimitry Andric } 3290b57cec5SDimitry Andric 3300b57cec5SDimitry Andric bool FunctionImportGlobalProcessing::run() { 3310b57cec5SDimitry Andric processGlobalsForThinLTO(); 3320b57cec5SDimitry Andric return false; 3330b57cec5SDimitry Andric } 3340b57cec5SDimitry Andric 3350b57cec5SDimitry Andric bool llvm::renameModuleForThinLTO(Module &M, const ModuleSummaryIndex &Index, 3365ffd83dbSDimitry Andric bool ClearDSOLocalOnDeclarations, 3370b57cec5SDimitry Andric SetVector<GlobalValue *> *GlobalsToImport) { 3385ffd83dbSDimitry Andric FunctionImportGlobalProcessing ThinLTOProcessing(M, Index, GlobalsToImport, 3395ffd83dbSDimitry Andric ClearDSOLocalOnDeclarations); 3400b57cec5SDimitry Andric return ThinLTOProcessing.run(); 3410b57cec5SDimitry Andric } 342