This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH][C++] Remove some dead code


This removes dead/duplicate calling of simplify_aggr_init_exprs in
expand_or_defer_fn.  First the function is already gimplified, so there
should be no point in applying the simplification to the generic trees
at this point (since we have tuples now).  Anyway, this 
simplify_aggr_init_expr is also done during gimplification, which makes
this call redudnant as well.

Bootstrapped and tested on x86_64-unknown-linux-gnu, ok for trunk?

Thanks,
Richard.

2008-10-14  Richard Guenther  <rguenther@suse.de>

	* semantics.c (simplify_aggr_init_exprs_r): Remove.
	(expand_or_defer_fn): Do not walk the function body to
	simplify aggr_init_exprs.

Index: gcc/cp/semantics.c
===================================================================
*** gcc/cp/semantics.c	(revision 141066)
--- gcc/cp/semantics.c	(working copy)
*************** along with GCC; see the file COPYING3.  
*** 54,60 ****
     degenerate form of parsing.  */
  
  static tree maybe_convert_cond (tree);
- static tree simplify_aggr_init_exprs_r (tree *, int *, void *);
  static tree finalize_nrv_r (tree *, int *, void *);
  
  
--- 54,59 ----
*************** finish_offsetof (tree expr)
*** 3056,3089 ****
    return fold_offsetof (expr, NULL_TREE);
  }
  
- /* Called from expand_body via walk_tree.  Replace all AGGR_INIT_EXPRs
-    with equivalent CALL_EXPRs.  */
- 
- static tree
- simplify_aggr_init_exprs_r (tree* tp,
- 			    int* walk_subtrees,
- 			    void* data ATTRIBUTE_UNUSED)
- {
-   /* We don't need to walk into types; there's nothing in a type that
-      needs simplification.  (And, furthermore, there are places we
-      actively don't want to go.  For example, we don't want to wander
-      into the default arguments for a FUNCTION_DECL that appears in a
-      CALL_EXPR.)  */
-   if (TYPE_P (*tp))
-     {
-       *walk_subtrees = 0;
-       return NULL_TREE;
-     }
-   /* Only AGGR_INIT_EXPRs are interesting.  */
-   else if (TREE_CODE (*tp) != AGGR_INIT_EXPR)
-     return NULL_TREE;
- 
-   simplify_aggr_init_expr (tp);
- 
-   /* Keep iterating.  */
-   return NULL_TREE;
- }
- 
  /* Replace the AGGR_INIT_EXPR at *TP with an equivalent CALL_EXPR.  This
     function is broken out from the above for the benefit of the tree-ssa
     project.  */
--- 3055,3060 ----
*************** expand_or_defer_fn (tree fn)
*** 3206,3216 ****
  
    gcc_assert (gimple_body (fn));
  
-   /* Replace AGGR_INIT_EXPRs with appropriate CALL_EXPRs.  */
-   cp_walk_tree_without_duplicates (&DECL_SAVED_TREE (fn),
- 				   simplify_aggr_init_exprs_r,
- 				   NULL);
- 
    /* If this is a constructor or destructor body, we have to clone
       it.  */
    if (maybe_clone_body (fn))
--- 3177,3182 ----


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]