[PATCH] Don't lower MIN_EXPR and MAX_EXPR [was Re: GCC Benchmarks (coybench), AMD64 and i686, 14 August 2004]

Roger Sayle roger@eyesopen.com
Thu Aug 19 14:07:00 GMT 2004

On Thu, 19 Aug 2004, Paolo Bonzini wrote:
> > IIRC the benefit of lowering is that it may allow you to propagate
> > the condition and the assignment if you lower the {MIN,MAX}_EXPR.
> > Have you looked at how your patch affects DOM and GVN-PRE?
> In other words, the two benefits of (theoretically) propagating the
> condition and sharing the result of the {MIN,MAX}_EXPR unfortunately
> seem to be mutually exclusive.
> Do you think it would be better to synthesize these codes in phiopt, and
> (dually) lower ABS_EXPR during gimplification, except for complex types?

I've no problem with the lowering or not of MIN_EXPR, MAX_EXPR and
ABS_EXPR, but it seems to me that the more fundamental problem is
that we're failing to CSE the phi nodes themselves.

For example, it would be nice to optimize

	x = a ? b : c;
	y = a ? b : c;

into the equivalent

	x = a ? b : c;
	y = x;

This would fix "mole", and handle a more generic class of problems.
It might also be goos to spot the "y = !a ? c : b" case as well.
Alas I'm not a tree-ssa expert but the above transformations would
appear doable with GCC's current infrastructure.

Currently, mainline generates two conditional jumps for this code.


More information about the Gcc-patches mailing list