Do not call todo_after for a discarded function
authorMartin Liska <mliska@suse.cz>
Thu, 31 Mar 2016 10:42:55 +0000 (12:42 +0200)
committerMartin Liska <marxin@gcc.gnu.org>
Thu, 31 Mar 2016 10:42:55 +0000 (10:42 +0000)
* passes.c (execute_one_pass): Do not call
todo_after for a discarded function.

From-SVN: r234613

gcc/ChangeLog
gcc/passes.c

index 3c783194a94f946a2ec5e7a3336c52c5118542b7..9edee6b17b7543b014f72e80f50fe26b7808712f 100644 (file)
@@ -1,3 +1,8 @@
+2016-03-31  Martin Liska  <mliska@suse.cz>
+
+       * passes.c (execute_one_pass): Do not call
+       todo_after for a discarded function.
+
 2016-03-31  Bin Cheng  <bin.cheng@arm.com>
 
        * tree-ssa-loop-ivopts.c (struct comp_cost): New scrach field.
index 9d9025116f4666be44e3cb081f38e88bcced97c6..e8961811124585fa394fdb0d8e12aac7d57e0825 100644 (file)
@@ -2334,6 +2334,33 @@ execute_one_pass (opt_pass *pass)
 
   /* Do it!  */
   todo_after = pass->execute (cfun);
+
+  if (todo_after & TODO_discard_function)
+    {
+      pass_fini_dump_file (pass);
+
+      gcc_assert (cfun);
+      /* As cgraph_node::release_body expects release dominators info,
+        we have to release it.  */
+      if (dom_info_available_p (CDI_DOMINATORS))
+       free_dominance_info (CDI_DOMINATORS);
+
+      if (dom_info_available_p (CDI_POST_DOMINATORS))
+       free_dominance_info (CDI_POST_DOMINATORS);
+
+      tree fn = cfun->decl;
+      pop_cfun ();
+      gcc_assert (!cfun);
+      cgraph_node::get (fn)->release_body ();
+
+      current_pass = NULL;
+      redirect_edge_var_map_empty ();
+
+      ggc_collect ();
+
+      return true;
+    }
+
   do_per_function (clear_last_verified, NULL);
 
   /* Stop timevar.  */
@@ -2373,23 +2400,6 @@ execute_one_pass (opt_pass *pass)
   current_pass = NULL;
   redirect_edge_var_map_empty ();
 
-  if (todo_after & TODO_discard_function)
-    {
-      gcc_assert (cfun);
-      /* As cgraph_node::release_body expects release dominators info,
-        we have to release it.  */
-      if (dom_info_available_p (CDI_DOMINATORS))
-       free_dominance_info (CDI_DOMINATORS);
-
-      if (dom_info_available_p (CDI_POST_DOMINATORS))
-       free_dominance_info (CDI_POST_DOMINATORS);
-
-      tree fn = cfun->decl;
-      pop_cfun ();
-      gcc_assert (!cfun);
-      cgraph_node::get (fn)->release_body ();
-    }
-
   /* Signal this is a suitable GC collection point.  */
   if (!((todo_after | pass->todo_flags_finish) & TODO_do_not_ggc_collect))
     ggc_collect ();