The following avoids allocating a GIMPLE_NOP as a def for all SSA names
(we stream stmts and adjust SSA_NAME_DEF_STMT later).  This requires
us to make sure we do not have unused SSA names around which we can
easily achieve at stream-out time - otherwise passes walking over
all SSA names rightfully expect a def stmt for all of them.

LTO bootstrap / regtest running on x86_64-unknown-linux-gnu.

Richard.

2016-04-21  Richard Biener  <rguent...@suse.de>

        * lto-streamer-in.c (input_ssa_names): Do not allocate
        GIMPLE_NOP for all SSA names.
        * lto-streamer-out.c (output_ssa_names): Do not output
        SSA names that should have been released.

Index: gcc/lto-streamer-in.c
===================================================================
--- gcc/lto-streamer-in.c       (revision 235305)
+++ gcc/lto-streamer-in.c       (working copy)
@@ -881,10 +881,13 @@ input_ssa_names (struct lto_input_block
 
       is_default_def = (streamer_read_uchar (ib) != 0);
       name = stream_read_tree (ib, data_in);
-      ssa_name = make_ssa_name_fn (fn, name, gimple_build_nop ());
+      ssa_name = make_ssa_name_fn (fn, name, NULL);
 
       if (is_default_def)
-       set_ssa_default_def (cfun, SSA_NAME_VAR (ssa_name), ssa_name);
+       {
+         set_ssa_default_def (cfun, SSA_NAME_VAR (ssa_name), ssa_name);
+         SSA_NAME_DEF_STMT (ssa_name) = gimple_build_nop ();
+       }
 
       i = streamer_read_uhwi (ib);
     }
Index: gcc/lto-streamer-out.c
===================================================================
--- gcc/lto-streamer-out.c      (revision 235305)
+++ gcc/lto-streamer-out.c      (working copy)
@@ -1816,7 +1816,11 @@ output_ssa_names (struct output_block *o
 
       if (ptr == NULL_TREE
          || SSA_NAME_IN_FREE_LIST (ptr)
-         || virtual_operand_p (ptr))
+         || virtual_operand_p (ptr)
+         /* Simply skip unreleased SSA names.  */
+         || (! SSA_NAME_IS_DEFAULT_DEF (ptr)
+             && (! SSA_NAME_DEF_STMT (ptr)
+                 || ! gimple_bb (SSA_NAME_DEF_STMT (ptr)))))
        continue;
 
       streamer_write_uhwi (ob, i);

Reply via email to