summaryrefslogtreecommitdiff
path: root/gcc/cfghooks.c
diff options
context:
space:
mode:
authortbsaunde <tbsaunde@138bc75d-0d04-0410-961f-82ee72b054a4>2015-02-10 14:49:07 +0000
committertbsaunde <tbsaunde@138bc75d-0d04-0410-961f-82ee72b054a4>2015-02-10 14:49:07 +0000
commitd55cde62072934a5528425781334c54a6d924d14 (patch)
treec648c0344bfd851dbc0fa243f942821d987a4db9 /gcc/cfghooks.c
parentfe504175b53780c0ebbbef009ff29f0ed9c4592f (diff)
downloadgcc-d55cde62072934a5528425781334c54a6d924d14.tar.gz
cap frequency in make_forwarder_block
In the testcase the block with problematic frequency has to incoming edges. Each edge has probability 1. The first edge's source bb has frequency 873/10000, and the second has a frequency of 9409/10000. So at least one of those is slightly high probably from some sort of rounding issue related to fixed point, but in any case make_forwarder_block should not create basic blocks with frequency greater than BB_FREQ_MAX. gcc/ PR tree-optimization/64326 * cfghooks.c (make_forwarder_block): Cap frequency of created basic block. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@220585 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cfghooks.c')
-rw-r--r--gcc/cfghooks.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c
index 4b572801693..abeab8cf1a5 100644
--- a/gcc/cfghooks.c
+++ b/gcc/cfghooks.c
@@ -863,6 +863,9 @@ make_forwarder_block (basic_block bb, bool (*redirect_edge_p) (edge),
if (redirect_edge_p (e))
{
dummy->frequency += EDGE_FREQUENCY (e);
+ if (dummy->frequency > BB_FREQ_MAX)
+ dummy->frequency = BB_FREQ_MAX;
+
dummy->count += e->count;
fallthru->count += e->count;
ei_next (&ei);