This is an archive of the discontinued LLVM Phabricator instance.

[PGO] Don't group COMDAT variables for compiler generated profile variables in ELF
ClosedPublic

Authored by xur on Sep 25 2019, 11:30 AM.

Details

Summary

With this patch, compiler generated profile variables will have its own COMDAT name for ELF format, which syncs the behavior with COFF.
Tested with clang PGO bootstrap. This shows a modest reduction in object sizes in ELF format.

Diff Detail

Repository
rL LLVM

Event Timeline

xur created this revision.Sep 25 2019, 11:30 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 25 2019, 11:30 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
rnk accepted this revision.Sep 25 2019, 3:17 PM

lgtm, glad it saves object size.

This should remove the last call to getInstrProfComdatPrefix, so you can remove that too.

This revision is now accepted and ready to land.Sep 25 2019, 3:17 PM
This revision was automatically updated to reflect the committed changes.
MaskRay added a subscriber: MaskRay.EditedJul 27 2020, 9:52 PM

I think a potentially better approach is to reuse an existing symbol name as the comdat name (D84723). The state before this patch was inferior because __profv_ created a symbol which might waste .strtab space. By reusing an existing symbol (I picked __profd_), we don't waste .strtab space and can do better than this patch: we don't need to create one or two additional section groups (.group, sizeof(Elf64_Shdr)=64).