This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] New regressions as of 2003-11-04
- From: law at redhat dot com
- To: Richard Henderson <rth at redhat dot com>
- Cc: Andrew MacLeod <amacleod at redhat dot com>, Diego Novillo <dnovillo at redhat dot com>, Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>, Daniel Berlin <dberlin at dberlin dot org>, Jan Hubicka <jh at suse dot cz>, gcc mailing list <gcc at gcc dot gnu dot org>
- Date: Tue, 04 Nov 2003 20:20:23 -0700
- Subject: Re: [tree-ssa] New regressions as of 2003-11-04
- Reply-to: law at redhat dot com
In message <20031105002700.GA25210@redhat.com>, Richard Henderson writes:
>On Tue, Nov 04, 2003 at 05:08:09PM -0700, law@redhat.com wrote:
>> Another dom pass isn't going to improve this kind of code.
>
>I mostly meant using domwalk and a custom widget to detect
>what you want.
>
>> Either the
>> useless statement remover needs to be updated, or we need something to
>> eliminate the PHI, or the out-of-ssa pass needs to get a lot smarter.
>
>The best solution, of course, is to change
>
> # bb 1
> if (x.1 == -1) goto L2; else goto L3;
> ...
> # bb 4
> L4:
> x.4 = PHI< -1(2), 0(3) >;
>
>to
>
> x.4 = PHI< x.1(1), 0(3) >;
>
>Though likely after ccp, since we want the chance to prove constants
>first.
You don't want to do that unconditionally. Otherwise you will end up
with unnecessary reg-reg copies, particularly in cases where the
result of the phi has a different base variable than the argument where
you un-propagated the constant.
The more I think about this, the more I'm becoming convinced that this
either has to be solved in out of ssa or in the useless statement
eliminator.
Why?
The fundamental issue at hand is out of ssa creates a useless statement
in the case where one of the arguments to a PHI node is a constant with
the same value used in an equality test in the controlling COND_EXPR.
We can't (in general) zap that before the out of ssa pass. Yes, for
this specific case we can twiddle things and replace the PHI node with
something like
x.4 = (x.1 != -1) - 1;
Which makes the problem go away in this specific instance. But I strongly
suspect there are going to be several cases which are not so easily
converted.
Jeff