[NFC][BlockFrequency] Move operator definitions into header
authorDhruv Chawla <44582521+dc03@users.noreply.github.com>
Sun, 11 Jun 2023 08:01:39 +0000 (13:31 +0530)
committerDhruv Chawla <44582521+dc03@users.noreply.github.com>
Tue, 13 Jun 2023 11:23:56 +0000 (16:53 +0530)
commit4e069d9cf910967c16fa6929cd15ccc20082533e
tree8f454f47b3489a0097e83ee9d6a20e390b8970ae
parent772847af2a12342e3c7523d3289db81a06cb8ced
[NFC][BlockFrequency] Move operator definitions into header

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

Differential Revision: https://reviews.llvm.org/D152781
llvm/include/llvm/Support/BlockFrequency.h
llvm/lib/Support/BlockFrequency.cpp