@@ -1746,8 +1746,10 @@ createBitcodeSymbol(Symbol *&sym, const std::vector<bool> &keptComdats,
17461746
17471747 // Symbols can be duplicated in bitcode files because of '#include' and
17481748 // linkonce_odr. Use unique_saver to save symbol names for de-duplication.
1749- if (!sym)
1750- sym = symtab.insert (unique_saver ().save (objSym.getName ()));
1749+ if (!sym) {
1750+ objSym.Name = unique_saver ().save (objSym.getName ());
1751+ sym = symtab.insert (objSym.getName ());
1752+ }
17511753
17521754 int c = objSym.getComdatIndex ();
17531755 if (objSym.isUndefined () || (c != -1 && !keptComdats[c])) {
@@ -1797,18 +1799,18 @@ void BitcodeFile::parse() {
17971799void BitcodeFile::parseLazy () {
17981800 numSymbols = obj->symbols ().size ();
17991801 symbols = std::make_unique<Symbol *[]>(numSymbols);
1800- for (auto [i, irSym] : llvm::enumerate (obj->symbols ()))
1802+ for (auto [i, irSym] : llvm::enumerate (obj->symbols ())) {
1803+ // Keep copies of per-module undefined symbols for LTO::GlobalResolutions
1804+ // usage.
1805+ irSym.Name = unique_saver ().save (irSym.getName ());
18011806 if (!irSym.isUndefined ()) {
18021807 // Symbols can be duplicated in bitcode files because of '#include' and
18031808 // linkonce_odr. Use unique_saver to save symbol names for de-duplication.
1804- auto *sym = symtab.insert (unique_saver (). save ( irSym.getName () ));
1809+ auto *sym = symtab.insert (irSym.getName ());
18051810 sym->resolve (LazySymbol{*this });
18061811 symbols[i] = sym;
1807- } else {
1808- // Keep copies of per-module undefined symbols for LTO::GlobalResolutions
1809- // usage.
1810- unique_saver ().save (irSym.getName ());
18111812 }
1813+ }
18121814}
18131815
18141816void BitcodeFile::postParse () {
0 commit comments