This is an archive of the discontinued LLVM Phabricator instance.

[Pseudo Probe] Do not place functions in nodeduplicate COMDATs
ClosedPublic

Authored by MaskRay on Jun 17 2023, 12:05 AM.

Details

Summary

For a function not in an IR COMDAT, currently we place it into a nodeduplicate IR
COMDAT so that its text section and its associated .pseudo_probe section will be
in the same section group, which can be retained or discarded by the linker as a
unit. However, the section group wastes space.

After D153189 uses SHF_LINK_ORDER to ensure a .pseudo_probe section will be
discarded when its associated text section is discarded, we can remove the
nodeduplicate IR change.

In the following example, the .pseudo_probe associated with .text.f is discarded as expected.

clang -c -ffunction-sections -fpseudo-probe-for-profiling -xc =(printf 'void _start(){} void f(){}') -o a.o
ld.lld --gc-sections --print-gc-sections a.o

Diff Detail

Event Timeline

MaskRay created this revision.Jun 17 2023, 12:05 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 17 2023, 12:05 AM
MaskRay requested review of this revision.Jun 17 2023, 12:05 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 17 2023, 12:05 AM
hoy accepted this revision.Jun 17 2023, 9:53 AM

Thanks for the cleanup!

This revision is now accepted and ready to land.Jun 17 2023, 9:53 AM