input_functions ends with building virtual SSA which is unnecesary
excercise when function is only loaded to be inlined, compared by
ipa-icf or its profile merged.

This patch moves the SSA update later before we start working on the
function body.

lto-bootstrapped/regtested x86_64-linux, OK?


        * cgraph.c: Inlcude tree-into-ssa.h
        (cgraph_node::get_body): Update SSA.
        * cgraphunit.c (cgraph_node::expand): Likewise.
        * lto-streamer-in.c (input_function): Do not update SSA.
Index: cgraph.c
--- cgraph.c    (revision 278904)
+++ cgraph.c    (working copy)
@@ -62,6 +62,7 @@ along with GCC; see the file COPYING3.
 #include "stringpool.h"
 #include "attribs.h"
 #include "selftest.h"
+#include "tree-into-ssa.h"
 /* FIXME: Only for PROP_loops, but cgraph shouldn't have to know about this.  
 #include "tree-pass.h"
@@ -3599,6 +3605,8 @@ cgraph_node::get_body (void)
       set_dump_file (NULL);
       push_cfun (DECL_STRUCT_FUNCTION (decl));
+      update_ssa (TODO_update_ssa_only_virtuals);
       execute_all_ipa_transforms (true);
       cgraph_edge::rebuild_edges ();
       free_dominance_info (CDI_DOMINATORS);
Index: cgraphunit.c
--- cgraphunit.c        (revision 278904)
+++ cgraphunit.c        (working copy)
@@ -2268,6 +2268,7 @@ cgraph_node::expand (void)
   gcc_assert (DECL_STRUCT_FUNCTION (decl));
   push_cfun (DECL_STRUCT_FUNCTION (decl));
+  update_ssa (TODO_update_ssa_only_virtuals);
   init_function_start (decl);
   gimple_register_cfg_hooks ();
Index: lto-streamer-in.c
--- lto-streamer-in.c   (revision 278904)
+++ lto-streamer-in.c   (working copy)
@@ -1223,7 +1223,6 @@ input_function (tree fn_decl, class data
   fixup_call_stmt_edges (node, stmts);
   execute_all_ipa_stmt_fixups (node, stmts);
-  update_ssa (TODO_update_ssa_only_virtuals);
   free_dominance_info (CDI_DOMINATORS);
   free_dominance_info (CDI_POST_DOMINATORS);
   free (stmts);

Reply via email to