Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions llvm/lib/LTO/LTO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -635,11 +635,12 @@ void LTO::addModuleToGlobalRes(ArrayRef<InputFile::Symbol> Syms,
SymbolResolution Res = *ResI++;

StringRef SymbolName = Sym.getName();
auto [It, Inserted] = GlobalResolutions->try_emplace(SymbolName);
// Keep copies of symbols if the client of LTO says so.
if (GlobalResolutionSymbolSaver && !GlobalResolutions->contains(SymbolName))
if (GlobalResolutionSymbolSaver && Inserted)
SymbolName = GlobalResolutionSymbolSaver->save(SymbolName);

auto &GlobalRes = (*GlobalResolutions)[SymbolName];
auto &GlobalRes = It->second;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this functionally equivalent? Previously if the GlobalResolutions map didn't contain SymbolName then we got a new SymbolName from the symbol saver and created an entry in GlobalResolutions with that. Now we are only indexing GlobalResolutions with the old SymbolName.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this functionally equivalent? Previously if the GlobalResolutions map didn't contain SymbolName then we got a new SymbolName from the symbol saver and created an entry in GlobalResolutions with that. Now we are only indexing GlobalResolutions with the old SymbolName.

Thank you for catching this. You are right. I missed the update to SymbolName.

GlobalRes.UnnamedAddr &= Sym.isUnnamedAddr();
if (Res.Prevailing) {
assert(!GlobalRes.Prevailing &&
Expand Down
Loading