diff options
author | Teresa Johnson <tejohnson@google.com> | 2013-08-31 01:43:33 +0000 |
---|---|---|
committer | Teresa Johnson <tejohnson@gcc.gnu.org> | 2013-08-31 01:43:33 +0000 |
commit | 600b5b1d5cb381a652a9b57445b27793304e954f (patch) | |
tree | 5309c6fb7e215165052af90d314125c561039563 /gcc/cfgcleanup.c | |
parent | 7b55c620f002242dfa035572deb1bd1ed9c97dd7 (diff) | |
download | gcc-600b5b1d5cb381a652a9b57445b27793304e954f.zip gcc-600b5b1d5cb381a652a9b57445b27793304e954f.tar.gz gcc-600b5b1d5cb381a652a9b57445b27793304e954f.tar.bz2 |
This patch sanitizes the partitioning to address issues such as edge weight insanities that sometimes occur due to upstream optimizations...
This patch sanitizes the partitioning to address issues such as edge
weight insanities that sometimes occur due to upstream optimizations,
and ensures that hot blocks are not dominated by cold blocks. This
needs to be resanitized after certain cfg optimizations that may
cause hot blocks previously reached via both hot and cold paths to
only be reached by cold paths.
The verification code in sanitize_dominator_hotness was contributed by
Steven Bosscher.
2013-08-29 Teresa Johnson <tejohnson@google.com>
Steven Bosscher <steven@gcc.gnu.org>
* cfgrtl.c (fixup_new_cold_bb): New routine.
(commit_edge_insertions): Invoke fixup_partitions.
(find_partition_fixes): New routine.
(fixup_partitions): Ditto.
(verify_hot_cold_block_grouping): Update comments.
(rtl_verify_edges): Invoke find_partition_fixes.
(rtl_verify_bb_pointers): Update comments.
(rtl_verify_bb_layout): Ditto.
* basic-block.h (probably_never_executed_edge_p): Declare.
(fixup_partitions): Ditto.
* cfgcleanup.c (try_optimize_cfg): Invoke fixup_partitions.
* bb-reorder.c (sanitize_hot_paths): New function.
(find_rarely_executed_basic_blocks_and_crossing_edges): Invoke
sanitize_hot_paths.
* predict.c (probably_never_executed_edge_p): New routine.
* cfg.c (check_bb_profile): Add partition insanity warnings.
Co-Authored-By: Steven Bosscher <steven@gcc.gnu.org>
From-SVN: r202125
Diffstat (limited to 'gcc/cfgcleanup.c')
-rw-r--r-- | gcc/cfgcleanup.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c index d918b4a..6836a9e 100644 --- a/gcc/cfgcleanup.c +++ b/gcc/cfgcleanup.c @@ -2807,10 +2807,21 @@ try_optimize_cfg (int mode) df_analyze (); } -#ifdef ENABLE_CHECKING if (changed) - verify_flow_info (); + { + /* Edge forwarding in particular can cause hot blocks previously + reached by both hot and cold blocks to become dominated only + by cold blocks. This will cause the verification below to fail, + and lead to now cold code in the hot section. This is not easy + to detect and fix during edge forwarding, and in some cases + is only visible after newly unreachable blocks are deleted, + which will be done in fixup_partitions. */ + fixup_partitions (); + +#ifdef ENABLE_CHECKING + verify_flow_info (); #endif + } changed_overall |= changed; first_pass = false; |