[llvm] Bfi precision (PR #66285)

David Li via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 13 14:17:33 PDT 2023


david-xl wrote:

> I don't know if the low precision is a problem for practical code. So far it was mostly annoying me when writing simple testcases that look so obvious that I expected them to just work :)
> 
> It is also very easy to fix these cases just by choosing bigger factors in `convertFloatingToInteger`...
> 
> Are there any downsides to bigger factors? I am certainly experiencing overflow problems, but those seem worth fixing anyway giving we could also hit them for big min/max spreads in practice...

For PGO, we don't care about two things: 1) ratio of the branch weights of the same branch 2) the 'actual' runtime count of a block or callsite. The later is computed by multiplying the relative frequency (to the entry block) with the entry count (real count). In other words, as long as there is no overflow/underflow, the scale factor used does not really matter.

On the other hand, if overflow happens, the branch direction can be flipped, which is a real problem.

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


More information about the llvm-commits mailing list