This is one thing I noticed when removing referenced vars:

Index: trunk/gcc/tree-cfg.c
===================================================================
*** trunk.orig/gcc/tree-cfg.c   2012-08-02 10:13:52.000000000 +0200
--- trunk/gcc/tree-cfg.c        2012-08-02 10:16:24.593266230 +0200
*************** replace_ssa_name (tree name, struct poin
*** 6047,6057 ****
      {
        replace_by_duplicate_decl (&decl, vars_map, to_context);

-       push_cfun (DECL_STRUCT_FUNCTION (to_context));
        new_name = make_ssa_name (decl, SSA_NAME_DEF_STMT (name));
        if (SSA_NAME_IS_DEFAULT_DEF (name))
!       set_default_def (decl, new_name);
!       pop_cfun ();

so we push/pop cfun just because we call set_default_def which
for some weird reason does not take a struct function argument
(compared to gimple_default_def).

So I went out to fix that, noticing on the way the common pattern
to create a new default def if it does not exist.  Moved the
helper from tree-into-ssa.c and renamed it, making all the function
names a bit more sensible:

! extern void set_default_def (tree, tree);
! extern tree gimple_default_def (struct function *, tree);
--- 445,453 ----
! extern void set_ssa_default_def (struct function *, tree, tree);
! extern tree ssa_default_def (struct function *, tree);
! extern tree get_or_create_ssa_default_def (struct function *, tree);

Queued for bootstrap and regtest on x86_64-unknown-linux-gnu.

Richard.

2012-08-02  Richard Guenther  <rguent...@suse.de>

        * tree-flow.h (set_default_def): Rename to ...
        (set_ssa_default_def): ... this.  Take a struct function argument.
        (gimple_default_def): Rename to ...
        (ssa_default_def): ... this.
        (get_or_create_ssa_default_def): New function.
        * tree-dfa.c: Likewise.
        (dump_variable): Adjust.
        * ipa-prop.c (ipa_analyze_params_uses): Adjust, properly check
        for used parameters.
        * ipa-split.c (consider_split): Adjust, avoid repeated default-def
        lookups.
        (split_function): Likewise.
        * lto-streamer-in.c (input_ssa_names): Adjust.
        * omp-low.c (expand_omp_taskreg): Likewise.
        * tree-cfg.c (replace_ssa_name): Adjust, no need to push/pop cfun.
        * tree-complex.c (init_parameter_lattice_values): Adjust.
        (get_component_ssa_name): Likewise.
        (update_parameter_components): Likewise.
        * tree-inline.c (remap_ssa_name): Likewise.
        (setup_one_parameter): Likewise.
        (initialize_inlined_parameters): Likewise.
        (declare_return_variable): Likewise.
        (expand_call_inline): Likewise.
        (tree_function_versioning): Likewise.
        * tree-into-ssa.c (get_default_def_for): Remove.
        (get_reaching_def): Use get_or_create_ssa_default_def instead.
        * tree-predcom.c (replace_ref_with): Adjust.
        * tree-sra.c (get_repl_default_def_ssa_name): Likewise.
        (is_unused_scalar_param): Likewise.
        (ptr_parm_has_direct_uses): Likewise.
        (sra_ipa_reset_debug_stmts): Likewise.
        * tree-ssa-coalesce.c (create_outofssa_var_map): Adjust.
        * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise.
        * tree-ssa-live.c (verify_live_on_entry): Likewise.
        * tree-ssa-math-opts.c (execute_cse_reciprocals): Likewise,
        avoid repeated default def lookups.
        * tree-ssa-sccvn.c (run_scc_vn): Likewise.
        * tree-tailcall.c (arg_needs_copy_p): Adjust.
        (tree_optimize_tail_calls_1): Likewise.

Index: trunk/gcc/ipa-prop.c
===================================================================
*** trunk.orig/gcc/ipa-prop.c   2012-08-02 10:13:52.000000000 +0200
--- trunk/gcc/ipa-prop.c        2012-08-02 10:31:58.660233887 +0200
*************** ipa_analyze_params_uses (struct cgraph_n
*** 1623,1632 ****
    for (i = 0; i < ipa_get_param_count (info); i++)
      {
        tree parm = ipa_get_param (info, i);
        /* For SSA regs see if parameter is used.  For non-SSA we compute
         the flag during modification analysis.  */
        if (is_gimple_reg (parm)
!         && gimple_default_def (DECL_STRUCT_FUNCTION (node->symbol.decl), 
parm))
        ipa_set_param_used (info, i, true);
      }
  
--- 1623,1635 ----
    for (i = 0; i < ipa_get_param_count (info); i++)
      {
        tree parm = ipa_get_param (info, i);
+       tree ddef;
        /* For SSA regs see if parameter is used.  For non-SSA we compute
         the flag during modification analysis.  */
        if (is_gimple_reg (parm)
!         && (ddef = ssa_default_def (DECL_STRUCT_FUNCTION (node->symbol.decl),
!                                     parm)) != NULL_TREE
!         && !has_zero_uses (ddef))
        ipa_set_param_used (info, i, true);
      }
  
Index: trunk/gcc/ipa-split.c
===================================================================
*** trunk.orig/gcc/ipa-split.c  2012-08-02 10:13:52.000000000 +0200
--- trunk/gcc/ipa-split.c       2012-08-02 10:16:24.588266230 +0200
*************** consider_split (struct split_point *curr
*** 438,451 ****
              return;
            }
        }
!       else if (gimple_default_def (cfun, parm)
!              && bitmap_bit_p (current->ssa_names_to_pass,
!                               SSA_NAME_VERSION (gimple_default_def
!                                                 (cfun, parm))))
!       {
!         if (!VOID_TYPE_P (TREE_TYPE (parm)))
!           call_overhead += estimate_move_cost (TREE_TYPE (parm));
!         num_args++;
        }
      }
    if (!VOID_TYPE_P (TREE_TYPE (current_function_decl)))
--- 438,454 ----
              return;
            }
        }
!       else
!       {
!         tree ddef = ssa_default_def (cfun, parm);
!         if (ddef
!             && bitmap_bit_p (current->ssa_names_to_pass,
!                              SSA_NAME_VERSION (ddef)))
!           {
!             if (!VOID_TYPE_P (TREE_TYPE (parm)))
!               call_overhead += estimate_move_cost (TREE_TYPE (parm));
!             num_args++;
!           }
        }
      }
    if (!VOID_TYPE_P (TREE_TYPE (current_function_decl)))
*************** split_function (struct split_point *spli
*** 1056,1062 ****
    bool split_part_return_p = false;
    gimple last_stmt = NULL;
    unsigned int i;
!   tree arg;
  
    if (dump_file)
      {
--- 1059,1065 ----
    bool split_part_return_p = false;
    gimple last_stmt = NULL;
    unsigned int i;
!   tree arg, ddef;
  
    if (dump_file)
      {
*************** split_function (struct split_point *spli
*** 1074,1097 ****
         parm; parm = DECL_CHAIN (parm), num++)
      if (args_to_skip
        && (!is_gimple_reg (parm)
!           || !gimple_default_def (cfun, parm)
            || !bitmap_bit_p (split_point->ssa_names_to_pass,
!                             SSA_NAME_VERSION (gimple_default_def (cfun,
!                                                                   parm)))))
        bitmap_set_bit (args_to_skip, num);
      else
        {
        /* This parm might not have been used up to now, but is going to be
           used, hence register it.  */
        if (is_gimple_reg (parm))
!         {
!           arg = gimple_default_def (cfun, parm);
!           if (!arg)
!             {
!               arg = make_ssa_name (parm, gimple_build_nop ());
!               set_default_def (parm, arg);
!             }
!         }
        else
          arg = parm;
  
--- 1077,1092 ----
         parm; parm = DECL_CHAIN (parm), num++)
      if (args_to_skip
        && (!is_gimple_reg (parm)
!           || (ddef = ssa_default_def (cfun, parm)) == NULL_TREE
            || !bitmap_bit_p (split_point->ssa_names_to_pass,
!                             SSA_NAME_VERSION (ddef))))
        bitmap_set_bit (args_to_skip, num);
      else
        {
        /* This parm might not have been used up to now, but is going to be
           used, hence register it.  */
        if (is_gimple_reg (parm))
!         arg = get_or_create_ssa_default_def (cfun, parm);
        else
          arg = parm;
  
*************** split_function (struct split_point *spli
*** 1356,1374 ****
                     assigned to RESULT_DECL (that is pointer to return value).
                     Look it up or create new one if it is missing.  */
                  if (DECL_BY_REFERENCE (retval))
!                   {
!                     tree retval_name;
!                     if ((retval_name = gimple_default_def (cfun, retval))
!                         != NULL)
!                       retval = retval_name;
!                     else
!                       {
!                         retval_name = make_ssa_name (retval,
!                                                      gimple_build_nop ());
!                         set_default_def (retval, retval_name);
!                         retval = retval_name;
!                       }
!                   }
                  /* Otherwise produce new SSA name for return value.  */
                  else
                    retval = make_ssa_name (retval, call);
--- 1351,1357 ----
                     assigned to RESULT_DECL (that is pointer to return value).
                     Look it up or create new one if it is missing.  */
                  if (DECL_BY_REFERENCE (retval))
!                   retval = get_or_create_ssa_default_def (cfun, retval);
                  /* Otherwise produce new SSA name for return value.  */
                  else
                    retval = make_ssa_name (retval, call);
Index: trunk/gcc/lto-streamer-in.c
===================================================================
*** trunk.orig/gcc/lto-streamer-in.c    2012-08-02 10:11:04.000000000 +0200
--- trunk/gcc/lto-streamer-in.c 2012-08-02 10:16:24.589266230 +0200
*************** input_ssa_names (struct lto_input_block
*** 709,715 ****
        ssa_name = make_ssa_name_fn (fn, name, gimple_build_nop ());
  
        if (is_default_def)
!       set_default_def (SSA_NAME_VAR (ssa_name), ssa_name);
  
        i = streamer_read_uhwi (ib);
      }
--- 709,715 ----
        ssa_name = make_ssa_name_fn (fn, name, gimple_build_nop ());
  
        if (is_default_def)
!       set_ssa_default_def (cfun, SSA_NAME_VAR (ssa_name), ssa_name);
  
        i = streamer_read_uhwi (ib);
      }
Index: trunk/gcc/omp-low.c
===================================================================
*** trunk.orig/gcc/omp-low.c    2012-08-02 10:13:51.000000000 +0200
--- trunk/gcc/omp-low.c 2012-08-02 10:16:24.591266230 +0200
*************** expand_omp_taskreg (struct omp_region *r
*** 3499,3507 ****
              /* If we are in ssa form, we must load the value from the default
                 definition of the argument.  That should not be defined now,
                 since the argument is not used uninitialized.  */
!             gcc_assert (gimple_default_def (cfun, arg) == NULL);
              narg = make_ssa_name (arg, gimple_build_nop ());
!             set_default_def (arg, narg);
              /* ?? Is setting the subcode really necessary ??  */
              gimple_omp_set_subcode (parcopy_stmt, TREE_CODE (narg));
              gimple_assign_set_rhs1 (parcopy_stmt, narg);
--- 3499,3507 ----
              /* If we are in ssa form, we must load the value from the default
                 definition of the argument.  That should not be defined now,
                 since the argument is not used uninitialized.  */
!             gcc_assert (ssa_default_def (cfun, arg) == NULL);
              narg = make_ssa_name (arg, gimple_build_nop ());
!             set_ssa_default_def (cfun, arg, narg);
              /* ?? Is setting the subcode really necessary ??  */
              gimple_omp_set_subcode (parcopy_stmt, TREE_CODE (narg));
              gimple_assign_set_rhs1 (parcopy_stmt, narg);
Index: trunk/gcc/tree-cfg.c
===================================================================
*** trunk.orig/gcc/tree-cfg.c   2012-08-02 10:13:52.000000000 +0200
--- trunk/gcc/tree-cfg.c        2012-08-02 10:16:24.593266230 +0200
*************** replace_ssa_name (tree name, struct poin
*** 6047,6057 ****
      {
        replace_by_duplicate_decl (&decl, vars_map, to_context);
  
-       push_cfun (DECL_STRUCT_FUNCTION (to_context));
        new_name = make_ssa_name (decl, SSA_NAME_DEF_STMT (name));
        if (SSA_NAME_IS_DEFAULT_DEF (name))
!       set_default_def (decl, new_name);
!       pop_cfun ();
  
        loc = pointer_map_insert (vars_map, name);
        *loc = new_name;
--- 6047,6055 ----
      {
        replace_by_duplicate_decl (&decl, vars_map, to_context);
  
        new_name = make_ssa_name (decl, SSA_NAME_DEF_STMT (name));
        if (SSA_NAME_IS_DEFAULT_DEF (name))
!       set_ssa_default_def (to_context, decl, new_name);
  
        loc = pointer_map_insert (vars_map, name);
        *loc = new_name;
Index: trunk/gcc/tree-complex.c
===================================================================
*** trunk.orig/gcc/tree-complex.c       2012-08-02 10:13:51.000000000 +0200
--- trunk/gcc/tree-complex.c    2012-08-02 10:16:24.593266230 +0200
*************** init_parameter_lattice_values (void)
*** 176,182 ****
  
    for (parm = DECL_ARGUMENTS (cfun->decl); parm ; parm = DECL_CHAIN (parm))
      if (is_complex_reg (parm)
!       && (ssa_name = gimple_default_def (cfun, parm)) != NULL_TREE)
        VEC_replace (complex_lattice_t, complex_lattice_values,
                   SSA_NAME_VERSION (ssa_name), VARYING);
  }
--- 176,182 ----
  
    for (parm = DECL_ARGUMENTS (cfun->decl); parm ; parm = DECL_CHAIN (parm))
      if (is_complex_reg (parm)
!       && (ssa_name = ssa_default_def (cfun, parm)) != NULL_TREE)
        VEC_replace (complex_lattice_t, complex_lattice_values,
                   SSA_NAME_VERSION (ssa_name), VARYING);
  }
*************** get_component_ssa_name (tree ssa_name, b
*** 496,505 ****
        SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ret)
        = SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ssa_name);
        if (TREE_CODE (SSA_NAME_VAR (ssa_name)) == VAR_DECL
!         && gimple_nop_p (SSA_NAME_DEF_STMT (ssa_name)))
        {
          SSA_NAME_DEF_STMT (ret) = SSA_NAME_DEF_STMT (ssa_name);
!         set_default_def (SSA_NAME_VAR (ret), ret);
        }
  
        VEC_replace (tree, complex_ssa_name_components, ssa_name_index, ret);
--- 496,505 ----
        SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ret)
        = SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ssa_name);
        if (TREE_CODE (SSA_NAME_VAR (ssa_name)) == VAR_DECL
!         && SSA_NAME_IS_DEFAULT_DEF (ssa_name))
        {
          SSA_NAME_DEF_STMT (ret) = SSA_NAME_DEF_STMT (ssa_name);
!         set_ssa_default_def (cfun, SSA_NAME_VAR (ret), ret);
        }
  
        VEC_replace (tree, complex_ssa_name_components, ssa_name_index, ret);
*************** update_parameter_components (void)
*** 690,696 ****
        continue;
  
        type = TREE_TYPE (type);
!       ssa_name = gimple_default_def (cfun, parm);
        if (!ssa_name)
        continue;
  
--- 690,696 ----
        continue;
  
        type = TREE_TYPE (type);
!       ssa_name = ssa_default_def (cfun, parm);
        if (!ssa_name)
        continue;
  
Index: trunk/gcc/tree-dfa.c
===================================================================
*** trunk.orig/gcc/tree-dfa.c   2012-08-02 10:13:52.000000000 +0200
--- trunk/gcc/tree-dfa.c        2012-08-02 10:32:07.280233589 +0200
*************** dump_variable (FILE *file, tree var)
*** 164,173 ****
    if (TREE_THIS_VOLATILE (var))
      fprintf (file, ", is volatile");
  
!   if (cfun && gimple_default_def (cfun, var))
      {
        fprintf (file, ", default def: ");
!       print_generic_expr (file, gimple_default_def (cfun, var), dump_flags);
      }
  
    if (DECL_INITIAL (var))
--- 164,173 ----
    if (TREE_THIS_VOLATILE (var))
      fprintf (file, ", is volatile");
  
!   if (cfun && ssa_default_def (cfun, var))
      {
        fprintf (file, ", default def: ");
!       print_generic_expr (file, ssa_default_def (cfun, var), dump_flags);
      }
  
    if (DECL_INITIAL (var))
*************** collect_dfa_stats (struct dfa_stats_d *d
*** 312,360 ****
     variable.  */
  
  tree
! gimple_default_def (struct function *fn, tree var)
  {
    struct tree_decl_minimal ind;
    struct tree_ssa_name in;
!   gcc_assert (SSA_VAR_P (var));
    in.var = (tree)&ind;
    ind.uid = DECL_UID (var);
    return (tree) htab_find_with_hash (DEFAULT_DEFS (fn), &in, DECL_UID (var));
  }
  
! /* Insert the pair VAR's UID, DEF into the default_defs hashtable.  */
  
  void
! set_default_def (tree var, tree def)
  {
    struct tree_decl_minimal ind;
    struct tree_ssa_name in;
    void **loc;
  
!   gcc_assert (SSA_VAR_P (var));
    in.var = (tree)&ind;
    ind.uid = DECL_UID (var);
    if (!def)
      {
!       loc = htab_find_slot_with_hash (DEFAULT_DEFS (cfun), &in,
!             DECL_UID (var), INSERT);
!       gcc_assert (*loc);
!       htab_remove_elt (DEFAULT_DEFS (cfun), *loc);
        return;
      }
    gcc_assert (TREE_CODE (def) == SSA_NAME && SSA_NAME_VAR (def) == var);
!   loc = htab_find_slot_with_hash (DEFAULT_DEFS (cfun), &in,
                                    DECL_UID (var), INSERT);
  
    /* Default definition might be changed by tail call optimization.  */
    if (*loc)
      SSA_NAME_IS_DEFAULT_DEF (*(tree *) loc) = false;
-   *(tree *) loc = def;
  
     /* Mark DEF as the default definition for VAR.  */
     SSA_NAME_IS_DEFAULT_DEF (def) = true;
  }
  
  
  /* If EXP is a handled component reference for a structure, return the
     base variable.  The access range is delimited by bit positions *POFFSET and
--- 312,379 ----
     variable.  */
  
  tree
! ssa_default_def (struct function *fn, tree var)
  {
    struct tree_decl_minimal ind;
    struct tree_ssa_name in;
!   gcc_assert (TREE_CODE (var) == VAR_DECL
!             || TREE_CODE (var) == PARM_DECL
!             || TREE_CODE (var) == RESULT_DECL);
    in.var = (tree)&ind;
    ind.uid = DECL_UID (var);
    return (tree) htab_find_with_hash (DEFAULT_DEFS (fn), &in, DECL_UID (var));
  }
  
! /* Insert the pair VAR's UID, DEF into the default_defs hashtable
!    of function FN.  */
  
  void
! set_ssa_default_def (struct function *fn, tree var, tree def)
  {
    struct tree_decl_minimal ind;
    struct tree_ssa_name in;
    void **loc;
  
!   gcc_assert (TREE_CODE (var) == VAR_DECL
!             || TREE_CODE (var) == PARM_DECL
!             || TREE_CODE (var) == RESULT_DECL);
    in.var = (tree)&ind;
    ind.uid = DECL_UID (var);
    if (!def)
      {
!       loc = htab_find_slot_with_hash (DEFAULT_DEFS (fn), &in,
!                                     DECL_UID (var), NO_INSERT);
!       if (*loc)
!       htab_clear_slot (DEFAULT_DEFS (fn), loc);
        return;
      }
    gcc_assert (TREE_CODE (def) == SSA_NAME && SSA_NAME_VAR (def) == var);
!   loc = htab_find_slot_with_hash (DEFAULT_DEFS (fn), &in,
                                    DECL_UID (var), INSERT);
  
    /* Default definition might be changed by tail call optimization.  */
    if (*loc)
      SSA_NAME_IS_DEFAULT_DEF (*(tree *) loc) = false;
  
     /* Mark DEF as the default definition for VAR.  */
+   *(tree *) loc = def;
     SSA_NAME_IS_DEFAULT_DEF (def) = true;
  }
  
+ /* Retrieve or create a default definition for VAR.  */
+ 
+ tree
+ get_or_create_ssa_default_def (struct function *fn, tree var)
+ {
+   tree ddef = ssa_default_def (fn, var);
+   if (ddef == NULL_TREE)
+     {
+       ddef = make_ssa_name (var, gimple_build_nop ());
+       set_ssa_default_def (cfun, var, ddef);
+     }
+   return ddef;
+ }
+ 
  
  /* If EXP is a handled component reference for a structure, return the
     base variable.  The access range is delimited by bit positions *POFFSET and
Index: trunk/gcc/tree-flow.h
===================================================================
*** trunk.orig/gcc/tree-flow.h  2012-08-02 10:13:52.000000000 +0200
--- trunk/gcc/tree-flow.h       2012-08-02 10:16:24.594266230 +0200
*************** extern void debug_dfa_stats (void);
*** 445,452 ****
  extern void dump_variable (FILE *, tree);
  extern void debug_variable (tree);
  extern tree make_rename_temp (tree, const char *);
! extern void set_default_def (tree, tree);
! extern tree gimple_default_def (struct function *, tree);
  extern bool stmt_references_abnormal_ssa_name (gimple);
  extern tree get_addr_base_and_unit_offset (tree, HOST_WIDE_INT *);
  extern void dump_enumerated_decls (FILE *, int);
--- 445,453 ----
  extern void dump_variable (FILE *, tree);
  extern void debug_variable (tree);
  extern tree make_rename_temp (tree, const char *);
! extern void set_ssa_default_def (struct function *, tree, tree);
! extern tree ssa_default_def (struct function *, tree);
! extern tree get_or_create_ssa_default_def (struct function *, tree);
  extern bool stmt_references_abnormal_ssa_name (gimple);
  extern tree get_addr_base_and_unit_offset (tree, HOST_WIDE_INT *);
  extern void dump_enumerated_decls (FILE *, int);
Index: trunk/gcc/tree-inline.c
===================================================================
*** trunk.orig/gcc/tree-inline.c        2012-08-02 10:13:52.000000000 +0200
--- trunk/gcc/tree-inline.c     2012-08-02 10:16:24.594266230 +0200
*************** remap_ssa_name (tree name, copy_body_dat
*** 247,253 ****
          struct ptr_info_def *new_pi = get_ptr_info (new_tree);
          new_pi->pt = pi->pt;
        }
!       if (gimple_nop_p (SSA_NAME_DEF_STMT (name)))
        {
          /* By inlining function having uninitialized variable, we might
             extend the lifetime (variable might get reused).  This cause
--- 247,253 ----
          struct ptr_info_def *new_pi = get_ptr_info (new_tree);
          new_pi->pt = pi->pt;
        }
!       if (SSA_NAME_IS_DEFAULT_DEF (name))
        {
          /* By inlining function having uninitialized variable, we might
             extend the lifetime (variable might get reused).  This cause
*************** remap_ssa_name (tree name, copy_body_dat
*** 259,265 ****
             this for all BBs that are not inside strongly connected
             regions of the CFG, but this is expensive to test.  */
          if (id->entry_bb
-             && is_gimple_reg (SSA_NAME_VAR (name))
              && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name)
              && TREE_CODE (SSA_NAME_VAR (name)) != PARM_DECL
              && (id->entry_bb != EDGE_SUCC (ENTRY_BLOCK_PTR, 0)->dest
--- 259,264 ----
*************** remap_ssa_name (tree name, copy_body_dat
*** 276,284 ****
          else
            {
              SSA_NAME_DEF_STMT (new_tree) = gimple_build_nop ();
!             if (gimple_default_def (id->src_cfun, SSA_NAME_VAR (name))
!                 == name)
!               set_default_def (SSA_NAME_VAR (new_tree), new_tree);
            }
        }
      }
--- 275,281 ----
          else
            {
              SSA_NAME_DEF_STMT (new_tree) = gimple_build_nop ();
!             set_ssa_default_def (cfun, SSA_NAME_VAR (new_tree), new_tree);
            }
        }
      }
*************** setup_one_parameter (copy_body_data *id,
*** 2502,2508 ****
    tree var;
    tree rhs = value;
    tree def = (gimple_in_ssa_p (cfun)
!             ? gimple_default_def (id->src_cfun, p) : NULL);
  
    if (value
        && value != error_mark_node
--- 2499,2505 ----
    tree var;
    tree rhs = value;
    tree def = (gimple_in_ssa_p (cfun)
!             ? ssa_default_def (id->src_cfun, p) : NULL);
  
    if (value
        && value != error_mark_node
*************** setup_one_parameter (copy_body_data *id,
*** 2635,2641 ****
              def = remap_ssa_name (def, id);
              init_stmt = gimple_build_assign (def, rhs);
              SSA_NAME_IS_DEFAULT_DEF (def) = 0;
!             set_default_def (var, NULL);
            }
          else if (!optimize)
            {
--- 2632,2638 ----
              def = remap_ssa_name (def, id);
              init_stmt = gimple_build_assign (def, rhs);
              SSA_NAME_IS_DEFAULT_DEF (def) = 0;
!             set_ssa_default_def (cfun, var, NULL);
            }
          else if (!optimize)
            {
*************** initialize_inlined_parameters (copy_body
*** 2687,2693 ****
          && TREE_CODE (*varp) == VAR_DECL)
        {
          tree def = (gimple_in_ssa_p (cfun) && is_gimple_reg (p)
!                     ? gimple_default_def (id->src_cfun, p) : NULL);
          tree var = *varp;
          TREE_TYPE (var) = remap_type (TREE_TYPE (var), id);
          /* Also remap the default definition if it was remapped
--- 2684,2690 ----
          && TREE_CODE (*varp) == VAR_DECL)
        {
          tree def = (gimple_in_ssa_p (cfun) && is_gimple_reg (p)
!                     ? ssa_default_def (id->src_cfun, p) : NULL);
          tree var = *varp;
          TREE_TYPE (var) = remap_type (TREE_TYPE (var), id);
          /* Also remap the default definition if it was remapped
*************** declare_return_variable (copy_body_data
*** 2902,2909 ****
          && is_gimple_reg (result))
        {
          temp = make_ssa_name (temp, NULL);
!         insert_decl_map (id, gimple_default_def (id->src_cfun, result),
!                          temp);
        }
        insert_init_stmt (id, entry_bb, gimple_build_assign (temp, var));
      }
--- 2899,2905 ----
          && is_gimple_reg (result))
        {
          temp = make_ssa_name (temp, NULL);
!         insert_decl_map (id, ssa_default_def (id->src_cfun, result), temp);
        }
        insert_init_stmt (id, entry_bb, gimple_build_assign (temp, var));
      }
*************** expand_call_inline (basic_block bb, gimp
*** 3983,3989 ****
        {
          tree name = gimple_call_lhs (stmt);
          tree var = SSA_NAME_VAR (name);
!         tree def = gimple_default_def (cfun, var);
  
          if (def)
            {
--- 3979,3985 ----
        {
          tree name = gimple_call_lhs (stmt);
          tree var = SSA_NAME_VAR (name);
!         tree def = ssa_default_def (cfun, var);
  
          if (def)
            {
*************** expand_call_inline (basic_block bb, gimp
*** 3996,4002 ****
            {
              /* Otherwise make this variable undefined.  */
              gsi_remove (&stmt_gsi, true);
!             set_default_def (var, name);
              SSA_NAME_DEF_STMT (name) = gimple_build_nop ();
            }
        }
--- 3992,3998 ----
            {
              /* Otherwise make this variable undefined.  */
              gsi_remove (&stmt_gsi, true);
!             set_ssa_default_def (cfun, var, name);
              SSA_NAME_DEF_STMT (name) = gimple_build_nop ();
            }
        }
*************** tree_function_versioning (tree old_decl,
*** 5160,5172 ****
        lang_hooks.dup_lang_specific_decl (DECL_RESULT (new_decl));
        if (gimple_in_ssa_p (id.src_cfun)
          && DECL_BY_REFERENCE (DECL_RESULT (old_decl))
!         && (old_name
!             = gimple_default_def (id.src_cfun, DECL_RESULT (old_decl))))
        {
          tree new_name = make_ssa_name (DECL_RESULT (new_decl), NULL);
          insert_decl_map (&id, old_name, new_name);
          SSA_NAME_DEF_STMT (new_name) = gimple_build_nop ();
!         set_default_def (DECL_RESULT (new_decl), new_name);
        }
      }
  
--- 5156,5167 ----
        lang_hooks.dup_lang_specific_decl (DECL_RESULT (new_decl));
        if (gimple_in_ssa_p (id.src_cfun)
          && DECL_BY_REFERENCE (DECL_RESULT (old_decl))
!         && (old_name = ssa_default_def (id.src_cfun, DECL_RESULT (old_decl))))
        {
          tree new_name = make_ssa_name (DECL_RESULT (new_decl), NULL);
          insert_decl_map (&id, old_name, new_name);
          SSA_NAME_DEF_STMT (new_name) = gimple_build_nop ();
!         set_ssa_default_def (cfun, DECL_RESULT (new_decl), new_name);
        }
      }
  
Index: trunk/gcc/tree-into-ssa.c
===================================================================
*** trunk.orig/gcc/tree-into-ssa.c      2012-08-02 10:13:51.000000000 +0200
--- trunk/gcc/tree-into-ssa.c   2012-08-02 10:16:24.595266230 +0200
*************** find_def_blocks_for (tree var)
*** 987,1009 ****
  }
  
  
- /* Retrieve or create a default definition for symbol SYM.  */
- 
- static inline tree
- get_default_def_for (tree sym)
- {
-   tree ddef = gimple_default_def (cfun, sym);
- 
-   if (ddef == NULL_TREE)
-     {
-       ddef = make_ssa_name (sym, gimple_build_nop ());
-       set_default_def (sym, ddef);
-     }
- 
-   return ddef;
- }
- 
- 
  /* Marks phi node PHI in basic block BB for rewrite.  */
  
  static void
--- 987,992 ----
*************** get_reaching_def (tree var)
*** 1253,1259 ****
    if (currdef == NULL_TREE)
      {
        tree sym = DECL_P (var) ? var : SSA_NAME_VAR (var);
!       currdef = get_default_def_for (sym);
        set_current_def (var, currdef);
      }
  
--- 1236,1242 ----
    if (currdef == NULL_TREE)
      {
        tree sym = DECL_P (var) ? var : SSA_NAME_VAR (var);
!       currdef = get_or_create_ssa_default_def (cfun, sym);
        set_current_def (var, currdef);
      }
  
Index: trunk/gcc/tree-predcom.c
===================================================================
*** trunk.orig/gcc/tree-predcom.c       2012-08-02 10:13:52.000000000 +0200
--- trunk/gcc/tree-predcom.c    2012-08-02 10:16:24.595266230 +0200
*************** replace_ref_with (gimple stmt, tree new_
*** 1308,1322 ****
          val = gimple_assign_rhs1 (stmt);
          gcc_assert (gimple_assign_single_p (stmt));
          if (TREE_CLOBBER_P (val))
!           {
!             val = gimple_default_def (cfun, SSA_NAME_VAR (new_tree));
!             if (val == NULL_TREE)
!               {
!                 val = make_ssa_name (SSA_NAME_VAR (new_tree),
!                                      gimple_build_nop ());
!                 set_default_def (SSA_NAME_VAR (new_tree), val);
!               }
!           }
          else
            gcc_assert (gimple_assign_copy_p (stmt));
        }
--- 1308,1314 ----
          val = gimple_assign_rhs1 (stmt);
          gcc_assert (gimple_assign_single_p (stmt));
          if (TREE_CLOBBER_P (val))
!           val = get_or_create_ssa_default_def (cfun, SSA_NAME_VAR (new_tree));
          else
            gcc_assert (gimple_assign_copy_p (stmt));
        }
Index: trunk/gcc/tree-sra.c
===================================================================
*** trunk.orig/gcc/tree-sra.c   2012-08-02 10:13:52.000000000 +0200
--- trunk/gcc/tree-sra.c        2012-08-02 10:16:24.596266230 +0200
*************** sra_modify_constructor_assign (gimple *s
*** 2842,2859 ****
  static tree
  get_repl_default_def_ssa_name (struct access *racc)
  {
!   tree repl, decl;
! 
!   decl = get_access_replacement (racc);
! 
!   repl = gimple_default_def (cfun, decl);
!   if (!repl)
!     {
!       repl = make_ssa_name (decl, gimple_build_nop ());
!       set_default_def (decl, repl);
!     }
! 
!   return repl;
  }
  
  /* Return true if REF has a COMPONENT_REF with a bit-field field declaration
--- 2842,2848 ----
  static tree
  get_repl_default_def_ssa_name (struct access *racc)
  {
!   return get_or_create_ssa_default_def (cfun, get_access_replacement (racc));
  }
  
  /* Return true if REF has a COMPONENT_REF with a bit-field field declaration
*************** is_unused_scalar_param (tree parm)
*** 3351,3357 ****
  {
    tree name;
    return (is_gimple_reg (parm)
!         && (!(name = gimple_default_def (cfun, parm))
              || has_zero_uses (name)));
  }
  
--- 3340,3346 ----
  {
    tree name;
    return (is_gimple_reg (parm)
!         && (!(name = ssa_default_def (cfun, parm))
              || has_zero_uses (name)));
  }
  
*************** ptr_parm_has_direct_uses (tree parm)
*** 3365,3371 ****
  {
    imm_use_iterator ui;
    gimple stmt;
!   tree name = gimple_default_def (cfun, parm);
    bool ret = false;
  
    FOR_EACH_IMM_USE_STMT (stmt, ui, name)
--- 3354,3360 ----
  {
    imm_use_iterator ui;
    gimple stmt;
!   tree name = ssa_default_def (cfun, parm);
    bool ret = false;
  
    FOR_EACH_IMM_USE_STMT (stmt, ui, name)
*************** sra_ipa_reset_debug_stmts (ipa_parm_adju
*** 4531,4537 ****
        adj = VEC_index (ipa_parm_adjustment_t, adjustments, i);
        if (adj->copy_param || !is_gimple_reg (adj->base))
        continue;
!       name = gimple_default_def (cfun, adj->base);
        vexpr = NULL;
        if (name)
        FOR_EACH_IMM_USE_STMT (stmt, ui, name)
--- 4520,4526 ----
        adj = VEC_index (ipa_parm_adjustment_t, adjustments, i);
        if (adj->copy_param || !is_gimple_reg (adj->base))
        continue;
!       name = ssa_default_def (cfun, adj->base);
        vexpr = NULL;
        if (name)
        FOR_EACH_IMM_USE_STMT (stmt, ui, name)
Index: trunk/gcc/tree-ssa-coalesce.c
===================================================================
*** trunk.orig/gcc/tree-ssa-coalesce.c  2012-08-02 10:13:52.000000000 +0200
--- trunk/gcc/tree-ssa-coalesce.c       2012-08-02 10:16:24.596266230 +0200
*************** create_outofssa_var_map (coalesce_list_p
*** 1148,1154 ****
          /* Mark any default_def variables as being in the coalesce list
             since they will have to be coalesced with the base variable.  If
             not marked as present, they won't be in the coalesce view. */
!         if (gimple_default_def (cfun, SSA_NAME_VAR (var)) == var
              && !has_zero_uses (var))
            bitmap_set_bit (used_in_copy, SSA_NAME_VERSION (var));
        }
--- 1148,1154 ----
          /* Mark any default_def variables as being in the coalesce list
             since they will have to be coalesced with the base variable.  If
             not marked as present, they won't be in the coalesce view. */
!         if (SSA_NAME_IS_DEFAULT_DEF (var)
              && !has_zero_uses (var))
            bitmap_set_bit (used_in_copy, SSA_NAME_VERSION (var));
        }
Index: trunk/gcc/tree-ssa-copyrename.c
===================================================================
*** trunk.orig/gcc/tree-ssa-copyrename.c        2012-08-02 10:11:04.000000000 
+0200
--- trunk/gcc/tree-ssa-copyrename.c     2012-08-02 10:16:24.596266230 +0200
*************** copy_rename_partition_coalesce (var_map
*** 211,219 ****
  
    /* If both values have default defs, we can't coalesce.  If only one has a
       tag, make sure that variable is the new root partition.  */
!   if (gimple_default_def (cfun, root1))
      {
!       if (gimple_default_def (cfun, root2))
        {
          if (debug)
            fprintf (debug, " : 2 default defs. No coalesce.\n");
--- 211,219 ----
  
    /* If both values have default defs, we can't coalesce.  If only one has a
       tag, make sure that variable is the new root partition.  */
!   if (ssa_default_def (cfun, root1))
      {
!       if (ssa_default_def (cfun, root2))
        {
          if (debug)
            fprintf (debug, " : 2 default defs. No coalesce.\n");
*************** copy_rename_partition_coalesce (var_map
*** 225,231 ****
          ign1 = false;
        }
      }
!   else if (gimple_default_def (cfun, root2))
      {
        ign1 = true;
        ign2 = false;
--- 225,231 ----
          ign1 = false;
        }
      }
!   else if (ssa_default_def (cfun, root2))
      {
        ign1 = true;
        ign2 = false;
Index: trunk/gcc/tree-ssa-live.c
===================================================================
*** trunk.orig/gcc/tree-ssa-live.c      2012-08-02 10:13:52.000000000 +0200
--- trunk/gcc/tree-ssa-live.c   2012-08-02 10:16:24.596266230 +0200
*************** verify_live_on_entry (tree_live_info_p l
*** 1269,1275 ****
          var = partition_to_var (map, i);
          stmt = SSA_NAME_DEF_STMT (var);
          tmp = gimple_bb (stmt);
!         d = gimple_default_def (cfun, SSA_NAME_VAR (var));
  
          loe = live_on_entry (live, e->dest);
          if (loe && bitmap_bit_p (loe, i))
--- 1269,1275 ----
          var = partition_to_var (map, i);
          stmt = SSA_NAME_DEF_STMT (var);
          tmp = gimple_bb (stmt);
!         d = ssa_default_def (cfun, SSA_NAME_VAR (var));
  
          loe = live_on_entry (live, e->dest);
          if (loe && bitmap_bit_p (loe, i))
Index: trunk/gcc/tree-ssa-math-opts.c
===================================================================
*** trunk.orig/gcc/tree-ssa-math-opts.c 2012-08-02 10:13:51.000000000 +0200
--- trunk/gcc/tree-ssa-math-opts.c      2012-08-02 10:16:24.597266230 +0200
*************** execute_cse_reciprocals (void)
*** 513,522 ****
  #endif
  
    for (arg = DECL_ARGUMENTS (cfun->decl); arg; arg = DECL_CHAIN (arg))
!     if (gimple_default_def (cfun, arg)
!       && FLOAT_TYPE_P (TREE_TYPE (arg))
        && is_gimple_reg (arg))
!       execute_cse_reciprocals_1 (NULL, gimple_default_def (cfun, arg));
  
    FOR_EACH_BB (bb)
      {
--- 513,525 ----
  #endif
  
    for (arg = DECL_ARGUMENTS (cfun->decl); arg; arg = DECL_CHAIN (arg))
!     if (FLOAT_TYPE_P (TREE_TYPE (arg))
        && is_gimple_reg (arg))
!       {
!       tree name = ssa_default_def (cfun, arg);
!       if (name)
!         execute_cse_reciprocals_1 (NULL, name);
!       }
  
    FOR_EACH_BB (bb)
      {
Index: trunk/gcc/tree-ssa-sccvn.c
===================================================================
*** trunk.orig/gcc/tree-ssa-sccvn.c     2012-08-02 10:11:04.000000000 +0200
--- trunk/gcc/tree-ssa-sccvn.c  2012-08-02 10:16:24.597266230 +0200
*************** run_scc_vn (vn_lookup_kind default_vn_wa
*** 3991,4001 ****
         param;
         param = DECL_CHAIN (param))
      {
!       if (gimple_default_def (cfun, param) != NULL)
!       {
!         tree def = gimple_default_def (cfun, param);
!         VN_INFO (def)->valnum = def;
!       }
      }
  
    for (i = 1; i < num_ssa_names; ++i)
--- 3991,3999 ----
         param;
         param = DECL_CHAIN (param))
      {
!       tree def = ssa_default_def (cfun, param);
!       if (def)
!       VN_INFO (def)->valnum = def;
      }
  
    for (i = 1; i < num_ssa_names; ++i)
Index: trunk/gcc/tree-tailcall.c
===================================================================
*** trunk.orig/gcc/tree-tailcall.c      2012-08-02 10:13:51.000000000 +0200
--- trunk/gcc/tree-tailcall.c   2012-08-02 10:16:24.598266230 +0200
*************** arg_needs_copy_p (tree param)
*** 767,773 ****
      return false;
  
    /* Parameters that are only defined but never used need not be copied.  */
!   def = gimple_default_def (cfun, param);
    if (!def)
      return false;
  
--- 767,773 ----
      return false;
  
    /* Parameters that are only defined but never used need not be copied.  */
!   def = ssa_default_def (cfun, param);
    if (!def)
      return false;
  
*************** tree_optimize_tail_calls_1 (bool opt_tai
*** 969,979 ****
               param = DECL_CHAIN (param))
            if (arg_needs_copy_p (param))
              {
!               tree name = gimple_default_def (cfun, param);
                tree new_name = make_ssa_name (param, SSA_NAME_DEF_STMT (name));
                gimple phi;
  
!               set_default_def (param, new_name);
                phi = create_phi_node (name, first);
                SSA_NAME_DEF_STMT (name) = phi;
                add_phi_arg (phi, new_name, single_pred_edge (first),
--- 969,979 ----
               param = DECL_CHAIN (param))
            if (arg_needs_copy_p (param))
              {
!               tree name = ssa_default_def (cfun, param);
                tree new_name = make_ssa_name (param, SSA_NAME_DEF_STMT (name));
                gimple phi;
  
!               set_ssa_default_def (cfun, param, new_name);
                phi = create_phi_node (name, first);
                SSA_NAME_DEF_STMT (name) = phi;
                add_phi_arg (phi, new_name, single_pred_edge (first),

Reply via email to