This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Read the call graph profile from object files.
ClosedPublic

Authored by Bigcheese on Apr 19 2018, 5:05 PM.

Details

Summary

This uses the call graph profile embedded in the object files to construct the call graph.

This is read from a SHT_LLVM_CALL_GRAPH_PROFILE (0x6fff4c02) section as (uint32_t, uint32_t, uint64_t) tuples as (from symbol index, to symbol index, weight).

This depends on https://reviews.llvm.org/D44965 for llvm.

Diff Detail

Repository
rLLD LLVM Linker

Event Timeline

Bigcheese created this revision.Apr 19 2018, 5:05 PM
espindola added inline comments.Apr 27 2018, 10:27 AM
ELF/InputFiles.cpp
222

Why do you need to store this in Config? The code that is walking CallGraphProfileSymbols could just as easily walk CGProfile, no?

grimar added a subscriber: grimar.Jul 10 2018, 4:24 AM

This should be very useful. Needs rebasing though.

I think Rafael is right and eliminating Config->CallGraphProfileSymbols would be better.
You could create a helper function to call from Driver.cpp that would scan over
CGProfile and add graph edges probably.

Bigcheese updated this revision to Diff 164102.Sep 5 2018, 12:41 PM
Bigcheese removed a reviewer: espindola.

Address review comments.

grimar added inline comments.Sep 18 2018, 1:54 AM
ELF/Driver.cpp
676

Can you add a test to check this line?

685

CGProfile is used only once so I think you can just inline it:

for (const Elf_CGProfile_Impl<ELFT> &CGPE : Obj->CGProfile)

Bigcheese updated this revision to Diff 166186.Sep 19 2018, 2:44 PM
Bigcheese marked 2 inline comments as done.
  • Added test for unorderable symbols from object files
  • Removed unneeded temporary
ruiu accepted this revision.Sep 19 2018, 2:55 PM

LGTM

ELF/Driver.cpp
698

I believe you can use {} instead of std::make_pair().

This revision is now accepted and ready to land.Sep 19 2018, 2:55 PM
This revision was automatically updated to reflect the committed changes.