Fix count comparison in ipa-cp
authorEugene Rozenfeld <erozen@microsoft.com>
Wed, 7 Dec 2022 01:05:18 +0000 (17:05 -0800)
committerEugene Rozenfeld <erozen@microsoft.com>
Thu, 8 Dec 2022 19:52:10 +0000 (11:52 -0800)
commit7410032a772a9e77b620b091c2b551b68113a179
tree0f771e1f43d98e4e0110f389de513fb47a002bce
parent5ddfe794405a514824382e96b1047d3195af23cc
Fix count comparison in ipa-cp

The existing comparison was incorrect for non-PRECISE counts
(e.g., AFDO): we could end up with a 0 base_count, which could
lead to asserts, e.g., in good_cloning_opportunity_p.

Tested on x86_64-pc-linux-gnu.

gcc/ChangeLog:
PR ipa/108000
* ipa-cp.cc (ipcp_propagate_stage): Fix profile count comparison

gcc/testsuite
* gcc.dg/tree-prof/pr108000.c: Regression test
gcc/ipa-cp.cc
gcc/testsuite/gcc.dg/tree-prof/pr108000.c [new file with mode: 0644]