summaryrefslogtreecommitdiff
path: root/gcc/bb-reorder.c
diff options
context:
space:
mode:
authortejohnson <tejohnson@138bc75d-0d04-0410-961f-82ee72b054a4>2013-10-03 05:06:05 +0000
committertejohnson <tejohnson@138bc75d-0d04-0410-961f-82ee72b054a4>2013-10-03 05:06:05 +0000
commitdcc9b35150e6197e978d0af10b4549c5c3f20e43 (patch)
treed85c8dce4505e035ecaa38597a50dd80df80808e /gcc/bb-reorder.c
parenta99f9d9131a7d307f4105113d988dd69bc331337 (diff)
downloadgcc-dcc9b35150e6197e978d0af10b4549c5c3f20e43.tar.gz
2013-10-02 Teresa Johnson <tejohnson@google.com>
* predict.c (probably_never_executed): New function. (probably_never_executed_bb_p): Invoke probably_never_executed. (probably_never_executed_edge_p): Ditto. * bb-reorder.c (find_rarely_executed_basic_blocks_and_crossing_edges): Treat profile insanities conservatively. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@203152 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/bb-reorder.c')
-rw-r--r--gcc/bb-reorder.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c
index b89f9855e77..c5a42d359dc 100644
--- a/gcc/bb-reorder.c
+++ b/gcc/bb-reorder.c
@@ -1564,8 +1564,24 @@ find_rarely_executed_basic_blocks_and_crossing_edges (void)
/* Mark which partition (hot/cold) each basic block belongs in. */
FOR_EACH_BB (bb)
{
+ bool cold_bb = false;
+
if (probably_never_executed_bb_p (cfun, bb))
{
+ /* Handle profile insanities created by upstream optimizations
+ by also checking the incoming edge weights. If there is a non-cold
+ incoming edge, conservatively prevent this block from being split
+ into the cold section. */
+ cold_bb = true;
+ FOR_EACH_EDGE (e, ei, bb->preds)
+ if (!probably_never_executed_edge_p (cfun, e))
+ {
+ cold_bb = false;
+ break;
+ }
+ }
+ if (cold_bb)
+ {
BB_SET_PARTITION (bb, BB_COLD_PARTITION);
cold_bb_count++;
}