aboutsummaryrefslogtreecommitdiff
path: root/gcc/cfg.c
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2013-08-31 01:43:33 +0000
committerTeresa Johnson <tejohnson@gcc.gnu.org>2013-08-31 01:43:33 +0000
commit600b5b1d5cb381a652a9b57445b27793304e954f (patch)
tree5309c6fb7e215165052af90d314125c561039563 /gcc/cfg.c
parent7b55c620f002242dfa035572deb1bd1ed9c97dd7 (diff)
downloadgcc-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/cfg.c')
-rw-r--r--gcc/cfg.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/cfg.c b/gcc/cfg.c
index 9c6c939..cfada73 100644
--- a/gcc/cfg.c
+++ b/gcc/cfg.c
@@ -446,6 +446,21 @@ check_bb_profile (basic_block bb, FILE * file, int indent, int flags)
(flags & TDF_COMMENT) ? ";; " : "", s_indent,
(int) lsum, (int) bb->count);
}
+ if (BB_PARTITION (bb) == BB_COLD_PARTITION)
+ {
+ /* Warn about inconsistencies in the partitioning that are
+ currently caused by profile insanities created via optimization. */
+ if (!probably_never_executed_bb_p (fun, bb))
+ fprintf (file, "%s%sBlock in cold partition with hot count\n",
+ (flags & TDF_COMMENT) ? ";; " : "", s_indent);
+ FOR_EACH_EDGE (e, ei, bb->preds)
+ {
+ if (!probably_never_executed_edge_p (fun, e))
+ fprintf (file,
+ "%s%sBlock in cold partition with incoming hot edge\n",
+ (flags & TDF_COMMENT) ? ";; " : "", s_indent);
+ }
+ }
}
void