[lld] [llvm] [NFCI][LTO][lld] Optimize away symbol copies within LTO global resolution in ELF (PR #106193)

Mingming Liu via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 6 18:08:57 PDT 2024


================
@@ -1797,9 +1797,14 @@ void BitcodeFile::parseLazy() {
   symbols = std::make_unique<Symbol *[]>(numSymbols);
   for (auto [i, irSym] : llvm::enumerate(obj->symbols()))
     if (!irSym.isUndefined()) {
-      auto *sym = symtab.insert(saver().save(irSym.getName()));
+      auto *sym = symtab.insert(unique_saver().save(irSym.getName()));
       sym->resolve(LazySymbol{*this});
       symbols[i] = sym;
+    } else {
+      // Keep copies of per-module undefined symbols for LTO::GlobalResolutions
+      // usage.
+      [[maybe_unused]] StringRef SymbolRef =
----------------
minglotus-6 wrote:

done.

https://github.com/llvm/llvm-project/pull/106193


More information about the llvm-commits mailing list