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: [patch] Disable tree-ssa DSE for now


On Wednesday 19 January 2005 18:03, Jeffrey A Law wrote:
> On Wed, 2005-01-19 at 13:06 +0100, Steven Bosscher wrote:
> > I have also tried a single DSE pass with the patch from my first mail
> > applied[1].
>
> Note the primary reason I haven't gone forward with pushing the
> handling of V_MUST_DEF into tree-ssa-dse.c is because I didn't
> think we were in an appropriate phase for that kind of change.
> While Mark has recently relaxed the check-in requirements, I
> would still hesitate to use that as an opportunity to install
> this kind of an improvement.
>
> It's also the case that we can see a mixture of V_MAY_DEF and
> V_MUST_DEFs for the same virtual operand.  I'm pretty sure
> my code to add V_MUST_DEFs handling to tree-ssa-dse.c doesn't
> handle that properly

I am sure it does not.  My patch does, by duplicating basically the
whole body of that fix-statement function.


> > http://gcc.gnu.org/ml/gcc-patches/2005-01/msg01183/DSE_prune_num_immuses.
> >diff.gz
>
> Unfortunately, I don't see any rationale behind the change to prune the
> immediate uses.  It might make sense, then again, it might not.  A
> little verbage on why you think this is safe and advisable would be
> useful.

Note that the patch wasn't posted for review, I would do a few things
differently for that, like adding comments and not duplicating 30 lines
of code in one function ;-)

For the pruning of the immediate uses, consider this:

int
foo (int a, int b, int c)
{
  int *p;
  if (c)
    p = &a;
  else
    p = &b;

  *p = 3;
  *p = 4;
  return *p;
}


The .alias1 dump looks as follows:

foo (a, b, c)
{
  int * p;
  int D.1452;

<bb 0>:
  if (c_2 != 0) goto <L0>; else goto <L1>;

<L0>:;
  p_6 = &a;
  goto <bb 3> (<L2>);

<L1>:;
  p_5 = &b;

  # p_1 = PHI <p_6(1), p_5(2)>;
<L2>:;
  #   a_9 = V_MAY_DEF <a_7>;
  #   b_10 = V_MAY_DEF <b_8>;
  *p_1 = 3;
  #   a_11 = V_MAY_DEF <a_9>;
  #   b_12 = V_MAY_DEF <b_10>;
  *p_1 = 4;
  #   VUSE <a_11>;
  #   VUSE <b_12>;
  D.1452_3 = *p_1;
  return D.1452_3;

}

If you would run DSE on this representation, the store "*p_1 = 3;"
would not be killed because there are two immediate uses for it,
the two V_MAY_DEFs for the second store, "*p_1 = 4;"  So even though
that store is as dead as can be, DSE would not remove it.

With my patch, we see that the two immediate uses are just the same
statement, which allows us to remove the store. 

Gr.
Steven


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