This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Fix 23164. Increase CFG cleanup iterations.
- From: Diego Novillo <dnovillo at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 2 Aug 2005 11:07:44 -0400
- Subject: Fix 23164. Increase CFG cleanup iterations.
This program needs more cleanup iterations than what we were
prepared for. We have two options here:
- Increase the number of allowed iterations a bit more. We will
likely play this game for ever.
- Allow cleanup_tree_cfg to iterate until it bleeds. I doubt
this will cause us to go into an infinite loop as
cleanup_tree_cfg_1 is guaranteed to either do nothing or shrink
the CFG.
This will stop the spurious ICEs we used to get in cases where we
didn't finish cleaning up the CFG. I also doubt that it will
become a compile time problem. None of the programs I usually
try need more than 5 iterations (GCC, MICO, DLV, SPEC2000,
TRAMP3D). This particular case needed 7.
However, I'd be interested in hearing of any testcase that causes
significant CFG cleanup slow downs.
Bootstrap and testing in progress.
* tree-cfgcleanup.c (cleanup_tree_cfg): Do not limit the
number of calls to cleanup_tree_cfg_1.
testsuite/ChangeLog
* g++.dg/tree-ssa/pr23164.C: New test.
Index: tree-cfgcleanup.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-cfgcleanup.c,v
retrieving revision 2.4
diff -d -u -p -r2.4 tree-cfgcleanup.c
--- tree-cfgcleanup.c 29 Jul 2005 16:31:46 -0000 2.4
+++ tree-cfgcleanup.c 2 Aug 2005 15:00:26 -0000
@@ -529,22 +529,12 @@ bool
cleanup_tree_cfg (void)
{
bool retval;
- int i;
timevar_push (TV_TREE_CLEANUP_CFG);
- for (retval = true, i = 0; i < 5 && retval; i++)
+ do
retval = cleanup_tree_cfg_1 ();
-
-#ifdef ENABLE_CHECKING
- if (retval)
- {
- gcc_assert (!cleanup_control_flow ());
- gcc_assert (!delete_unreachable_blocks ());
- if (optimize > 0)
- gcc_assert (!cleanup_forwarder_blocks ());
- }
-#endif
+ while (retval);
compact_blocks ();
Index: testsuite/g++.dg/tree-ssa/pr23164.C
===================================================================
RCS file: testsuite/g++.dg/tree-ssa/pr23164.C
diff -N testsuite/g++.dg/tree-ssa/pr23164.C
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ testsuite/g++.dg/tree-ssa/pr23164.C 2 Aug 2005 15:00:27 -0000
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+bool f();
+struct S {
+ S();
+ ~S();
+};
+void g() {
+ for (;;) {
+ S s1, s2, s3, s4, s5, s6;
+ if (f())
+ continue;
+ if (f())
+ return;
+ }
+}