This is an archive of the discontinued LLVM Phabricator instance.

Restore code size tracking support in Darwin

Authored by paquette on Mar 16 2023, 2:05 PM.



D109576 broke code size metric collection on Darwin platforms.

This patch restores support in Darwin.

The reason support was broken is that llvm-size outputs text section size with leading underscores, while on other platforms, it leads with periods.

Diff Detail

Event Timeline

paquette created this revision.Mar 16 2023, 2:05 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 16 2023, 2:05 PM
paquette requested review of this revision.Mar 16 2023, 2:05 PM
fhahn accepted this revision.Mar 17 2023, 3:37 AM

LGTM, thanks for fixing this!

This revision is now accepted and ready to land.Mar 17 2023, 3:37 AM
azharudd added inline comments.

In light of the comment below, this could become:

{{ test.metrics['size..text'] or test.metrics['size.__text'] if test.metrics }};\

or, better yet

{{ test.metrics.get('size..text') or test.metrics.get('size.__text') if test.metrics }};\

Wouldn't it be a more clear/straightforward solution to just add another line here for 'size.__text' (similar to what we are doing for mem right below)?

'size..text': 'code_size',
# On Darwin, the section name is reported as `__text`.
'size.__text': 'code_size',

Only one of 'size..text' or 'size.__text' would exist in the lit output, and whichever exists would correspond to the 'code_size'. This way, we would also not need, and the lit output will continue to have the exact section name.


and another corresponding 'size.__text': float, line right below this too.

paquette added inline comments.Mar 20 2023, 1:50 PM

Sure, that sounds good to me.

paquette updated this revision to Diff 506741.Mar 20 2023, 3:05 PM
paquette retitled this revision from Consume "size_text" instead of size..text or size.__text to Restore code size tracking support in Darwin.
paquette edited the summary of this revision. (Show Details)

Address review feedback

paquette closed this revision.Apr 27 2023, 11:08 AM