This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Bug in reload_cse_move2add()


On Jan 16, 2001, Richard Earnshaw <rearnsha@arm.com> wrote:

> The problem is that when we derive an increment from another expression we 
> copy the base_reg information, but then keep only the offset if the other 
> base_reg is not itself derived from another value.  This makes the 
> derivation appear to be for a constant.

I see.  Your change looks right, but I'd rather make it indeed look
like a constant, which it indeed is.

      /* If our base register is based on some other register, compute
	 the sum of the offsets (even if the base register was a
	 constant, in which case we're going to be a constant too).
	 Otherwise, use the offset of the current insn only. */
      if (reg_offset[base_regno]
	  && GET_CODE (reg_offset[base_regno]) == CONST_INT)
	reg_offset[regno]
	  = plus_constant (offset, INTVAL (reg_offset[base_regno]));
      else
	reg_offset[regno] = offset;
 
Note that the problem of not tracking a back jump doesn't affect us
here; if there is a back jump, there must be a label, and if there is
a label between the initial constant assignment and the copy plus
offset, we'll ``forget'' it was constant because it crosses a label.

If the constant and the copy are within the same basic block, we're
fine.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]