This is an archive of the discontinued LLVM Phabricator instance.

[NFC][BlockFrequency] Move operator definitions into header
ClosedPublic

Authored by 0xdc03 on Jun 13 2023, 12:50 AM.

Details

Summary

While BlockFrequency::operator+= is a very simple operation, it's
definition is present in another TU which means that it doesn't get
inlined in non-LTO builds. This means that there is some performance
left on the table in those builds, as this operator is called many
times.

This patch moves that operator (and a few others) into the
BlockFrequency.h header which gives a small speedup (~0.1%):
https://llvm-compile-time-tracker.com/compare.php?from=6ee594be53e7efaa12086ad20f0d0268092a4c73&to=6ac6cd99e211fae5ae5de41ad608604aa22f1882&stat=instructions%3Au

Diff Detail

Event Timeline

0xdc03 created this revision.Jun 13 2023, 12:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 13 2023, 12:50 AM
0xdc03 requested review of this revision.Jun 13 2023, 12:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 13 2023, 12:50 AM
nikic accepted this revision.Jun 13 2023, 2:11 AM

LGTM. Tradeoff is potentially longer LLVM build times, but given how tiny these are, I'm not overly concerned.

This revision is now accepted and ready to land.Jun 13 2023, 2:11 AM