This is the mail archive of the 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: [patch] Disable tree-ssa DSE for now

On Wednesday 19 January 2005 07:44, Mark Mitchell wrote:
> Jeffrey A Law wrote:
> >>I agree.  If the optimizer experts agree that this pass is ineffective,
> >>Steven's patch should be applied.
> >
> > It largely depends on what one considers ineffective.  I can say with
> > absolute confidence that the current implementation is able to eliminate
> > stores that the RTL implementation is unable to eliminate.
> That doesn't sound all that ineffective to me, then.  I'm not eager to
> disable stuff that's doing some good.

OK, Jeff suggested disabling just one pass instead of both, which seems
reasonable, so I tried it.  I disabled the first DSE pass with the patch

	* tree-optimize.c (init_tree_optimization_passes): Only
	do a single DSE pass.  Disable the first pass.

	* gcc.dg/tree-ssa/20040216-1.c: Look in the .dse dump, not .dse1.

Index: tree-optimize.c
RCS file: /cvs/gcc/gcc/gcc/tree-optimize.c,v
retrieving revision 2.68
diff -u -3 -p -r2.68 tree-optimize.c
--- tree-optimize.c     18 Jan 2005 11:36:24 -0000      2.68
+++ tree-optimize.c     19 Jan 2005 10:48:16 -0000
@@ -365,7 +365,14 @@ init_tree_optimization_passes (void)
   NEXT_PASS (pass_dominator);
   NEXT_PASS (pass_redundant_phi);
   NEXT_PASS (pass_dce);
+  Until we have a better DSE pass, and we can provide it with better
+  alias analysis so that it can actually do something useful, disable
+  this first DSE pass.  The second DSE pass, just before going out of
+  SSA form, catches most of the dead stores we would catch if this
+  pass would stay enabled.
   NEXT_PASS (pass_dse);
   NEXT_PASS (pass_may_alias);
   NEXT_PASS (pass_forwprop);
   NEXT_PASS (pass_phiopt);
Index: gcc/testsuite/gcc.dg/tree-ssa/20040216-1.c
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/tree-ssa/20040216-1.c,v
retrieving revision 1.2
diff -u -3 -p -r1.2 20040216-1.c
--- gcc/testsuite/gcc.dg/tree-ssa/20040216-1.c  13 May 2004 06:40:51 -0000      1.2
+++ gcc/testsuite/gcc.dg/tree-ssa/20040216-1.c  19 Jan 2005 10:52:15 -0000
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O1 -fdump-tree-dse1-details" } */
+/* { dg-options "-O1 -fdump-tree-dse-details" } */
 foo(int *z, int *y, int xx)
@@ -14,5 +14,5 @@ foo(int *z, int *y, int xx)
 /* We should convert two COND_EXPRs into straightline code.  */
-/* { dg-final { scan-tree-dump-times "Deleted dead store" 2 "dse1"} } */
+/* { dg-final { scan-tree-dump-times "Deleted dead store" 2 "dse"} } */

The single pass catches 56 dead stores.  Remember that the unpatched
compiler catches 59 in two passes.  The patched compiler still passes
gcc.dg/tree-ssa/20040216-1.c, the only DSE test case in the test suite.   
The patched compiler produces different asm files for 4 out of 517 .i
files.  Comparing the asm output of the patched and unpatched compiler
shows that there are 5 stores in the asm for the patchedcompiler that
are not in the unpatched compiler.  In one case (calls.i) the stack
frame is 8 bytes smaller with the unpatched compiler.  The effect on
compile time is a ~0.3% win (average over 5 runs for each compiler)
for the compiler with only a single DSE pass.

With DSE completely disabled there are ~20 stores in 12 files in the
asm output that are removed with two DSE patches.  Counting was more
difficult in this case, but this count does show that for the 59 dead
stores we catch now, roughly half of those would also be caught by the
RTL dead store elimination.  The compiler with DSE disabled is ~0.5%

I have also tried a single DSE pass with the patch from my first mail
applied[1].  In this case the single DSE pass catches 98 dead stores
in 15 files, which is more than two DSE passes catch with the unpatched
compiler.  In the assembler output there are 17 fewer stores compared
to the asm output from the unpatched compiler.  Two DSE passes with the
patch applied removed 101 dead stores (we probably fail to eliminate
the same 3 dead stores :-).  I could not measure any effect on compile
time compared to the compiler with one DSE pass and and tree-ssa-dse.c



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