[PATCH] Fix PR middle-end/28690, indexed load/store performance + reload bug

Peter Bergner bergner@vnet.ibm.com
Tue Dec 12 23:29:00 GMT 2006


On Tue, 2006-12-05 at 14:26 +0100, Paolo Bonzini wrote:
> > -	*addr = gen_rtx_PLUS (Pmode, *addr, base);
> > +	{
> > +	  /* For performance reasons on some processors, prefer
> > +	     the pointer being the first operand of the PLUS.  */
> > +	  if (REG_P (*addr) && !REG_POINTER (*addr)
> > +	      && REG_P (base) && REG_POINTER (base))
> > +	    *addr = gen_rtx_PLUS (Pmode, base, *addr);
> > +	  else
> > +	    *addr = gen_rtx_PLUS (Pmode, *addr, base);
> 
> In theory, given the change you made to rtlanal.c, this should be done with
> 
>    *addr = simplify_gen_binary (PLUS, Pmode, base, *addr);
> 
> If this does not work, it is probably because the
> swap_commutative_operands_p change does not affect other users of
> commutative_operand_precedence.

Ok, now that we have the latent reload bug fixed, I'm looking at the
three users of commutative_operand_precedence().  They are:

  swap_commutative_operands_p()
  swap_commutative_operands_with_target()
  simplify_plus_minus_op_data_cmp()

Looking at them, it seems like we _might_ be able to just marge all
of them into one routine.  However, I have a question regarding your
change to simplify_plus_minus_op_data_cmp() on 2006-09-05.  Specifically
the change that breaks ties for REGs by comparing their regnos.  Do you
remember why you made that change (checked in as part of PR26847)?

Peter





More information about the Gcc-patches mailing list