[llvm] Use BlockFrequency type in more places (NFC) (PR #68266)

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 5 10:42:59 PDT 2023


MatzeB wrote:

There is already `BlockFrequency::getFrequency()` to access the `uint64_t` value. Generally I do not want to make things too convenient. Currently everytime code computes with the `uint64_t` directly there is a high chance of overflows not being handled (there is still a lot of bugs in that area), while for the `BlockFrequency` abstraction we get saturating behavior (and I have some personal patches that produce warnings on overflow that may be worth upstreaming later).

I also think it would be worth an experiment to use `llvm::Scaled64` or `double` instead of `uint64_t` which is a lot easier to pull off when the abstraction is used in more places.

https://github.com/llvm/llvm-project/pull/68266


More information about the llvm-commits mailing list