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]

[IPA branch] Do pre-inline CCP/DCE


Hi,
this patch implements early CCP/DCE that should make IL smaller and
easier to understand to IPA optimizers.  Unlike later passes this is
done without aliasing information (I don't want to make aliasing
information live intraprocedurally as all the vops are expensive and it
is dificult to build/discard aliasing right now).  To avoid memory
operations form being DCEed the statements gets has_volatile_ops flag.

Diego, does the tree-ssa-operands changes looks sane?

Bootstrapped/regtested i686-pc-gnu-linux, committed.
Honza

	* passes.c (init_optimization_passes): Remove commented out items; add early ccp/dce.
	* tree-ssa-operands (get_indirect_ref_operands): Mark statments wirting
	to memory as volatile before aliasing is built.
	(add_stmt_operand): Likewise.
Index: passes.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/passes.c,v
retrieving revision 2.108.2.5
diff -c -3 -p -r2.108.2.5 passes.c
*** passes.c	17 Sep 2005 23:10:18 -0000	2.108.2.5
--- passes.c	18 Sep 2005 12:21:26 -0000
*************** init_optimization_passes (void)
*** 467,481 ****
    NEXT_PASS (pass_referenced_vars);
    NEXT_PASS (pass_create_structure_vars);
    NEXT_PASS (pass_build_ssa);
-   /*NEXT_PASS (pass_may_alias);
-   NEXT_PASS (pass_return_slot);
-   NEXT_PASS (pass_rename_ssa_copies);*/
    NEXT_PASS (pass_early_warn_uninitialized);
    *p = NULL;
  
    p = &all_passes;
    NEXT_PASS (pass_fixup_cfg);
-   /*NEXT_PASS (pass_init_datastructures);*/
    NEXT_PASS (pass_all_optimizations);
    NEXT_PASS (pass_warn_function_noreturn);
    NEXT_PASS (pass_mudflap_2);
--- 467,481 ----
    NEXT_PASS (pass_referenced_vars);
    NEXT_PASS (pass_create_structure_vars);
    NEXT_PASS (pass_build_ssa);
    NEXT_PASS (pass_early_warn_uninitialized);
+ 
+   NEXT_PASS (pass_ccp);
+   NEXT_PASS (pass_dce);
+ 
    *p = NULL;
  
    p = &all_passes;
    NEXT_PASS (pass_fixup_cfg);
    NEXT_PASS (pass_all_optimizations);
    NEXT_PASS (pass_warn_function_noreturn);
    NEXT_PASS (pass_mudflap_2);
*************** init_optimization_passes (void)
*** 487,500 ****
    *p = NULL;
  
    p = &pass_all_optimizations.sub;
-   /*NEXT_PASS (pass_referenced_vars);
-   NEXT_PASS (pass_create_structure_vars);
-   NEXT_PASS (pass_build_ssa);*/
    NEXT_PASS (pass_all_early_optimizations);
    NEXT_PASS (pass_may_alias);
    NEXT_PASS (pass_return_slot);
-   /*NEXT_PASS (pass_rename_ssa_copies);
-   NEXT_PASS (pass_early_warn_uninitialized);*/
    NEXT_PASS (pass_eliminate_useless_stores);
  
    /* Initial scalar cleanups.  */
--- 487,495 ----
Index: tree-ssa-operands.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-operands.c,v
retrieving revision 2.100.2.1
diff -c -3 -p -r2.100.2.1 tree-ssa-operands.c
*** tree-ssa-operands.c	18 Aug 2005 14:43:58 -0000	2.100.2.1
--- tree-ssa-operands.c	18 Sep 2005 12:21:26 -0000
*************** get_indirect_ref_operands (tree stmt, tr
*** 1604,1609 ****
--- 1604,1613 ----
  	  v_ann = var_ann (ptr);
  	  if (v_ann->type_mem_tag)
  	    add_stmt_operand (&v_ann->type_mem_tag, s_ann, flags);
+ 	  /* Aliasing information is missing; mark statement as volatile so we
+ 	     won't optimize it out too actively.  */
+ 	  else if (s_ann && !aliases_computed_p)
+ 	    s_ann->has_volatile_ops = true;
  	}
      }
  
*************** add_stmt_operand (tree *var_p, stmt_ann_
*** 1798,1803 ****
--- 1802,1809 ----
  
        if (aliases == NULL)
  	{
+ 	  if (s_ann && !aliases_computed_p && TREE_ADDRESSABLE (var))
+ 	    s_ann->has_volatile_ops = true;
  	  /* The variable is not aliased or it is an alias tag.  */
  	  if (flags & opf_is_def)
  	    {


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