@@ -77,10 +77,6 @@ cl::opt<bool> EnableLTOInternalization(
7777 " enable-lto-internalization" , cl::init(true ), cl::Hidden,
7878 cl::desc(" Enable global value internalization in LTO" ));
7979
80- static cl::opt<bool >
81- LTOKeepSymbolCopies (" lto-keep-symbol-copies" , cl::init(false ), cl::Hidden,
82- cl::desc (" Keep copies of symbols in LTO indexing" ));
83-
8480// / Indicate we are linking with an allocator that supports hot/cold operator
8581// / new interfaces.
8682extern cl::opt<bool > SupportsHotColdNew;
@@ -591,14 +587,8 @@ LTO::LTO(Config Conf, ThinBackend Backend,
591587 : Conf(std::move(Conf)),
592588 RegularLTO(ParallelCodeGenParallelismLevel, this ->Conf),
593589 ThinLTO(std::move(Backend)),
594- GlobalResolutions(
595- std::make_unique<DenseMap<StringRef, GlobalResolution>>()),
596- LTOMode(LTOMode) {
597- if (Conf.KeepSymbolNameCopies || LTOKeepSymbolCopies) {
598- Alloc = std::make_unique<BumpPtrAllocator>();
599- GlobalResolutionSymbolSaver = std::make_unique<llvm::StringSaver>(*Alloc);
600- }
601- }
590+ GlobalResolutions(std::make_optional<StringMap<GlobalResolution>>()),
591+ LTOMode(LTOMode) {}
602592
603593// Requires a destructor for MapVector<BitcodeModule>.
604594LTO::~LTO () = default ;
@@ -616,12 +606,7 @@ void LTO::addModuleToGlobalRes(ArrayRef<InputFile::Symbol> Syms,
616606 assert (ResI != ResE);
617607 SymbolResolution Res = *ResI++;
618608
619- StringRef SymbolName = Sym.getName ();
620- // Keep copies of symbols if the client of LTO says so.
621- if (GlobalResolutionSymbolSaver && !GlobalResolutions->contains (SymbolName))
622- SymbolName = GlobalResolutionSymbolSaver->save (SymbolName);
623-
624- auto &GlobalRes = (*GlobalResolutions)[SymbolName];
609+ auto &GlobalRes = (*GlobalResolutions)[Sym.getName ()];
625610 GlobalRes.UnnamedAddr &= Sym.isUnnamedAddr ();
626611 if (Res.Prevailing ) {
627612 assert (!GlobalRes.Prevailing &&
@@ -675,14 +660,6 @@ void LTO::addModuleToGlobalRes(ArrayRef<InputFile::Symbol> Syms,
675660 }
676661}
677662
678- void LTO::releaseGlobalResolutionsMemory () {
679- // Release GlobalResolutions dense-map itself.
680- GlobalResolutions.reset ();
681- // Release the string saver memory.
682- GlobalResolutionSymbolSaver.reset ();
683- Alloc.reset ();
684- }
685-
686663static void writeToResolutionFile (raw_ostream &OS, InputFile *Input,
687664 ArrayRef<SymbolResolution> Res) {
688665 StringRef Path = Input->getName ();
@@ -1794,7 +1771,7 @@ Error LTO::runThinLTO(AddStreamFn AddStream, FileCache Cache,
17941771 // are no further accesses. We specifically want to do this before computing
17951772 // cross module importing, which adds to peak memory via the computed import
17961773 // and export lists.
1797- releaseGlobalResolutionsMemory ();
1774+ GlobalResolutions. reset ();
17981775
17991776 if (Conf.OptLevel > 0 )
18001777 ComputeCrossModuleImport (ThinLTO.CombinedIndex , ModuleToDefinedGVSummaries,
0 commit comments