This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix SCCVN to optimistically value-number PHIs with backedges
- From: Richard Biener <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 10 Jun 2015 16:31:32 +0200 (CEST)
- Subject: Re: [PATCH] Fix SCCVN to optimistically value-number PHIs with backedges
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot LSU dot 2 dot 11 dot 1506101606160 dot 30088 at zhemvz dot fhfr dot qr>
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.