This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Fix thinko in cleanup_tree_cfg
- From: Diego Novillo <dnovillo at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Jeff Law <law at redhat dot com>
- Date: Fri, 19 Aug 2005 09:49:09 -0400
- Subject: Fix thinko in cleanup_tree_cfg
As Jeff pointed out to me offline, when I changed
cleanup_tree_cfg to iterate until no more cleanups were applied,
I broke its return value. It now returns false all the time,
even if the flowgraph changed.
This is what caused all the speedups I got in DOM. How
embarrassing. I'm testing this patch to restore the previous
functionality.
* tree-cfgcleanup.c (cleanup_tree_cfg): Fix flowgraph change
indicator. Return true if the flowgraph changed during
cleanup.
Index: tree-cfgcleanup.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-cfgcleanup.c,v
retrieving revision 2.5
diff -d -u -p -r2.5 tree-cfgcleanup.c
--- tree-cfgcleanup.c 2 Aug 2005 19:12:41 -0000 2.5
+++ tree-cfgcleanup.c 19 Aug 2005 13:46:37 -0000
@@ -523,17 +523,24 @@ cleanup_tree_cfg_1 (void)
}
-/* Remove unreachable blocks and other miscellaneous clean up work. */
+/* Remove unreachable blocks and other miscellaneous clean up work.
+ Return true if the flowgraph was modified, false otherwise. */
bool
cleanup_tree_cfg (void)
{
- bool retval;
+ bool retval, changed;
timevar_push (TV_TREE_CLEANUP_CFG);
+ /* Iterate until there are no more cleanups left to do. If any
+ iteration changed the flowgraph, set CHANGED to true. */
+ changed = false;
do
- retval = cleanup_tree_cfg_1 ();
+ {
+ retval = cleanup_tree_cfg_1 ();
+ changed |= retval;
+ }
while (retval);
compact_blocks ();
@@ -544,7 +551,7 @@ cleanup_tree_cfg (void)
timevar_pop (TV_TREE_CLEANUP_CFG);
- return retval;
+ return changed;
}
/* Cleanup cfg and repair loop structures. */