Typically branch_weights are i32, not i64.
This fixes entry_counts_cold.ll under NPM.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Time | Test | |
---|---|---|
440 ms | linux > HWAddressSanitizer-x86_64.TestCases::sizes.cpp |
Event Timeline
Would we rather want them to be i64, or is there a fundamental reason they should be i32?
Ideally they'd be i64, see https://reviews.llvm.org/D88609 where I tried doing that, but it was reverted multiple times due to uint64_t overflows and I gave up trying to fix the various issues. There are multiple instances of using uint64_t to do uint32_t arithmetic and checking for overflows, and I eventually got annoyed with all those and gave up.
Yeah, just do 32-bit arithmetic with uint64_t and you can see if the final result overflows. One example is here: https://github.com/llvm/llvm-project/blob/7ba3293691beb9a2c6ea4a81064c24580afe5816/llvm/lib/Analysis/BranchProbabilityInfo.cpp#L486
Ping
We can always fix everything to use i64 in a follow-up change, but for now I'd like to fix entry_counts_cold.ll under the NPM.
I agree this should be fixed separately from updating the world (that could be before or after this patch). I'm also a bit skeptical that it's valuable to have more than i32 for branch weights.
llvm/lib/IR/Instructions.cpp | ||
---|---|---|
563–565 | I think you need getLimitedValue(UINT32_MAX) here. Can you add a test that covers that as well? |
Unblocking the fixing of the tests under NPM. Additional changes can be done as follow ups.
I think you need getLimitedValue(UINT32_MAX) here. Can you add a test that covers that as well?