Fix postreload-gcse treatment of call-clobbered registers

Ian Lance Taylor iant@google.com
Fri May 25 01:37:00 GMT 2007


Richard Sandiford <rsandifo@nildram.co.uk> writes:

> This is the patch that inspired the HARD_REG_SET constructs I just posted
> (and it depends on them).  postreload-gcse.c was only checking whether
> REGNO (x) is call-clobbered, but it should check whether the whole
> register is.

By the way, I think there is a similar case in local-alloc.c, though
it is an optimization issue rather than a correctness one:

		  /* Avoid making a call-saved register unnecessarily
                     clobbered.  */
		  hard_reg = get_hard_reg_initial_reg (cfun, r1);
		  if (hard_reg != NULL_RTX)
		    {
		      if (REG_P (hard_reg)
			  && REGNO (hard_reg) < FIRST_PSEUDO_REGISTER
			  && !call_used_regs[REGNO (hard_reg)])
			continue;
		    }

As far as I can tell r1 may occupy multiple registers, but this code
only checks the first one.

Ian



More information about the Gcc-patches mailing list