This is the mail archive of the gcc@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: [tree-ssa] New regressions as of 2003-11-04


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







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