[PATCH] New if-combining pass, addresses PRs 15353 and 31657

Richard Guenther rguenther@suse.de
Thu Apr 26 10:53:00 GMT 2007


On Wed, 25 Apr 2007, Andrew Pinski wrote:

> On 4/25/07, Richard Guenther <rguenther@suse.de> wrote:
> 
> > +       /* returning 1 causes phiopt to trigger in */
> If this is true, then this pass should run before phiopt so you can
> catch more stuff.

Well, I thought it is not profitable to do the transformation if phiopt
can remove the same amount of control flow.  Basically replacing

  x = (a >> b)
  if (x & 1)
    y = (a >> c)
    if (y & 1)
      return 1;
    else
      return 0;

with

  tmp = (1 << b) | (1 << c)
  if (a & tmp == tmp)
    return 1;
  else
    return 0;

instead of

  x = (a >> b)
  if (x & 1)  
    y = (a >> c)
    return y & 1;


Richard.



More information about the Gcc-patches mailing list