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] Fix SCCVN to optimistically value-number PHIs with backedges


On Wed, 10 Jun 2015, Richard Biener wrote:

> 
> The following patch fixes a preference that causes SCCVN to fail to
> eliminate redundant IVs.  It will prefer to try eliminating IVs to
> eliminating degenerate PHIs (if the degenerate PHI has a backedge).
> I failed to create a testcase for that - the one below is essentially
> what the vectorizer can end up generating (bah).  I believe it
> will still work out in the end, just FRE itself won't remove the
> PHI node in a single pass iteration but just value-number to
> a degenerate PHI (a testcase would still be nice - I'm still trying).

Just to explain, I'm thinking of the case where optimistically
value-numbering to the first arg is required to make SCCVN
realize the 2nd arg is the same.  Like

int foo (int a, int s, unsigned int k)
{
  int i = a, j = a;
  do
    {
      i += s;
      j += j;
      j -= a;
    }
  while (k--);
  return j+i;
}

(heh, depends on the order of i and j declarations!)

In the above case SCCVN doesn't do anything after the patch
but before we eliminate j in the return statement to a.

I wonder what the theory(TM) says about the two cases
(that is, how to catch both).

Richard.


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