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]

[patch] Disable tree-ssa DSE for now


It was already known that tree dead store elimination (DSE) does not
do a very good job at its task.  There is, for example, PR18880 that
shows that a trivially dead store to a global variable is not killed:

char Bool_Glob;
void f(void)
  Bool_Glob = 0;
  Bool_Glob = 1;

In fact, DSE only works on V_MAY_DEFes, and only if a store only has
a single V_MAY_DEF operand.  Those are the only dead stores that it
can eliminate.

So how many stores does DSE actually eliminate?

In all cc1-i files for amd64 (571 preprocessed gcc source files from
gcc "3.5.0 20040726 (experimental)", ) it only eliminates 59 stores
in two DSE passes.  I have tried to teach DSE about V_MUST_DEF stores
(that patch is attached), and with the patch we eliminate 101 stores.

The total size of the object files for all cc1-i files is 7858399 for
.text, so 101 stores is really nothing, especially because far more
stores are later removed by RTL passes anyway.  Add to that the fact
that DSE computes post dominator information, which is expensive, and
the benefit of keeping tree-ssa DSE enabled for GCC 4.0 becomes even
more doubtful.

So I propose we disable tree DSE for GCC 4.0, like so:

	* tree-ssa-dse.c (gate_dse): Disable DSE unconditionally for now.

Index: tree-ssa-dse.c
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-dse.c,v
retrieving revision 2.15
diff -u -3 -p -r2.15 tree-ssa-dse.c
--- tree-ssa-dse.c	18 Jan 2005 11:36:26 -0000	2.15
+++ tree-ssa-dse.c	19 Jan 2005 01:23:24 -0000
@@ -447,7 +447,8 @@ tree_ssa_dse (void)
 static bool
 gate_dse (void)
-  return flag_tree_dse != 0;
+  /* Disabled because this pass does not work at the moment.  */
+  return (0 && flag_tree_dse != 0);
 struct tree_opt_pass pass_dse = {

We can get back to writing a better DSE pass based on GVN-PRE and/or
Dan's code sinking patches.  We should also have better alias analysis
for GCC 4.1 so that DSE can really do something useful.



Attachment: DSE_prune_num_immuses.diff.gz
Description: GNU Zip compressed data

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