Resend: reorder conditionals in i386.md

Zack Weinberg zackw@panix.com
Tue Aug 7 12:39:00 GMT 2001


On Tue, Aug 07, 2001 at 01:45:41PM -0500, Robert Lipe wrote:
> Zack said:
> 
> > rearranges a lot of guard expressions in i386.md such that constant
> > sub- expressions such as "TARGET_64BIT" appear first.  When the
> > subexpression is compile-time false, the optimizer can then discard
> > the entire expression
> 
> Isn't that pandering to a weak optimizer?   
> 
> If we really can do something different with
> 	if (0 && TARGET_80386)
> than we can with
> 	if (TARGET_80386 && 0)
> (where the '0' comes from cpp in specific cases and isn't, of course, 
> quite so obvious as I'm making it sound) haven't we left an optimization 
> on the table?

The interesting cases are more of the form

	if (expensive_test (operands[0]) && 0)

where the compiler cannot eliminate the call to expensive_test because
it might have side effects.  We know better.

> Interestingly, if the '0' is a const int expression, we don't appear to
> know that these are as unreachable as if they're a zero right in the
> expression...

that _does_ sound like a deficiency in the optimizer (and belies what
was being said elsewhere about constants being preferable to macros).

zw



More information about the Gcc-patches mailing list