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]

Re: Fix always_inline


> ISTR that Honza has it working to some extent already.

I am attaching WIP patch (it went quite smoothly).  It breaks complex,
mudflap and other stuff, but it is good enough to bootstrap so we can
get some idea how things works.  Rearranging the mudflap/complex passes
should be easy enough later.

Compiling combine.c with SSA path slows down compiler from 1.517s to
1.636 and increase size of produced assembly somewhat (695k->697k).  7%
slowdown for combine.c (5% for Gerald's testcase) is something we need
to consider, but it is not _that_ disasterous.  I didn't experimented
with limited DCE or CCP yet.
Probably if every statement writting to user variable is marked as
having side effect, our DCE should be safe.

Honza
> 
> There are two immediate benefits I can see
> 
>  - we can run a simple CCP pass, only propagating into asms and certain builtin
>    function arguments making "inline functions as fast as macros" also work
>    reliably at -O0 (with always_inline of course).
> 
>  - some flow sensitive warnings can be enabled
> 
>  (- we can run dce reducing the size of -O0 executables)
> 
> the last one needs to be evaluated in how it will affect debug information, but
> with no propagations it shouldn't make a visible difference.
> 
> And of course reducing the number of different paths through the compiler is
> worth it on its own IMHO.
> 
> Richard.

Index: tree-optimize.c
===================================================================
*** tree-optimize.c	(revision 135136)
--- tree-optimize.c	(working copy)
*************** execute_init_datastructures (void)
*** 337,356 ****
    return 0;
  }
  
- /* Gate: initialize or not the SSA datastructures.  */
- 
- static bool
- gate_init_datastructures (void)
- {
-   return (optimize >= 1);
- }
- 
  struct gimple_opt_pass pass_init_datastructures =
  {
   {
    GIMPLE_PASS,
    NULL,					/* name */
!   gate_init_datastructures,		/* gate */
    execute_init_datastructures,		/* execute */
    NULL,					/* sub */
    NULL,					/* next */
--- 337,348 ----
    return 0;
  }
  
  struct gimple_opt_pass pass_init_datastructures =
  {
   {
    GIMPLE_PASS,
    NULL,					/* name */
!   NULL,					/* gate */
    execute_init_datastructures,		/* execute */
    NULL,					/* sub */
    NULL,					/* next */
Index: tree-outof-ssa.c
===================================================================
*** tree-outof-ssa.c	(revision 135136)
--- tree-outof-ssa.c	(working copy)
*************** struct gimple_opt_pass pass_del_ssa = 
*** 1477,1483 ****
    NULL,					/* next */
    0,					/* static_pass_number */
    TV_TREE_SSA_TO_NORMAL,		/* tv_id */
!   PROP_cfg | PROP_ssa | PROP_alias,	/* properties_required */
    0,					/* properties_provided */
    /* ??? If TER is enabled, we also kill gimple.  */
    PROP_ssa,				/* properties_destroyed */
--- 1477,1483 ----
    NULL,					/* next */
    0,					/* static_pass_number */
    TV_TREE_SSA_TO_NORMAL,		/* tv_id */
!   PROP_cfg | PROP_ssa,			/* properties_required */
    0,					/* properties_provided */
    /* ??? If TER is enabled, we also kill gimple.  */
    PROP_ssa,				/* properties_destroyed */
Index: passes.c
===================================================================
*** passes.c	(revision 135136)
--- passes.c	(working copy)
*************** init_optimization_passes (void)
*** 511,523 ****
        NEXT_PASS (pass_cleanup_cfg);
        NEXT_PASS (pass_init_datastructures);
        NEXT_PASS (pass_expand_omp);
        NEXT_PASS (pass_all_early_optimizations);
  	{
  	  struct opt_pass **p = &pass_all_early_optimizations.pass.sub;
- 	  NEXT_PASS (pass_referenced_vars);
- 	  NEXT_PASS (pass_reset_cc_flags);
- 	  NEXT_PASS (pass_build_ssa);
- 	  NEXT_PASS (pass_expand_omp_ssa);
  	  NEXT_PASS (pass_early_warn_uninitialized);
  	  NEXT_PASS (pass_rebuild_cgraph_edges);
  	  NEXT_PASS (pass_early_inline);
--- 511,524 ----
        NEXT_PASS (pass_cleanup_cfg);
        NEXT_PASS (pass_init_datastructures);
        NEXT_PASS (pass_expand_omp);
+ 
+       NEXT_PASS (pass_referenced_vars);
+       NEXT_PASS (pass_reset_cc_flags);
+       NEXT_PASS (pass_build_ssa);
+       NEXT_PASS (pass_expand_omp_ssa);
        NEXT_PASS (pass_all_early_optimizations);
  	{
  	  struct opt_pass **p = &pass_all_early_optimizations.pass.sub;
  	  NEXT_PASS (pass_early_warn_uninitialized);
  	  NEXT_PASS (pass_rebuild_cgraph_edges);
  	  NEXT_PASS (pass_early_inline);
*************** init_optimization_passes (void)
*** 535,542 ****
  	  NEXT_PASS (pass_simple_dse);
  	  NEXT_PASS (pass_tail_recursion);
            NEXT_PASS (pass_profile);
- 	  NEXT_PASS (pass_release_ssa_names);
  	}
        NEXT_PASS (pass_rebuild_cgraph_edges);
      }
    NEXT_PASS (pass_ipa_increase_alignment);
--- 536,543 ----
  	  NEXT_PASS (pass_simple_dse);
  	  NEXT_PASS (pass_tail_recursion);
            NEXT_PASS (pass_profile);
  	}
+       NEXT_PASS (pass_release_ssa_names);
        NEXT_PASS (pass_rebuild_cgraph_edges);
      }
    NEXT_PASS (pass_ipa_increase_alignment);
*************** init_optimization_passes (void)
*** 673,683 ****
        NEXT_PASS (pass_tail_calls);
        NEXT_PASS (pass_rename_ssa_copies);
        NEXT_PASS (pass_uncprop);
-       NEXT_PASS (pass_del_ssa);
-       NEXT_PASS (pass_nrv);
-       NEXT_PASS (pass_mark_used_blocks);
-       NEXT_PASS (pass_cleanup_cfg_post_optimizing);
      }
    NEXT_PASS (pass_warn_function_noreturn);
    NEXT_PASS (pass_free_datastructures);
    NEXT_PASS (pass_mudflap_2);
--- 674,685 ----
        NEXT_PASS (pass_tail_calls);
        NEXT_PASS (pass_rename_ssa_copies);
        NEXT_PASS (pass_uncprop);
      }
+   NEXT_PASS (pass_del_ssa);
+   NEXT_PASS (pass_nrv);
+   NEXT_PASS (pass_mark_used_blocks);
+   NEXT_PASS (pass_cleanup_cfg_post_optimizing);
+ 
    NEXT_PASS (pass_warn_function_noreturn);
    NEXT_PASS (pass_free_datastructures);
    NEXT_PASS (pass_mudflap_2);


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