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"
15480093f4SDimitry Andric #include "llvm/IR/Constants.h"
160b57cec5SDimitry Andric #include "llvm/IR/InstIterator.h"
170b57cec5SDimitry Andric using namespace llvm;
180b57cec5SDimitry Andric
190b57cec5SDimitry Andric /// Checks if we should import SGV as a definition, otherwise import as a
200b57cec5SDimitry Andric /// declaration.
doImportAsDefinition(const GlobalValue * SGV)210b57cec5SDimitry Andric bool FunctionImportGlobalProcessing::doImportAsDefinition(
22480093f4SDimitry Andric const GlobalValue *SGV) {
23480093f4SDimitry Andric if (!isPerformingImport())
24480093f4SDimitry Andric return false;
250b57cec5SDimitry Andric
260b57cec5SDimitry Andric // Only import the globals requested for importing.
270b57cec5SDimitry Andric if (!GlobalsToImport->count(const_cast<GlobalValue *>(SGV)))
280b57cec5SDimitry Andric return false;
290b57cec5SDimitry Andric
300b57cec5SDimitry Andric assert(!isa<GlobalAlias>(SGV) &&
310b57cec5SDimitry Andric "Unexpected global alias in the import list.");
320b57cec5SDimitry Andric
330b57cec5SDimitry Andric // Otherwise yes.
340b57cec5SDimitry Andric return true;
350b57cec5SDimitry Andric }
360b57cec5SDimitry Andric
shouldPromoteLocalToGlobal(const GlobalValue * SGV,ValueInfo VI)370b57cec5SDimitry Andric bool FunctionImportGlobalProcessing::shouldPromoteLocalToGlobal(
38480093f4SDimitry Andric const GlobalValue *SGV, ValueInfo VI) {
390b57cec5SDimitry Andric assert(SGV->hasLocalLinkage());
400b57cec5SDimitry Andric // Both the imported references and the original local variable must
410b57cec5SDimitry Andric // be promoted.
420b57cec5SDimitry Andric if (!isPerformingImport() && !isModuleExporting())
430b57cec5SDimitry Andric return false;
440b57cec5SDimitry Andric
450b57cec5SDimitry Andric if (isPerformingImport()) {
460b57cec5SDimitry Andric assert((!GlobalsToImport->count(const_cast<GlobalValue *>(SGV)) ||
470b57cec5SDimitry Andric !isNonRenamableLocal(*SGV)) &&
480b57cec5SDimitry Andric "Attempting to promote non-renamable local");
490b57cec5SDimitry Andric // We don't know for sure yet if we are importing this value (as either
500b57cec5SDimitry Andric // a reference or a def), since we are simply walking all values in the
510b57cec5SDimitry Andric // module. But by necessity if we end up importing it and it is local,
520b57cec5SDimitry Andric // it must be promoted, so unconditionally promote all values in the
530b57cec5SDimitry Andric // importing module.
540b57cec5SDimitry Andric return true;
550b57cec5SDimitry Andric }
560b57cec5SDimitry Andric
570b57cec5SDimitry Andric // When exporting, consult the index. We can have more than one local
580b57cec5SDimitry Andric // with the same GUID, in the case of same-named locals in different but
590b57cec5SDimitry Andric // same-named source files that were compiled in their respective directories
600b57cec5SDimitry Andric // (so the source file name and resulting GUID is the same). Find the one
610b57cec5SDimitry Andric // in this module.
620b57cec5SDimitry Andric auto Summary = ImportIndex.findSummaryInModule(
63480093f4SDimitry Andric VI, SGV->getParent()->getModuleIdentifier());
640b57cec5SDimitry Andric assert(Summary && "Missing summary for global value when exporting");
650b57cec5SDimitry Andric auto Linkage = Summary->linkage();
660b57cec5SDimitry Andric if (!GlobalValue::isLocalLinkage(Linkage)) {
670b57cec5SDimitry Andric assert(!isNonRenamableLocal(*SGV) &&
680b57cec5SDimitry Andric "Attempting to promote non-renamable local");
690b57cec5SDimitry Andric return true;
700b57cec5SDimitry Andric }
710b57cec5SDimitry Andric
720b57cec5SDimitry Andric return false;
730b57cec5SDimitry Andric }
740b57cec5SDimitry Andric
750b57cec5SDimitry Andric #ifndef NDEBUG
isNonRenamableLocal(const GlobalValue & GV) const760b57cec5SDimitry Andric bool FunctionImportGlobalProcessing::isNonRenamableLocal(
770b57cec5SDimitry Andric const GlobalValue &GV) const {
780b57cec5SDimitry Andric if (!GV.hasLocalLinkage())
790b57cec5SDimitry Andric return false;
800b57cec5SDimitry Andric // This needs to stay in sync with the logic in buildModuleSummaryIndex.
810b57cec5SDimitry Andric if (GV.hasSection())
820b57cec5SDimitry Andric return true;
830b57cec5SDimitry Andric if (Used.count(const_cast<GlobalValue *>(&GV)))
840b57cec5SDimitry Andric return true;
850b57cec5SDimitry Andric return false;
860b57cec5SDimitry Andric }
870b57cec5SDimitry Andric #endif
880b57cec5SDimitry Andric
89480093f4SDimitry Andric std::string
getPromotedName(const GlobalValue * SGV)90480093f4SDimitry Andric FunctionImportGlobalProcessing::getPromotedName(const GlobalValue *SGV) {
91480093f4SDimitry Andric assert(SGV->hasLocalLinkage());
920b57cec5SDimitry Andric // For locals that must be promoted to global scope, ensure that
930b57cec5SDimitry Andric // the promoted name uniquely identifies the copy in the original module,
94480093f4SDimitry Andric // using the ID assigned during combined index creation.
950b57cec5SDimitry Andric return ModuleSummaryIndex::getGlobalNameForLocal(
960b57cec5SDimitry Andric SGV->getName(),
970b57cec5SDimitry Andric ImportIndex.getModuleHash(SGV->getParent()->getModuleIdentifier()));
980b57cec5SDimitry Andric }
990b57cec5SDimitry Andric
1000b57cec5SDimitry Andric GlobalValue::LinkageTypes
getLinkage(const GlobalValue * SGV,bool DoPromote)1010b57cec5SDimitry Andric FunctionImportGlobalProcessing::getLinkage(const GlobalValue *SGV,
1020b57cec5SDimitry Andric bool DoPromote) {
1030b57cec5SDimitry Andric // Any local variable that is referenced by an exported function needs
1040b57cec5SDimitry Andric // to be promoted to global scope. Since we don't currently know which
1050b57cec5SDimitry Andric // functions reference which local variables/functions, we must treat
1060b57cec5SDimitry Andric // all as potentially exported if this module is exporting anything.
1070b57cec5SDimitry Andric if (isModuleExporting()) {
1080b57cec5SDimitry Andric if (SGV->hasLocalLinkage() && DoPromote)
1090b57cec5SDimitry Andric return GlobalValue::ExternalLinkage;
1100b57cec5SDimitry Andric return SGV->getLinkage();
1110b57cec5SDimitry Andric }
1120b57cec5SDimitry Andric
1130b57cec5SDimitry Andric // Otherwise, if we aren't importing, no linkage change is needed.
1140b57cec5SDimitry Andric if (!isPerformingImport())
1150b57cec5SDimitry Andric return SGV->getLinkage();
1160b57cec5SDimitry Andric
1170b57cec5SDimitry Andric switch (SGV->getLinkage()) {
1180b57cec5SDimitry Andric case GlobalValue::LinkOnceODRLinkage:
1190b57cec5SDimitry Andric case GlobalValue::ExternalLinkage:
1200b57cec5SDimitry Andric // External and linkonce definitions are converted to available_externally
1210b57cec5SDimitry Andric // definitions upon import, so that they are available for inlining
1220b57cec5SDimitry Andric // and/or optimization, but are turned into declarations later
1230b57cec5SDimitry Andric // during the EliminateAvailableExternally pass.
1240b57cec5SDimitry Andric if (doImportAsDefinition(SGV) && !isa<GlobalAlias>(SGV))
1250b57cec5SDimitry Andric return GlobalValue::AvailableExternallyLinkage;
1260b57cec5SDimitry Andric // An imported external declaration stays external.
1270b57cec5SDimitry Andric return SGV->getLinkage();
1280b57cec5SDimitry Andric
1290b57cec5SDimitry Andric case GlobalValue::AvailableExternallyLinkage:
1300b57cec5SDimitry Andric // An imported available_externally definition converts
1310b57cec5SDimitry Andric // to external if imported as a declaration.
1320b57cec5SDimitry Andric if (!doImportAsDefinition(SGV))
1330b57cec5SDimitry Andric return GlobalValue::ExternalLinkage;
1340b57cec5SDimitry Andric // An imported available_externally declaration stays that way.
1350b57cec5SDimitry Andric return SGV->getLinkage();
1360b57cec5SDimitry Andric
1370b57cec5SDimitry Andric case GlobalValue::LinkOnceAnyLinkage:
1380b57cec5SDimitry Andric case GlobalValue::WeakAnyLinkage:
1390b57cec5SDimitry Andric // Can't import linkonce_any/weak_any definitions correctly, or we might
1400b57cec5SDimitry Andric // change the program semantics, since the linker will pick the first
1410b57cec5SDimitry Andric // linkonce_any/weak_any definition and importing would change the order
1420b57cec5SDimitry Andric // they are seen by the linker. The module linking caller needs to enforce
1430b57cec5SDimitry Andric // this.
1440b57cec5SDimitry Andric assert(!doImportAsDefinition(SGV));
1450b57cec5SDimitry Andric // If imported as a declaration, it becomes external_weak.
1460b57cec5SDimitry Andric return SGV->getLinkage();
1470b57cec5SDimitry Andric
1480b57cec5SDimitry Andric case GlobalValue::WeakODRLinkage:
1490b57cec5SDimitry Andric // For weak_odr linkage, there is a guarantee that all copies will be
1500b57cec5SDimitry Andric // equivalent, so the issue described above for weak_any does not exist,
1510b57cec5SDimitry Andric // and the definition can be imported. It can be treated similarly
1520b57cec5SDimitry Andric // to an imported externally visible global value.
1530b57cec5SDimitry Andric if (doImportAsDefinition(SGV) && !isa<GlobalAlias>(SGV))
1540b57cec5SDimitry Andric return GlobalValue::AvailableExternallyLinkage;
1550b57cec5SDimitry Andric else
1560b57cec5SDimitry Andric return GlobalValue::ExternalLinkage;
1570b57cec5SDimitry Andric
1580b57cec5SDimitry Andric case GlobalValue::AppendingLinkage:
1590b57cec5SDimitry Andric // It would be incorrect to import an appending linkage variable,
1600b57cec5SDimitry Andric // since it would cause global constructors/destructors to be
1610b57cec5SDimitry Andric // executed multiple times. This should have already been handled
1620b57cec5SDimitry Andric // by linkIfNeeded, and we will assert in shouldLinkFromSource
1630b57cec5SDimitry Andric // if we try to import, so we simply return AppendingLinkage.
1640b57cec5SDimitry Andric return GlobalValue::AppendingLinkage;
1650b57cec5SDimitry Andric
1660b57cec5SDimitry Andric case GlobalValue::InternalLinkage:
1670b57cec5SDimitry Andric case GlobalValue::PrivateLinkage:
1680b57cec5SDimitry Andric // If we are promoting the local to global scope, it is handled
1690b57cec5SDimitry Andric // similarly to a normal externally visible global.
1700b57cec5SDimitry Andric if (DoPromote) {
1710b57cec5SDimitry Andric if (doImportAsDefinition(SGV) && !isa<GlobalAlias>(SGV))
1720b57cec5SDimitry Andric return GlobalValue::AvailableExternallyLinkage;
1730b57cec5SDimitry Andric else
1740b57cec5SDimitry Andric return GlobalValue::ExternalLinkage;
1750b57cec5SDimitry Andric }
1760b57cec5SDimitry Andric // A non-promoted imported local definition stays local.
1770b57cec5SDimitry Andric // The ThinLTO pass will eventually force-import their definitions.
1780b57cec5SDimitry Andric return SGV->getLinkage();
1790b57cec5SDimitry Andric
1800b57cec5SDimitry Andric case GlobalValue::ExternalWeakLinkage:
1810b57cec5SDimitry Andric // External weak doesn't apply to definitions, must be a declaration.
1820b57cec5SDimitry Andric assert(!doImportAsDefinition(SGV));
1830b57cec5SDimitry Andric // Linkage stays external_weak.
1840b57cec5SDimitry Andric return SGV->getLinkage();
1850b57cec5SDimitry Andric
1860b57cec5SDimitry Andric case GlobalValue::CommonLinkage:
1870b57cec5SDimitry Andric // Linkage stays common on definitions.
1880b57cec5SDimitry Andric // The ThinLTO pass will eventually force-import their definitions.
1890b57cec5SDimitry Andric return SGV->getLinkage();
1900b57cec5SDimitry Andric }
1910b57cec5SDimitry Andric
1920b57cec5SDimitry Andric llvm_unreachable("unknown linkage type");
1930b57cec5SDimitry Andric }
1940b57cec5SDimitry Andric
processGlobalForThinLTO(GlobalValue & GV)1950b57cec5SDimitry Andric void FunctionImportGlobalProcessing::processGlobalForThinLTO(GlobalValue &GV) {
1960b57cec5SDimitry Andric
1970b57cec5SDimitry Andric ValueInfo VI;
1980b57cec5SDimitry Andric if (GV.hasName()) {
1990b57cec5SDimitry Andric VI = ImportIndex.getValueInfo(GV.getGUID());
2000b57cec5SDimitry Andric // Set synthetic function entry counts.
2010b57cec5SDimitry Andric if (VI && ImportIndex.hasSyntheticEntryCounts()) {
2020b57cec5SDimitry Andric if (Function *F = dyn_cast<Function>(&GV)) {
2030b57cec5SDimitry Andric if (!F->isDeclaration()) {
2040b57cec5SDimitry Andric for (auto &S : VI.getSummaryList()) {
2058bcb0991SDimitry Andric auto *FS = cast<FunctionSummary>(S->getBaseObject());
2060b57cec5SDimitry Andric if (FS->modulePath() == M.getModuleIdentifier()) {
2070b57cec5SDimitry Andric F->setEntryCount(Function::ProfileCount(FS->entryCount(),
2080b57cec5SDimitry Andric Function::PCT_Synthetic));
2090b57cec5SDimitry Andric break;
2100b57cec5SDimitry Andric }
2110b57cec5SDimitry Andric }
2120b57cec5SDimitry Andric }
2130b57cec5SDimitry Andric }
2140b57cec5SDimitry Andric }
2150b57cec5SDimitry Andric }
2160b57cec5SDimitry Andric
217480093f4SDimitry Andric // We should always have a ValueInfo (i.e. GV in index) for definitions when
218480093f4SDimitry Andric // we are exporting, and also when importing that value.
219480093f4SDimitry Andric assert(VI || GV.isDeclaration() ||
220480093f4SDimitry Andric (isPerformingImport() && !doImportAsDefinition(&GV)));
221480093f4SDimitry Andric
2220b57cec5SDimitry Andric // Mark read/write-only variables which can be imported with specific
2230b57cec5SDimitry Andric // attribute. We can't internalize them now because IRMover will fail
2240b57cec5SDimitry Andric // to link variable definitions to their external declarations during
2250b57cec5SDimitry Andric // ThinLTO import. We'll internalize read-only variables later, after
2260b57cec5SDimitry Andric // import is finished. See internalizeGVsAfterImport.
2270b57cec5SDimitry Andric //
2280b57cec5SDimitry Andric // If global value dead stripping is not enabled in summary then
2290b57cec5SDimitry Andric // propagateConstants hasn't been run. We can't internalize GV
2300b57cec5SDimitry Andric // in such case.
231480093f4SDimitry Andric if (!GV.isDeclaration() && VI && ImportIndex.withAttributePropagation()) {
232480093f4SDimitry Andric if (GlobalVariable *V = dyn_cast<GlobalVariable>(&GV)) {
233480093f4SDimitry Andric // We can have more than one local with the same GUID, in the case of
234480093f4SDimitry Andric // same-named locals in different but same-named source files that were
235480093f4SDimitry Andric // compiled in their respective directories (so the source file name
236480093f4SDimitry Andric // and resulting GUID is the same). Find the one in this module.
237480093f4SDimitry Andric // Handle the case where there is no summary found in this module. That
238480093f4SDimitry Andric // can happen in the distributed ThinLTO backend, because the index only
239480093f4SDimitry Andric // contains summaries from the source modules if they are being imported.
240480093f4SDimitry Andric // We might have a non-null VI and get here even in that case if the name
241480093f4SDimitry Andric // matches one in this module (e.g. weak or appending linkage).
242480093f4SDimitry Andric auto *GVS = dyn_cast_or_null<GlobalVarSummary>(
243480093f4SDimitry Andric ImportIndex.findSummaryInModule(VI, M.getModuleIdentifier()));
244480093f4SDimitry Andric if (GVS &&
245480093f4SDimitry Andric (ImportIndex.isReadOnly(GVS) || ImportIndex.isWriteOnly(GVS))) {
246480093f4SDimitry Andric V->addAttribute("thinlto-internalize");
247480093f4SDimitry Andric // Objects referenced by writeonly GV initializer should not be
248480093f4SDimitry Andric // promoted, because there is no any kind of read access to them
249480093f4SDimitry Andric // on behalf of this writeonly GV. To avoid promotion we convert
250480093f4SDimitry Andric // GV initializer to 'zeroinitializer'. This effectively drops
251480093f4SDimitry Andric // references in IR module (not in combined index), so we can
252480093f4SDimitry Andric // ignore them when computing import. We do not export references
253480093f4SDimitry Andric // of writeonly object. See computeImportForReferencedGlobals
254480093f4SDimitry Andric if (ImportIndex.isWriteOnly(GVS))
255480093f4SDimitry Andric V->setInitializer(Constant::getNullValue(V->getValueType()));
256480093f4SDimitry Andric }
257480093f4SDimitry Andric }
2580b57cec5SDimitry Andric }
2590b57cec5SDimitry Andric
260480093f4SDimitry Andric if (GV.hasLocalLinkage() && shouldPromoteLocalToGlobal(&GV, VI)) {
2610b57cec5SDimitry Andric // Save the original name string before we rename GV below.
2620b57cec5SDimitry Andric auto Name = GV.getName().str();
263480093f4SDimitry Andric GV.setName(getPromotedName(&GV));
264480093f4SDimitry Andric GV.setLinkage(getLinkage(&GV, /* DoPromote */ true));
265480093f4SDimitry Andric assert(!GV.hasLocalLinkage());
2660b57cec5SDimitry Andric GV.setVisibility(GlobalValue::HiddenVisibility);
2670b57cec5SDimitry Andric
2680b57cec5SDimitry Andric // If we are renaming a COMDAT leader, ensure that we record the COMDAT
2690b57cec5SDimitry Andric // for later renaming as well. This is required for COFF.
2700b57cec5SDimitry Andric if (const auto *C = GV.getComdat())
2710b57cec5SDimitry Andric if (C->getName() == Name)
2720b57cec5SDimitry Andric RenamedComdats.try_emplace(C, M.getOrInsertComdat(GV.getName()));
2730b57cec5SDimitry Andric } else
2740b57cec5SDimitry Andric GV.setLinkage(getLinkage(&GV, /* DoPromote */ false));
2750b57cec5SDimitry Andric
2765ffd83dbSDimitry Andric // When ClearDSOLocalOnDeclarations is true, clear dso_local if GV is
2775ffd83dbSDimitry Andric // converted to a declaration, to disable direct access. Don't do this if GV
2785ffd83dbSDimitry Andric // is implicitly dso_local due to a non-default visibility.
279*5f7ddb14SDimitry Andric if (ClearDSOLocalOnDeclarations &&
280*5f7ddb14SDimitry Andric (GV.isDeclarationForLinker() ||
281*5f7ddb14SDimitry Andric (isPerformingImport() && !doImportAsDefinition(&GV))) &&
2825ffd83dbSDimitry Andric !GV.isImplicitDSOLocal()) {
2835ffd83dbSDimitry Andric GV.setDSOLocal(false);
284*5f7ddb14SDimitry Andric } else if (VI && VI.isDSOLocal(ImportIndex.withDSOLocalPropagation())) {
2855ffd83dbSDimitry Andric // If all summaries are dso_local, symbol gets resolved to a known local
2865ffd83dbSDimitry Andric // definition.
2875ffd83dbSDimitry Andric GV.setDSOLocal(true);
2885ffd83dbSDimitry Andric if (GV.hasDLLImportStorageClass())
2895ffd83dbSDimitry Andric GV.setDLLStorageClass(GlobalValue::DefaultStorageClass);
2905ffd83dbSDimitry Andric }
2915ffd83dbSDimitry Andric
2920b57cec5SDimitry Andric // Remove functions imported as available externally defs from comdats,
2930b57cec5SDimitry Andric // as this is a declaration for the linker, and will be dropped eventually.
2940b57cec5SDimitry Andric // It is illegal for comdats to contain declarations.
2950b57cec5SDimitry Andric auto *GO = dyn_cast<GlobalObject>(&GV);
2960b57cec5SDimitry Andric if (GO && GO->isDeclarationForLinker() && GO->hasComdat()) {
2970b57cec5SDimitry Andric // The IRMover should not have placed any imported declarations in
2980b57cec5SDimitry Andric // a comdat, so the only declaration that should be in a comdat
2990b57cec5SDimitry Andric // at this point would be a definition imported as available_externally.
3000b57cec5SDimitry Andric assert(GO->hasAvailableExternallyLinkage() &&
3010b57cec5SDimitry Andric "Expected comdat on definition (possibly available external)");
3020b57cec5SDimitry Andric GO->setComdat(nullptr);
3030b57cec5SDimitry Andric }
3040b57cec5SDimitry Andric }
3050b57cec5SDimitry Andric
processGlobalsForThinLTO()3060b57cec5SDimitry Andric void FunctionImportGlobalProcessing::processGlobalsForThinLTO() {
3070b57cec5SDimitry Andric for (GlobalVariable &GV : M.globals())
3080b57cec5SDimitry Andric processGlobalForThinLTO(GV);
3090b57cec5SDimitry Andric for (Function &SF : M)
3100b57cec5SDimitry Andric processGlobalForThinLTO(SF);
3110b57cec5SDimitry Andric for (GlobalAlias &GA : M.aliases())
3120b57cec5SDimitry Andric processGlobalForThinLTO(GA);
3130b57cec5SDimitry Andric
3140b57cec5SDimitry Andric // Replace any COMDATS that required renaming (because the COMDAT leader was
3150b57cec5SDimitry Andric // promoted and renamed).
3160b57cec5SDimitry Andric if (!RenamedComdats.empty())
3170b57cec5SDimitry Andric for (auto &GO : M.global_objects())
3180b57cec5SDimitry Andric if (auto *C = GO.getComdat()) {
3190b57cec5SDimitry Andric auto Replacement = RenamedComdats.find(C);
3200b57cec5SDimitry Andric if (Replacement != RenamedComdats.end())
3210b57cec5SDimitry Andric GO.setComdat(Replacement->second);
3220b57cec5SDimitry Andric }
3230b57cec5SDimitry Andric }
3240b57cec5SDimitry Andric
run()3250b57cec5SDimitry Andric bool FunctionImportGlobalProcessing::run() {
3260b57cec5SDimitry Andric processGlobalsForThinLTO();
3270b57cec5SDimitry Andric return false;
3280b57cec5SDimitry Andric }
3290b57cec5SDimitry Andric
renameModuleForThinLTO(Module & M,const ModuleSummaryIndex & Index,bool ClearDSOLocalOnDeclarations,SetVector<GlobalValue * > * GlobalsToImport)3300b57cec5SDimitry Andric bool llvm::renameModuleForThinLTO(Module &M, const ModuleSummaryIndex &Index,
3315ffd83dbSDimitry Andric bool ClearDSOLocalOnDeclarations,
3320b57cec5SDimitry Andric SetVector<GlobalValue *> *GlobalsToImport) {
3335ffd83dbSDimitry Andric FunctionImportGlobalProcessing ThinLTOProcessing(M, Index, GlobalsToImport,
3345ffd83dbSDimitry Andric ClearDSOLocalOnDeclarations);
3350b57cec5SDimitry Andric return ThinLTOProcessing.run();
3360b57cec5SDimitry Andric }
337