aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@libertysurf.fr>2007-11-07 23:05:37 +0100
committerEric Botcazou <ebotcazou@gcc.gnu.org>2007-11-07 22:05:37 +0000
commit52982a970e03e299950638b623243d7724aa8962 (patch)
tree3b09819b82398b3577c387dc732255b7f014c8d4 /gcc
parent8c6c36a3c9583d2e804edd181c75e076a4f38b3e (diff)
downloadgcc-52982a970e03e299950638b623243d7724aa8962.zip
gcc-52982a970e03e299950638b623243d7724aa8962.tar.gz
gcc-52982a970e03e299950638b623243d7724aa8962.tar.bz2
re PR rtl-optimization/33737 (verify_flow_info failed: Wrong probability of edge 94->1 -6651)
PR rtl-optimization/33737 * cfgcleanup.c (try_crossjump_to_edge): Add count and frequency of target block after computing the probabilities of outgoing edges. Cap the frequency to BB_FREQ_MAX. * tree-ssa-threadupdate.c (redirect_edges): Also adjust count and frequency of the basic block if it has been reused. From-SVN: r129973
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/cfgcleanup.c10
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20071107-1.c332
-rw-r--r--gcc/tree-ssa-threadupdate.c6
5 files changed, 358 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d005a09..7cbf17f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,14 @@
2007-11-07 Eric Botcazou <ebotcazou@libertysurf.fr>
+ PR rtl-optimization/33737
+ * cfgcleanup.c (try_crossjump_to_edge): Add count and frequency of
+ target block after computing the probabilities of outgoing edges.
+ Cap the frequency to BB_FREQ_MAX.
+ * tree-ssa-threadupdate.c (redirect_edges): Also adjust count and
+ frequency of the basic block if it has been reused.
+
+2007-11-07 Eric Botcazou <ebotcazou@libertysurf.fr>
+
PR rtl-optimization/33822
* rtl.h (REG_OFFSET): Fix comment.
* var-tracking.c (INT_MEM_OFFSET): New macro.
diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index 7b2ec0d..b1c94da 100644
--- a/gcc/cfgcleanup.c
+++ b/gcc/cfgcleanup.c
@@ -1699,8 +1699,6 @@ try_crossjump_to_edge (int mode, edge e1, edge e2)
"Cross jumping from bb %i to bb %i; %i common insns\n",
src1->index, src2->index, nmatch);
- redirect_to->count += src1->count;
- redirect_to->frequency += src1->frequency;
/* We may have some registers visible through the block. */
df_set_bb_dirty (redirect_to);
@@ -1757,6 +1755,14 @@ try_crossjump_to_edge (int mode, edge e1, edge e2)
/ (redirect_to->frequency + src1->frequency));
}
+ /* Adjust count and frequency for the block. An earlier jump
+ threading pass may have left the profile in an inconsistent
+ state (see update_bb_profile_for_threading) so we must be
+ prepared for overflows. */
+ redirect_to->count += src1->count;
+ redirect_to->frequency += src1->frequency;
+ if (redirect_to->frequency > BB_FREQ_MAX)
+ redirect_to->frequency = BB_FREQ_MAX;
update_br_prob_note (redirect_to);
/* Edit SRC1 to go to REDIRECT_TO at NEWPOS1. */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 60e2429..ff2affb 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,9 @@
2007-11-07 Eric Botcazou <ebotcazou@libertysurf.fr>
+ * gcc.c-torture/compile/20071107-1.c: New test.
+
+2007-11-07 Eric Botcazou <ebotcazou@libertysurf.fr>
+
* gcc.dg/out-of-bounds-1.c: New test.
2007-11-07 Jakub Jelinek <jakub@redhat.com>
diff --git a/gcc/testsuite/gcc.c-torture/compile/20071107-1.c b/gcc/testsuite/gcc.c-torture/compile/20071107-1.c
new file mode 100644
index 0000000..627b705
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20071107-1.c
@@ -0,0 +1,332 @@
+/* PR rtl-optimization/33737 */
+/* Testcase by Richard Guenther <rguenth@gcc.gnu.org> */
+
+enum { PROP_0, PROP_DOUBLE_CLICK_TIME, PROP_DOUBLE_CLICK_DISTANCE, PROP_CURSOR_BLINK, PROP_CURSOR_BLINK_TIME, PROP_CURSOR_BLINK_TIMEOUT, PROP_SPLIT_CURSOR, PROP_THEME_NAME, PROP_ICON_THEME_NAME, PROP_FALLBACK_ICON_THEME, PROP_KEY_THEME_NAME, PROP_MENU_BAR_ACCEL, PROP_DND_DRAG_THRESHOLD, PROP_FONT_NAME, PROP_ICON_SIZES, PROP_MODULES, PROP_XFT_ANTIALIAS, PROP_XFT_HINTING, PROP_XFT_HINTSTYLE, PROP_XFT_RGBA, PROP_XFT_DPI, PROP_CURSOR_THEME_NAME, PROP_CURSOR_THEME_SIZE, PROP_ALTERNATIVE_BUTTON_ORDER, PROP_ALTERNATIVE_SORT_ARROWS, PROP_SHOW_INPUT_METHOD_MENU, PROP_SHOW_UNICODE_MENU, PROP_TIMEOUT_INITIAL, PROP_TIMEOUT_REPEAT, PROP_TIMEOUT_EXPAND, PROP_COLOR_SCHEME, PROP_ENABLE_ANIMATIONS, PROP_TOUCHSCREEN_MODE, PROP_TOOLTIP_TIMEOUT, PROP_TOOLTIP_BROWSE_TIMEOUT, PROP_TOOLTIP_BROWSE_MODE_TIMEOUT, PROP_KEYNAV_CURSOR_ONLY, PROP_KEYNAV_WRAP_AROUND, PROP_ERROR_BELL, PROP_COLOR_HASH, PROP_FILE_CHOOSER_BACKEND, PROP_PRINT_BACKENDS, PROP_PRINT_PREVIEW_COMMAND, PROP_ENABLE_MNEMONICS, PROP_ENABLE_ACCELS, PROP_RECENT_FILES_LIMIT };
+void g_assert_warning (void) __attribute__((__noreturn__));
+void gtk_settings_class_init (void)
+{
+ unsigned int result;
+ result = settings_install_property_parser();
+ if (__builtin_expect (__extension__ ({
+ int _g_boolean_var_;
+ if (result == PROP_DOUBLE_CLICK_TIME) _g_boolean_var_ = 1;
+ else _g_boolean_var_ = 0;
+ _g_boolean_var_;
+ }), 1)) {
+ }
+ else g_assert_warning();
+ result = settings_install_property_parser();
+ if (__builtin_expect (__extension__ ({
+ int _g_boolean_var_;
+ if (result == PROP_DOUBLE_CLICK_DISTANCE) _g_boolean_var_ = 1;
+ else _g_boolean_var_ = 0;
+ _g_boolean_var_;
+ }), 1)) {
+ }
+ else g_assert_warning();
+ result = settings_install_property_parser();
+ if (__builtin_expect (__extension__ ({
+ int _g_boolean_var_;
+ if (result == PROP_CURSOR_BLINK) _g_boolean_var_ = 1;
+ else _g_boolean_var_ = 0;
+ _g_boolean_var_;
+ }), 1)) {
+ }
+ else g_assert_warning();
+ result = settings_install_property_parser();
+ if (__builtin_expect (__extension__ ({
+ int _g_boolean_var_;
+ if (result == PROP_CURSOR_BLINK_TIME) _g_boolean_var_ = 1;
+ else _g_boolean_var_ = 0;
+ _g_boolean_var_;
+ }), 1)) {
+ }
+ else g_assert_warning();
+ result = settings_install_property_parser();
+ if (__builtin_expect (__extension__ ({
+ int _g_boolean_var_;
+ if (result == PROP_CURSOR_BLINK_TIMEOUT) _g_boolean_var_ = 1;
+ else _g_boolean_var_ = 0;
+ _g_boolean_var_;
+ }), 1)) {
+ }
+ else g_assert_warning();
+ result = settings_install_property_parser();
+ if (__builtin_expect (__extension__ ({
+ int _g_boolean_var_;
+ if (result == PROP_SPLIT_CURSOR) _g_boolean_var_ = 1;
+ else _g_boolean_var_ = 0;
+ _g_boolean_var_;
+ }), 1)) {
+ }
+ else g_assert_warning();
+ result = settings_install_property_parser();
+ if (__builtin_expect (__extension__ ({
+ int _g_boolean_var_;
+ if (result == PROP_THEME_NAME) _g_boolean_var_ = 1;
+ else _g_boolean_var_ = 0;
+ _g_boolean_var_;
+ }), 1)) {
+ }
+ else g_assert_warning();
+ result = settings_install_property_parser();
+ if (__builtin_expect (__extension__ ({
+ int _g_boolean_var_;
+ if (result == PROP_ICON_THEME_NAME) _g_boolean_var_ = 1;
+ else _g_boolean_var_ = 0;
+ _g_boolean_var_;
+ }), 1)) {
+ }
+ else g_assert_warning();
+ result = settings_install_property_parser();
+ if (__builtin_expect (__extension__ ({
+ int _g_boolean_var_;
+ if (result == PROP_FALLBACK_ICON_THEME) _g_boolean_var_ = 1;
+ else _g_boolean_var_ = 0;
+ _g_boolean_var_;
+ }), 1)) {
+ }
+ else g_assert_warning();
+ result = settings_install_property_parser();
+ if (__builtin_expect (__extension__ ({
+ int _g_boolean_var_;
+ if (result == PROP_KEY_THEME_NAME) _g_boolean_var_ = 1;
+ else _g_boolean_var_ = 0;
+ _g_boolean_var_;
+ }), 1)) {
+ }
+ else g_assert_warning();
+ result = settings_install_property_parser();
+ if (__builtin_expect (__extension__ ({
+ int _g_boolean_var_;
+ if (result == PROP_MENU_BAR_ACCEL) _g_boolean_var_ = 1;
+ else _g_boolean_var_ = 0;
+ _g_boolean_var_;
+ }), 1)) {
+ }
+ else g_assert_warning();
+ result = settings_install_property_parser();
+ if (__builtin_expect (__extension__ ({
+ int _g_boolean_var_;
+ if (result == PROP_DND_DRAG_THRESHOLD) _g_boolean_var_ = 1;
+ else _g_boolean_var_ = 0;
+ _g_boolean_var_;
+ }), 1)) {
+ }
+ else g_assert_warning();
+ result = settings_install_property_parser();
+ if (__builtin_expect (__extension__ ({
+ int _g_boolean_var_;
+ if (result == PROP_FONT_NAME) _g_boolean_var_ = 1;
+ else _g_boolean_var_ = 0;
+ _g_boolean_var_;
+ }), 1)) {
+ }
+ else g_assert_warning();
+ result = settings_install_property_parser();
+ if (__builtin_expect (__extension__ ({
+ int _g_boolean_var_;
+ if (result == PROP_ICON_SIZES) _g_boolean_var_ = 1;
+ else _g_boolean_var_ = 0;
+ _g_boolean_var_;
+ }), 1)) {
+ }
+ else g_assert_warning();
+ result = settings_install_property_parser();
+ if (__builtin_expect (__extension__ ({
+ int _g_boolean_var_;
+ if (result == PROP_MODULES) _g_boolean_var_ = 1;
+ else _g_boolean_var_ = 0;
+ _g_boolean_var_;
+ }), 1)) {
+ }
+ else g_assert_warning();
+ result = settings_install_property_parser();
+ if (__builtin_expect (__extension__ ({
+ int _g_boolean_var_;
+ if (result == PROP_XFT_ANTIALIAS) _g_boolean_var_ = 1;
+ else _g_boolean_var_ = 0;
+ _g_boolean_var_;
+ }), 1)) {
+ }
+ else g_assert_warning();
+ result = settings_install_property_parser();
+ if (__builtin_expect (__extension__ ({
+ int _g_boolean_var_;
+ if (result == PROP_XFT_HINTING) _g_boolean_var_ = 1;
+ else _g_boolean_var_ = 0;
+ _g_boolean_var_;
+ }), 1)) {
+ }
+ else g_assert_warning();
+ result = settings_install_property_parser();
+ if (__builtin_expect (__extension__ ({
+ int _g_boolean_var_;
+ if (result == PROP_XFT_HINTSTYLE) _g_boolean_var_ = 1;
+ else _g_boolean_var_ = 0;
+ _g_boolean_var_;
+ }), 1)) {
+ }
+ else g_assert_warning();
+ result = settings_install_property_parser();
+ if (__builtin_expect (__extension__ ({
+ int _g_boolean_var_;
+ if (result == PROP_XFT_RGBA) _g_boolean_var_ = 1;
+ else _g_boolean_var_ = 0;
+ _g_boolean_var_;
+ }), 1)) {
+ }
+ else g_assert_warning();
+ result = settings_install_property_parser();
+ if (__builtin_expect (__extension__ ({
+ int _g_boolean_var_;
+ if (result == PROP_XFT_DPI) _g_boolean_var_ = 1;
+ else _g_boolean_var_ = 0;
+ _g_boolean_var_;
+ }), 1)) {
+ }
+ else g_assert_warning();
+ result = settings_install_property_parser();
+ if (__builtin_expect (__extension__ ({
+ int _g_boolean_var_;
+ if (result == PROP_CURSOR_THEME_NAME) _g_boolean_var_ = 1;
+ else _g_boolean_var_ = 0;
+ _g_boolean_var_;
+ }), 1)) {
+ }
+ else g_assert_warning();
+ result = settings_install_property_parser();
+ if (__builtin_expect (__extension__ ({
+ int _g_boolean_var_;
+ if (result == PROP_CURSOR_THEME_SIZE) _g_boolean_var_ = 1;
+ else _g_boolean_var_ = 0;
+ _g_boolean_var_;
+ }), 1)) {
+ }
+ else g_assert_warning();
+ result = settings_install_property_parser();
+ if (__builtin_expect (__extension__ ({
+ int _g_boolean_var_;
+ if (result == PROP_ALTERNATIVE_BUTTON_ORDER) _g_boolean_var_ = 1;
+ else _g_boolean_var_ = 0;
+ _g_boolean_var_;
+ }), 1)) {
+ }
+ else g_assert_warning();
+ result = settings_install_property_parser();
+ if (__builtin_expect (__extension__ ({
+ int _g_boolean_var_;
+ if (result == PROP_ALTERNATIVE_SORT_ARROWS) _g_boolean_var_ = 1;
+ else _g_boolean_var_ = 0;
+ _g_boolean_var_;
+ }), 1)) {
+ }
+ else g_assert_warning();
+ result = settings_install_property_parser();
+ if (__builtin_expect (__extension__ ({
+ int _g_boolean_var_;
+ if (result == PROP_SHOW_INPUT_METHOD_MENU) _g_boolean_var_ = 1;
+ else _g_boolean_var_ = 0;
+ _g_boolean_var_;
+ }), 1)) {
+ }
+ else g_assert_warning();
+ result = settings_install_property_parser();
+ if (__builtin_expect (__extension__ ({
+ int _g_boolean_var_;
+ if (result == PROP_SHOW_UNICODE_MENU) _g_boolean_var_ = 1;
+ else _g_boolean_var_ = 0;
+ _g_boolean_var_;
+ }), 1)) {
+ }
+ else g_assert_warning();
+ result = settings_install_property_parser();
+ if (__builtin_expect (__extension__ ({
+ int _g_boolean_var_;
+ if (result == PROP_TOOLTIP_BROWSE_TIMEOUT) _g_boolean_var_ = 1;
+ else _g_boolean_var_ = 0;
+ _g_boolean_var_;
+ }), 1)) {
+ }
+ else g_assert_warning();
+ result = settings_install_property_parser();
+ if (__builtin_expect (__extension__ ({
+ int _g_boolean_var_;
+ if (result == PROP_TOOLTIP_BROWSE_MODE_TIMEOUT) _g_boolean_var_ = 1;
+ else _g_boolean_var_ = 0;
+ _g_boolean_var_;
+ }), 1)) {
+ }
+ else g_assert_warning();
+ result = settings_install_property_parser();
+ if (__builtin_expect (__extension__ ({
+ int _g_boolean_var_;
+ if (result == PROP_KEYNAV_CURSOR_ONLY) _g_boolean_var_ = 1;
+ else _g_boolean_var_ = 0;
+ _g_boolean_var_;
+ }), 1)) {
+ }
+ else g_assert_warning();
+ result = settings_install_property_parser();
+ if (__builtin_expect (__extension__ ({
+ int _g_boolean_var_;
+ if (result == PROP_KEYNAV_WRAP_AROUND) _g_boolean_var_ = 1;
+ else _g_boolean_var_ = 0;
+ _g_boolean_var_;
+ }), 1)) {
+ }
+ else g_assert_warning();
+ result = settings_install_property_parser();
+ if (__builtin_expect (__extension__ ({
+ int _g_boolean_var_;
+ if (result == PROP_ERROR_BELL) _g_boolean_var_ = 1;
+ else _g_boolean_var_ = 0;
+ _g_boolean_var_;
+ }), 1)) {
+ }
+ else g_assert_warning();
+ result = settings_install_property_parser();
+ if (__builtin_expect (__extension__ ({
+ int _g_boolean_var_;
+ if (result == PROP_FILE_CHOOSER_BACKEND) _g_boolean_var_ = 1;
+ else _g_boolean_var_ = 0;
+ _g_boolean_var_;
+ }), 1)) {
+ }
+ else g_assert_warning();
+ result = settings_install_property_parser();
+ if (__builtin_expect (__extension__ ({
+ int _g_boolean_var_;
+ if (result == PROP_PRINT_PREVIEW_COMMAND) _g_boolean_var_ = 1;
+ else _g_boolean_var_ = 0;
+ _g_boolean_var_;
+ }), 1)) {
+ }
+ else g_assert_warning();
+ result = settings_install_property_parser();
+ if (__builtin_expect (__extension__ ({
+ int _g_boolean_var_;
+ if (result == PROP_ENABLE_MNEMONICS) _g_boolean_var_ = 1;
+ else _g_boolean_var_ = 0;
+ _g_boolean_var_;
+ }), 1)) {
+ }
+ else g_assert_warning();
+ result = settings_install_property_parser();
+ if (__builtin_expect (__extension__ ({
+ int _g_boolean_var_;
+ if (result == PROP_ENABLE_ACCELS) _g_boolean_var_ = 1;
+ else _g_boolean_var_ = 0;
+ _g_boolean_var_;
+ }), 1)) {
+ }
+ else g_assert_warning();
+ if (__builtin_expect (__extension__ ({
+ int _g_boolean_var_;
+ if (result == PROP_RECENT_FILES_LIMIT) _g_boolean_var_ = 1;
+ else _g_boolean_var_ = 0;
+ _g_boolean_var_;
+ }), 1)) {
+ }
+ else g_assert_warning();
+}
diff --git a/gcc/tree-ssa-threadupdate.c b/gcc/tree-ssa-threadupdate.c
index 1d5500f..fe3876e 100644
--- a/gcc/tree-ssa-threadupdate.c
+++ b/gcc/tree-ssa-threadupdate.c
@@ -442,10 +442,14 @@ redirect_edges (void **slot, void *data)
remove_ctrl_stmt_and_useless_edges (local_info->bb,
rd->outgoing_edge->dest);
- /* And fixup the flags on the single remaining edge. */
+ /* Fixup the flags on the single remaining edge. */
single_succ_edge (local_info->bb)->flags
&= ~(EDGE_TRUE_VALUE | EDGE_FALSE_VALUE | EDGE_ABNORMAL);
single_succ_edge (local_info->bb)->flags |= EDGE_FALLTHRU;
+
+ /* And adjust count and frequency on BB. */
+ local_info->bb->count = e->count;
+ local_info->bb->frequency = EDGE_FREQUENCY (e);
}
}