Patchwork [1/n] Minor pass re-orgs

login
register
mail settings
Submitter Richard Guenther
Date Sept. 22, 2010, 9:24 a.m.
Message ID <alpine.LNX.2.00.1009221114290.8982@zhemvz.fhfr.qr>
Download mbox | patch
Permalink /patch/65412/
State New
Headers show

Comments

Richard Guenther - Sept. 22, 2010, 9:24 a.m.
This tries to remove two seemingly useless passes, a CCP and copyprop
combo right before PRE and right after DOM.  Now it happens that
at -O1 PRE is not run (not even in FRE mode), so the argument that
this would do constant propagation already is moot (and it causes
gcc.dg/uninit-2.c to fail at -O1).  So instead of removing the combo
this patch removes the copyprop and moves the CCP pass right
after loop optimizations where it helps to clean up code from
the unroller and will re-compute alignment information for new
code snippets emitted.

Looking at this I noticed that we do not have a sensible pass
pipeline at -O1 at all, but I recognize that people may want
to have -O2 equal to -O1 plus individual optimizations.

The plan with pass re-orgs for 4.6 is to have FRE during early
optimizations, and my idea for -O1 (what is -O1 about again?)
would be to cut off after early optimziations and go right to
expansion.  I will try to experiment with the feasibility of
the latter next.  Well, that is, if -O1 is really about
compile-speed plus basic optimizations that keep debugging
working.  Is it?

Bootstrapped and tested on x86_64-unknown-linux-gnu, I'll leave
this for general comments for now.

Thanks,
Richard.

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

	* passes.c (init_optimization_passes): Move CCP from before
	PRE to after loop optimizations.  Remove copyprop before PRE.

Patch

Index: gcc/passes.c
===================================================================
--- gcc/passes.c	(revision 164482)
+++ gcc/passes.c	(working copy)
@@ -882,8 +882,6 @@  init_optimization_passes (void)
       NEXT_PASS (pass_forwprop);
       NEXT_PASS (pass_phiopt);
       NEXT_PASS (pass_object_sizes);
-      NEXT_PASS (pass_ccp);
-      NEXT_PASS (pass_copy_prop);
       NEXT_PASS (pass_cse_sincos);
       NEXT_PASS (pass_optimize_bswap);
       NEXT_PASS (pass_split_crit_edges);
@@ -928,6 +926,7 @@  init_optimization_passes (void)
 	  NEXT_PASS (pass_iv_optimize);
 	  NEXT_PASS (pass_tree_loop_done);
 	}
+      NEXT_PASS (pass_ccp);
       NEXT_PASS (pass_cse_reciprocals);
       NEXT_PASS (pass_reassoc);
       NEXT_PASS (pass_vrp);