[SimpleLoopUnswitch] Fix overflowing frequencies case
authorMax Kazantsev <mkazantsev@azul.com>
Wed, 15 Feb 2023 10:35:45 +0000 (17:35 +0700)
committerMax Kazantsev <mkazantsev@azul.com>
Wed, 15 Feb 2023 10:40:53 +0000 (17:40 +0700)
commitbc173f526c5755d20e584301012b29cc3484b525
tree666e557a0e0d31b977de618898f99c2c41c78b2d
parent45ddc157ca7c464ebbea627da0f682b1554e2390
[SimpleLoopUnswitch] Fix overflowing frequencies case

When branch is so hot that sum of its frequencies overflows, we have an assertion
failure when trying to construct BranchProbability. Such cases are not interesting
as candidate for unswitching anyways (their branches are too hot), so reject them.
llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
llvm/test/Transforms/SimpleLoopUnswitch/inject-invariant-conditions.ll