This is an archive of the discontinued LLVM Phabricator instance.

[ThinLTO] Don't emit original GUID for locals to distributed indexes
ClosedPublic

Authored by tejohnson on Sep 22 2021, 4:42 PM.

Details

Summary

In ThinLTO for locals we normally compute the GUID from the name after
prepending the source path to get a unique global id. SamplePGO indirect
call profiles contain the target GUID without this uniquification,
however (unless compiling with -funique-internal-linkage-names).
Therefore, the index contains the original GUID of the local symbols
(without module path prepended to uniquify), in order to correctly
handle the call edges added for these indirect call profile targets
with SamplePGO.

We were emitting these to the combined index when writing it out as
bitcode, which is unnecessary and causes overhead when writing out the
indexes for distributed backends. The only use of the original GUID name
is in the thin link. Suppress it in that case. This reduced the thin
link time for a large distributed build by about 7%, and the aggregate
size of the serialized indexes by over 2%.

Continue to print it when writing out the full index, since that is just
used for debugging and testing.

Update a distributed thinlto index test to contain a local and ensure
that we don't get a COMBINED_ORIGINAL_NAME record.

Diff Detail

Event Timeline

tejohnson created this revision.Sep 22 2021, 4:42 PM
tejohnson requested review of this revision.Sep 22 2021, 4:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 22 2021, 4:42 PM
wmi added inline comments.Sep 22 2021, 8:00 PM
llvm/test/ThinLTO/X86/distributed_indexes.ll
65

The test is to ensure we don't get COMBINED_ORIGINAL_NAME record. Why the test added BACKEND1-NEXT instead of BACKEND1-NEXT-NOT?

tejohnson added inline comments.Sep 23 2021, 8:55 AM
llvm/test/ThinLTO/X86/distributed_indexes.ll
65

"-NEXT-NOT" isn't a supported FileCheck suffix. But it doesn't matter, because the -NEXT are very specific and will fail if we get a COMBINED_ORIGINAL_NAME interspersed among them. I confirmed this test fails without the fix, as the COMBINED_ORIGINAL_NAME is in the middle of the "<COMBINED " sequence specified by BACKEND1-NEXT and causes those to fail.

wmi accepted this revision.Sep 23 2021, 9:05 AM
wmi added inline comments.
llvm/test/ThinLTO/X86/distributed_indexes.ll
65

Oh, got it. There is a space after <COMBINED so <COMBINED {{.*}} won't match with COMBINED_ORIGINAL_NAME. Thanks.

This revision is now accepted and ready to land.Sep 23 2021, 9:05 AM
This revision was landed with ongoing or failed builds.Sep 23 2021, 5:36 PM
This revision was automatically updated to reflect the committed changes.

The test seems to break on some bots: https://lab.llvm.org/buildbot/#/builders/61/builds/15150

Yep, sorry about that, should be fixed by 7da4ee2df088d39c7ca6531d80172af7d973bb67