Support symbol list in profile generation along with extended binary format.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Thanks for bringing this up. Can you make this optional under a switch? Should be on by default. Currently without a switch we have to go a round trip (ext->txt->ext) to get rid of the symbol list in an extbinary profile.
llvm/tools/llvm-profgen/ProfileGenerator.cpp | ||
---|---|---|
128 | Move this into the if block above? |
I see, thanks for pointing out, switch added.
llvm/tools/llvm-profgen/ProfileGenerator.cpp | ||
---|---|---|
128 | Fixed! |
LGTM. We probably need this for CS profile too.
llvm/tools/llvm-profgen/ProfileGenerator.cpp | ||
---|---|---|
121 | This can be moved into the if block too. |
llvm/tools/llvm-profgen/ProfileGenerator.cpp | ||
---|---|---|
121 | SymbolList is used inside Writer.write(ProfileMap) as a pointer, moving it into if block will causing the dangling pointer issue. |
llvm/tools/llvm-profgen/ProfileGenerator.cpp | ||
---|---|---|
121 | I see. Good point. |
llvm/tools/llvm-profgen/ProfileGenerator.cpp | ||
---|---|---|
117 | Looking at the implementation, seems it should work for CS profile too? Profile.getName() only gets the leaf name instead of full context name, we just need to deduplicate the leaf name for CS profile. So I'm wondering if we can move it to ProfileGeneratorBase::write so it covers both CS and non-CS profile? |
llvm/tools/llvm-profgen/ProfileGenerator.cpp | ||
---|---|---|
117 | Sounds good, added to support CS profile. |
llvm/tools/llvm-profgen/ProfileGenerator.cpp | ||
---|---|---|
35 | Leave it default on, but turn it off for CS profile unless explicitly specified sounds good to me. |
On the second thought, do we want the default value of PopulateProfileSymbolList to be true or false? We probably do not want the list for either CS or non-CS in practice for now.