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][2/n] Minor pass re-orgs


This removes redudnant removal of callee edges from release_dead_ssa_names
(we rebuild edges after its invocation and we'd have a separate pass
doing this - it doesn't in any way belong to SSA name freeing).  It
also removes early CFG cleanup as that is done via a TODO from the
fixup_cfg pass right before.

Bootstrapped and tested on x86_64-unknown-linux-gnu, committed.

Richard.

2010-09-22  Richard Guenther  <rguenther@suse.de>

	* tree-ssanames.c (release_dead_ssa_names): Do not remove
	callee edges here.
	* passes.c (init_optimization_passes): Remove early CFG cleanup.
	* tree-optimize.c (execute_cleanup_cfg_pre_ipa): Remove.
	(pass_cleanup_cfg): Likewise.
	(execute_fixup_cfg): Cleanup.
	* tree-pass.h (pass_cleanup_cfg): Remove.

Index: gcc/tree-ssanames.c
===================================================================
*** gcc/tree-ssanames.c	(revision 164518)
--- gcc/tree-ssanames.c	(working copy)
*************** release_dead_ssa_names (void)
*** 338,345 ****
    int n = 0;
    referenced_var_iterator rvi;
  
!   /* Current defs point to various dead SSA names that in turn points to dead
!      statements so bunch of dead memory is held from releasing.  */
    FOR_EACH_REFERENCED_VAR (t, rvi)
      set_current_def (t, NULL);
    /* Now release the freelist.  */
--- 338,345 ----
    int n = 0;
    referenced_var_iterator rvi;
  
!   /* Current defs point to various dead SSA names that in turn point to
!      eventually dead variables so a bunch of memory is held live.  */
    FOR_EACH_REFERENCED_VAR (t, rvi)
      set_current_def (t, NULL);
    /* Now release the freelist.  */
*************** release_dead_ssa_names (void)
*** 356,367 ****
      }
    FREE_SSANAMES (cfun) = NULL;
  
!   /* Cgraph edges has been invalidated and point to dead statement.  We need to
!      remove them now and will rebuild it before next IPA pass.  */
!   cgraph_node_remove_callees (cgraph_node (current_function_decl));
! 
    if (dump_file)
!     fprintf (dump_file, "Released %i names, %.2f%%\n", n, n * 100.0 / num_ssa_names);
    return 0;
  }
  
--- 356,365 ----
      }
    FREE_SSANAMES (cfun) = NULL;
  
!   statistics_counter_event (cfun, "SSA names released", n);
    if (dump_file)
!     fprintf (dump_file, "Released %i names, %.2f%%\n",
! 	     n, n * 100.0 / num_ssa_names);
    return 0;
  }
  
Index: gcc/passes.c
===================================================================
*** gcc/passes.c	(revision 164518)
--- gcc/passes.c	(working copy)
*************** init_optimization_passes (void)
*** 758,764 ****
        struct opt_pass **p = &pass_early_local_passes.pass.sub;
        NEXT_PASS (pass_fixup_cfg);
        NEXT_PASS (pass_tree_profile);
-       NEXT_PASS (pass_cleanup_cfg);
        NEXT_PASS (pass_init_datastructures);
        NEXT_PASS (pass_expand_omp);
  
--- 758,763 ----
Index: gcc/tree-optimize.c
===================================================================
*** gcc/tree-optimize.c	(revision 164518)
--- gcc/tree-optimize.c	(working copy)
*************** struct gimple_opt_pass pass_all_early_op
*** 149,185 ****
   }
  };
  
- /* Pass: cleanup the CFG just before expanding trees to RTL.
-    This is just a round of label cleanups and case node grouping
-    because after the tree optimizers have run such cleanups may
-    be necessary.  */
- 
- static unsigned int
- execute_cleanup_cfg_pre_ipa (void)
- {
-   cleanup_tree_cfg ();
-   return 0;
- }
- 
- struct gimple_opt_pass pass_cleanup_cfg =
- {
-  {
-   GIMPLE_PASS,
-   "cleanup_cfg",			/* name */
-   NULL,					/* gate */
-   execute_cleanup_cfg_pre_ipa,		/* execute */
-   NULL,					/* sub */
-   NULL,					/* next */
-   0,					/* static_pass_number */
-   TV_NONE,				/* tv_id */
-   PROP_cfg,				/* properties_required */
-   0,					/* properties_provided */
-   0,					/* properties_destroyed */
-   0,					/* todo_flags_start */
-   TODO_dump_func			/* todo_flags_finish */
-  }
- };
- 
  
  /* Pass: cleanup the CFG just before expanding trees to RTL.
     This is just a round of label cleanups and case node grouping
--- 149,154 ----
*************** execute_free_datastructures (void)
*** 260,266 ****
    return 0;
  }
  
! /* Pass: fixup_cfg.  IPA passes, compilation of earlier functions or inlining
     might have changed some properties, such as marked functions nothrow,
     pure, const or noreturn.
     Remove redundant edges and basic blocks, and create new ones if necessary.
--- 229,235 ----
    return 0;
  }
  
! /* IPA passes, compilation of earlier functions or inlining
     might have changed some properties, such as marked functions nothrow,
     pure, const or noreturn.
     Remove redundant edges and basic blocks, and create new ones if necessary.
*************** execute_fixup_cfg (void)
*** 306,312 ****
  		  if (gimple_in_ssa_p (cfun))
  		    {
  		      todo |= TODO_update_ssa | TODO_cleanup_cfg;
- 		      mark_symbols_for_renaming (stmt);
  		      update_stmt (stmt);
  		    }
  		}
--- 275,280 ----
*************** execute_fixup_cfg (void)
*** 316,326 ****
  		todo |= TODO_cleanup_cfg;
  	     }
  
! 	  maybe_clean_eh_stmt (stmt);
  	}
  
-       if (gimple_purge_dead_eh_edges (bb))
- 	todo |= TODO_cleanup_cfg;
        FOR_EACH_EDGE (e, ei, bb->succs)
          e->count = (e->count * count_scale
  		    + REG_BR_PROB_BASE / 2) / REG_BR_PROB_BASE;
--- 284,294 ----
  		todo |= TODO_cleanup_cfg;
  	     }
  
! 	  if (maybe_clean_eh_stmt (stmt)
! 	      && gimple_purge_dead_eh_edges (bb))
! 	    todo |= TODO_cleanup_cfg;
  	}
  
        FOR_EACH_EDGE (e, ei, bb->succs)
          e->count = (e->count * count_scale
  		    + REG_BR_PROB_BASE / 2) / REG_BR_PROB_BASE;
Index: gcc/tree-pass.h
===================================================================
*** gcc/tree-pass.h	(revision 164518)
--- gcc/tree-pass.h	(working copy)
*************** extern struct gimple_opt_pass pass_lower
*** 355,364 ****
  extern struct gimple_opt_pass pass_build_cfg;
  extern struct gimple_opt_pass pass_tree_profile;
  extern struct gimple_opt_pass pass_early_tree_profile;
- extern struct gimple_opt_pass pass_cleanup_cfg;
  extern struct gimple_opt_pass pass_referenced_vars;
  extern struct gimple_opt_pass pass_cleanup_eh;
- extern struct gimple_opt_pass pass_fixup_cfg;
  extern struct gimple_opt_pass pass_sra;
  extern struct gimple_opt_pass pass_sra_early;
  extern struct gimple_opt_pass pass_early_ipa_sra;
--- 355,362 ----


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