diff options
author | Teresa Johnson <tejohnson@google.com> | 2013-10-03 05:06:05 +0000 |
---|---|---|
committer | Teresa Johnson <tejohnson@gcc.gnu.org> | 2013-10-03 05:06:05 +0000 |
commit | 79221839a3c9c0e8a4cf5ea130bcf24062ee3995 (patch) | |
tree | d85c8dce4505e035ecaa38597a50dd80df80808e /gcc/bb-reorder.c | |
parent | 697786593677771f060fdb99dc1114d7bb48f372 (diff) | |
download | gcc-79221839a3c9c0e8a4cf5ea130bcf24062ee3995.tar.gz |
predict.c (probably_never_executed): New function.
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.
From-SVN: r203152
Diffstat (limited to 'gcc/bb-reorder.c')
-rw-r--r-- | gcc/bb-reorder.c | 16 |
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++; } |