[llvm] [SampleProfileLoader] Fix integer overflow in generateMDProfMetadata (PR #90217)

via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 26 09:40:33 PDT 2024


WenleiHe wrote:

> @WenleiHe Do you know why the decision was made to use 32 bit values for profile metadata?

I don't know the history (@david-xl may know), but I actually don't think using int32 is problematic by itself. With int64, of course it's easier, but it comes with size/memory cost. 

I think that int32 should be enough, because for profile counts, we don't necessarily care about the absolute values. What's important is 1) we preserve the relative difference in counts, and 2) we have good resolution on counts difference. We may need to normalize counts to overflow overflow/saturation, which we may not be doing a good job..

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


More information about the llvm-commits mailing list