[PATCH] D152781: [NFC][BlockFrequency] Move operator definitions into header

Dhruv Chawla via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 13 00:50:09 PDT 2023


0xdc03 created this revision.
0xdc03 added a reviewer: nikic.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
0xdc03 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152781

Files:
  llvm/include/llvm/Support/BlockFrequency.h
  llvm/lib/Support/BlockFrequency.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152781.530800.patch
Type: text/x-patch
Size: 3576 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230613/1eac4a07/attachment.bin>


More information about the llvm-commits mailing list