@@ -605,9 +605,6 @@ struct DevirtModule {
605605
606606 ModuleSummaryIndex *const ExportSummary;
607607 const ModuleSummaryIndex *const ImportSummary;
608- // True if ExportSummary was built locally from the module.
609- // Default is false unless explicitly set.
610- const bool HasLocalSummary;
611608
612609 IntegerType *const Int8Ty;
613610 PointerType *const Int8PtrTy;
@@ -645,12 +642,10 @@ struct DevirtModule {
645642
646643 DevirtModule (Module &M, ModuleAnalysisManager &MAM,
647644 ModuleSummaryIndex *ExportSummary,
648- const ModuleSummaryIndex *ImportSummary,
649- bool HasLocalSummary = false )
645+ const ModuleSummaryIndex *ImportSummary)
650646 : M(M), MAM(MAM),
651647 FAM (MAM.getResult<FunctionAnalysisManagerModuleProxy>(M).getManager()),
652648 ExportSummary(ExportSummary), ImportSummary(ImportSummary),
653- HasLocalSummary(HasLocalSummary),
654649 Int8Ty(Type::getInt8Ty(M.getContext())),
655650 Int8PtrTy(PointerType::getUnqual(M.getContext())),
656651 Int32Ty(Type::getInt32Ty(M.getContext())),
@@ -821,8 +816,7 @@ PreservedAnalyses WholeProgramDevirtPass::run(Module &M,
821816 return PreservedAnalyses::all ();
822817 return PreservedAnalyses::none ();
823818 }
824- if (!DevirtModule (M, MAM, ExportSummary, ImportSummary, HasLocalSummary)
825- .run ())
819+ if (!DevirtModule (M, MAM, ExportSummary, ImportSummary).run ())
826820 return PreservedAnalyses::all ();
827821 return PreservedAnalyses::none ();
828822}
@@ -1363,10 +1357,10 @@ bool DevirtModule::trySingleImplDevirt(
13631357 if (!IsExported)
13641358 return false ;
13651359
1366- // If the only implementation has local linkage, we must promote
1367- // to external to make it visible to thin LTO objects.
1368- // This change should be safe only in LTO mode .
1369- if (!HasLocalSummary && TheFn->hasLocalLinkage ()) {
1360+ // If the only implementation has local linkage, we must promote to external
1361+ // to make it visible to thin LTO objects. We can only get here during the
1362+ // ThinLTO export phase .
1363+ if (TheFn->hasLocalLinkage ()) {
13701364 std::string NewName = (TheFn->getName () + " .llvm.merged" ).str ();
13711365
13721366 // Since we are renaming the function, any comdats with the same name must
0 commit comments