[PATCH] D90273: [test] Make bt_order_by_weight in switch.ll more robust

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 28 11:18:59 PDT 2020


aeubanks added a comment.

In D90273#2358349 <https://reviews.llvm.org/D90273#2358349>, @hans wrote:

> Thanks for fixing, but can you  please elaborate a little since I'm not familiar with the details here:
>
>> Branch weights are not represented internally linearly with the value in the IR.
>
> That's surprising. How are they represented then? In the IR, the weights for cases 0,3,6 and 2,5,8,9 both add up to 12. Did that not reflect how the weights added up internally.

Sometimes weights have +1 added to them for practical/theoretical reasons. They are also scaled if the total branch weights overflow uint32.
But having 0 for most of the branch weights should be more robust.

>> Also, going over uint32_t messes with the values, and this test shouldn't be testing for that.
>
> Is something else handling that, then? I think there was a bug here, which is exactly why the test is checking that things still work when this happens.

Restored the large branch weights.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D90273/new/

https://reviews.llvm.org/D90273



More information about the llvm-commits mailing list