[PATCH] D98213: [InlineCost] Enable the cost benefit analysis on FDO
Kazu Hirata via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 20 16:00:26 PST 2023
kazu added a comment.
> // We use 128-bit APInt here to avoid potential overflow. This variable
> // should stay well below 10^^24 (or 2^^80) in practice. This "worst" case
> // assumes that we can avoid or fold a billion instructions, each with a
> // profile count of 10^^15 -- roughly the number of cycles for a 24-hour
> // period on a 4GHz machine.
>
> If you potentially need a 128 bit integer to store your "cycle savings", you should not be using that value to compare against a size cost. A sufficiently good "saving" will absolutely override a huge size cost.
Keep in mind that the cycle savings is divided by `PSI->getOrCompHotCountThreshold()` (although the actual implementation avoids divisions by doing "A*D >= B*C" instead of "A/B >= C/D"). We are not directly comparing the cycle savings to the size cost, which would not make sense as you have pointed out.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D98213/new/
https://reviews.llvm.org/D98213
More information about the llvm-commits
mailing list