Patchwork Fix PR tree-optimization/46494

login
register
mail settings
Submitter Eric Botcazou
Date Feb. 14, 2011, 10:36 a.m.
Message ID <201102141136.27492.ebotcazou@adacore.com>
Download mbox | patch
Permalink /patch/83062/
State New
Headers show

Comments

Eric Botcazou - Feb. 14, 2011, 10:36 a.m.
Hi,

this fixes an assertion in verify_flow_info with yet another fancy combination 
of options.  As diagnosed by Jakub, loop_optimizer_finalize prematurely calls 
verify_flow_info before the TODO_cleanup_cfg of VRP.

The patch removes the call to verify_flow_info from loop_optimizer_finalize 
and instead adds TODO_verify_flow to the appropriate passes.  The rationale 
is that some passes just do:

  loop_optimizer_init

  /* some read-only analysis */

  loop_optimizer_finalize

so returning a TODO from loop_optimizer_finalize seems overkill; for them, the 
patch doesn't add the TODO_verify_flow either; this gets rid of the ia64 hack 
in the process because all involved passes are run before RA now.

Tested on i586-suse-linux, OK for the mainline?


2011-02-14  Eric Botcazou  <ebotcazou@adacore.com>

	PR tree-optimization/46494
	* loop-unroll.c (split_edge_and_insert): Adjust comment.
	* loop-init.c (loop_optimizer_finalize): Do not call verify_flow_info.
	(pass_rtl_loop_done): Add TODO_verify_flow.
	* fwprop.c (pass_rtl_fwprop): Likewise.
	* modulo-sched.c (pass_sms): Likewise.
	* tree-ssa-dom.c (pass_dominator): Likewise.
	* tree-ssa-loop-ch.c (pass_ch): Likewise.
	* tree-ssa-loop.c (pass_complete_unrolli): Likewise.
	(pass_tree_loop_done): Likewise.
	* tree-ssa-pre.c (execute_pre): Likewise.
	* tree-ssa-reassoc.c (pass_reassoc): Likewise.
	* tree-ssa-sink.c (pass_sink_code): Likewise.
	* tree-vrp.c (pass_vrp): Likewise.


2011-02-14  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc.dg/pr46494.c: New test.
Richard Guenther - Feb. 14, 2011, 12:06 p.m.
On Mon, Feb 14, 2011 at 11:36 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:
> Hi,
>
> this fixes an assertion in verify_flow_info with yet another fancy combination
> of options.  As diagnosed by Jakub, loop_optimizer_finalize prematurely calls
> verify_flow_info before the TODO_cleanup_cfg of VRP.
>
> The patch removes the call to verify_flow_info from loop_optimizer_finalize
> and instead adds TODO_verify_flow to the appropriate passes.  The rationale
> is that some passes just do:
>
>  loop_optimizer_init
>
>  /* some read-only analysis */
>
>  loop_optimizer_finalize
>
> so returning a TODO from loop_optimizer_finalize seems overkill; for them, the
> patch doesn't add the TODO_verify_flow either; this gets rid of the ia64 hack
> in the process because all involved passes are run before RA now.
>
> Tested on i586-suse-linux, OK for the mainline?

Ok.

Thanks,
Richard.

>
> 2011-02-14  Eric Botcazou  <ebotcazou@adacore.com>
>
>        PR tree-optimization/46494
>        * loop-unroll.c (split_edge_and_insert): Adjust comment.
>        * loop-init.c (loop_optimizer_finalize): Do not call verify_flow_info.
>        (pass_rtl_loop_done): Add TODO_verify_flow.
>        * fwprop.c (pass_rtl_fwprop): Likewise.
>        * modulo-sched.c (pass_sms): Likewise.
>        * tree-ssa-dom.c (pass_dominator): Likewise.
>        * tree-ssa-loop-ch.c (pass_ch): Likewise.
>        * tree-ssa-loop.c (pass_complete_unrolli): Likewise.
>        (pass_tree_loop_done): Likewise.
>        * tree-ssa-pre.c (execute_pre): Likewise.
>        * tree-ssa-reassoc.c (pass_reassoc): Likewise.
>        * tree-ssa-sink.c (pass_sink_code): Likewise.
>        * tree-vrp.c (pass_vrp): Likewise.
>
>
> 2011-02-14  Eric Botcazou  <ebotcazou@adacore.com>
>
>        * gcc.dg/pr46494.c: New test.
>
>
> --
> Eric Botcazou
>

Patch

Index: tree-vrp.c
===================================================================
--- tree-vrp.c	(revision 169914)
+++ tree-vrp.c	(working copy)
@@ -7764,9 +7764,10 @@  struct gimple_opt_pass pass_vrp =
   0,					/* properties_destroyed */
   0,					/* todo_flags_start */
   TODO_cleanup_cfg
-    | TODO_ggc_collect
+    | TODO_update_ssa
     | TODO_verify_ssa
+    | TODO_verify_flow
     | TODO_dump_func
-    | TODO_update_ssa			/* todo_flags_finish */
+    | TODO_ggc_collect			/* todo_flags_finish */
  }
 };
Index: fwprop.c
===================================================================
--- fwprop.c	(revision 169914)
+++ fwprop.c	(working copy)
@@ -1471,8 +1471,10 @@  struct rtl_opt_pass pass_rtl_fwprop =
   0,                                    /* properties_provided */
   0,                                    /* properties_destroyed */
   0,                                    /* todo_flags_start */
-  TODO_df_finish | TODO_verify_rtl_sharing |
-  TODO_dump_func                        /* todo_flags_finish */
+  TODO_df_finish
+    | TODO_verify_flow
+    | TODO_verify_rtl_sharing
+    | TODO_dump_func                    /* todo_flags_finish */
  }
 };
 
Index: tree-ssa-loop-ch.c
===================================================================
--- tree-ssa-loop-ch.c	(revision 169914)
+++ tree-ssa-loop-ch.c	(working copy)
@@ -276,7 +276,9 @@  struct gimple_opt_pass pass_ch =
   0,					/* properties_provided */
   0,					/* properties_destroyed */
   0,					/* todo_flags_start */
-  TODO_cleanup_cfg | TODO_dump_func
-  | TODO_verify_ssa			/* todo_flags_finish */
+  TODO_cleanup_cfg
+    | TODO_verify_ssa
+    | TODO_verify_flow
+    | TODO_dump_func			/* todo_flags_finish */
  }
 };
Index: modulo-sched.c
===================================================================
--- modulo-sched.c	(revision 169914)
+++ modulo-sched.c	(working copy)
@@ -2897,9 +2897,11 @@  struct rtl_opt_pass pass_sms =
   0,                                    /* properties_provided */
   0,                                    /* properties_destroyed */
   TODO_dump_func,                       /* todo_flags_start */
-  TODO_df_finish | TODO_verify_rtl_sharing |
-  TODO_dump_func |
-  TODO_ggc_collect                      /* todo_flags_finish */
+  TODO_df_finish
+    | TODO_verify_flow
+    | TODO_verify_rtl_sharing
+    | TODO_dump_func
+    | TODO_ggc_collect                  /* todo_flags_finish */
  }
 };
 
Index: tree-ssa-dom.c
===================================================================
--- tree-ssa-dom.c	(revision 169914)
+++ tree-ssa-dom.c	(working copy)
@@ -799,10 +799,11 @@  struct gimple_opt_pass pass_dominator =
   0,					/* properties_provided */
   0,					/* properties_destroyed */
   0,					/* todo_flags_start */
-  TODO_dump_func
+  TODO_cleanup_cfg
     | TODO_update_ssa
-    | TODO_cleanup_cfg
-    | TODO_verify_ssa			/* todo_flags_finish */
+    | TODO_verify_ssa
+    | TODO_verify_flow
+    | TODO_dump_func			/* todo_flags_finish */
  }
 };
 
Index: loop-init.c
===================================================================
--- loop-init.c	(revision 169914)
+++ loop-init.c	(working copy)
@@ -123,14 +123,6 @@  loop_optimizer_finalize (void)
     {
       bb->loop_father = NULL;
     }
-
-  /* Checking.  */
-#ifdef ENABLE_CHECKING
-  /* FIXME: no point to verify flow info after bundling on ia64.  Use this
-     hack for achieving this.  */
-  if (!reload_completed)
-    verify_flow_info ();
-#endif
 }
 
 
@@ -235,7 +227,9 @@  struct rtl_opt_pass pass_rtl_loop_done =
   0,                                    /* properties_provided */
   0,                                    /* properties_destroyed */
   0,                                    /* todo_flags_start */
-  TODO_dump_func | TODO_verify_rtl_sharing /* todo_flags_finish */
+  TODO_verify_flow
+    | TODO_verify_rtl_sharing
+    | TODO_dump_func                    /* todo_flags_finish */
  }
 };
 
Index: tree-ssa-sink.c
===================================================================
--- tree-ssa-sink.c	(revision 169914)
+++ tree-ssa-sink.c	(working copy)
@@ -604,8 +604,9 @@  struct gimple_opt_pass pass_sink_code =
   0,					/* properties_destroyed */
   0,					/* todo_flags_start */
   TODO_update_ssa
+    | TODO_verify_ssa
+    | TODO_verify_flow
     | TODO_dump_func
-    | TODO_ggc_collect
-    | TODO_verify_ssa			/* todo_flags_finish */
+    | TODO_ggc_collect			/* todo_flags_finish */
  }
 };
Index: tree-ssa-loop.c
===================================================================
--- tree-ssa-loop.c	(revision 169914)
+++ tree-ssa-loop.c	(working copy)
@@ -528,7 +528,8 @@  struct gimple_opt_pass pass_complete_unr
   0,					/* properties_provided */
   0,					/* properties_destroyed */
   0,					/* todo_flags_start */
-  TODO_dump_func
+  TODO_verify_flow
+    | TODO_dump_func
     | TODO_ggc_collect 			/* todo_flags_finish */
  }
 };
@@ -670,6 +671,8 @@  struct gimple_opt_pass pass_tree_loop_do
   0,					/* properties_provided */
   0,					/* properties_destroyed */
   0,					/* todo_flags_start */
-  TODO_cleanup_cfg | TODO_dump_func	/* todo_flags_finish */
+  TODO_cleanup_cfg
+    | TODO_verify_flow
+    | TODO_dump_func			/* todo_flags_finish */
  }
 };
Index: loop-unroll.c
===================================================================
--- loop-unroll.c	(revision 169914)
+++ loop-unroll.c	(working copy)
@@ -900,7 +900,7 @@  split_edge_and_insert (edge e, rtx insns
      CFG.  For this purpose we used to set the BB_SUPERBLOCK flag on BB
      and call break_superblocks when going out of cfglayout mode.  But it
      turns out that this never happens; and that if it does ever happen,
-     the verify_flow_info call in loop_optimizer_finalize would fail.
+     the TODO_verify_flow at the end of the RTL loop passes would fail.
 
      There are two reasons why we expected we could have control flow insns
      in INSNS.  The first is when a comparison has to be done in parts, and
Index: tree-ssa-pre.c
===================================================================
--- tree-ssa-pre.c	(revision 169914)
+++ tree-ssa-pre.c	(working copy)
@@ -4909,7 +4909,10 @@  execute_pre (bool do_fre)
   clear_expression_ids ();
   free_scc_vn ();
   if (!do_fre)
-    remove_dead_inserted_code ();
+    {
+      remove_dead_inserted_code ();
+      todo |= TODO_verify_flow;
+    }
 
   scev_finalize ();
   fini_pre (do_fre);
Index: tree-ssa-reassoc.c
===================================================================
--- tree-ssa-reassoc.c	(revision 169914)
+++ tree-ssa-reassoc.c	(working copy)
@@ -2282,7 +2282,10 @@  struct gimple_opt_pass pass_reassoc =
   0,					/* properties_provided */
   0,					/* properties_destroyed */
   0,					/* todo_flags_start */
-  TODO_dump_func | TODO_ggc_collect | TODO_verify_ssa /* todo_flags_finish */
+  TODO_verify_ssa
+    | TODO_verify_flow
+    | TODO_dump_func
+    | TODO_ggc_collect			/* todo_flags_finish */
  }
 };