This is an archive of the discontinued LLVM Phabricator instance.

[ThinLTO] Print names in function import debug messages when available
ClosedPublic

Authored by tejohnson on Jun 26 2018, 3:00 PM.

Details

Summary

Rather than just print the GUID, when it is available in the index,
print the global name as well in the function import thin link debug
messages. Names will be available when the combined index is being
built by the same process, e.g. a linker or "llvm-lto2 run".

Diff Detail

Event Timeline

tejohnson created this revision.Jun 26 2018, 3:00 PM
tejohnson edited the summary of this revision. (Show Details)Jun 26 2018, 3:03 PM

Updated description to clarify that this is for thin link debug messages, and the names are also available when being done via the linker. Only thin links invoked by e.g. llvm-lto on a serialized combined index will not have the names.

Perhaps define a little helper function:

#ifndef NDEBUG
raw_ostream& operator << (raw_ostream&, ValueInfo&VI) {

 if (!VI.empty()) {
      ....
 }
return dbgs();

}
#endif

then this call can be embedded inside dbgs() << getGUID(VI) << VI << "\n";

Perhaps define a little helper function:

#ifndef NDEBUG
raw_ostream& operator << (raw_ostream&, ValueInfo&VI) {

 if (!VI.empty()) {
      ....
 }
return dbgs();

}
#endif

then this call can be embedded inside dbgs() << getGUID(VI) << VI << "\n";

Good idea. I made it a bit more general, so that it prints both the GUID and Name (when available), which allows it to simplify the LLVM_DEBUG invocation further.

Make a ValueInfo printing helper.

This revision is now accepted and ready to land.Jun 27 2018, 10:36 AM
This revision was automatically updated to reflect the committed changes.