This is the mail archive of the 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]
Other format: [Raw text]

Re: [PATCH]: PR 11271 Handle reloading of R+R+CONST for any reg

Richard Earnshaw wrote:

>*************** find_reloads_address (enum machine_mode
>*** 4884,4890 ****
>  	   && GET_CODE (XEXP (ad, 0)) == PLUS
>  	   && GET_CODE (XEXP (XEXP (ad, 0), 0)) == REG
>  	   && REGNO (XEXP (XEXP (ad, 0), 0)) < FIRST_PSEUDO_REGISTER
>- 	   && REG_MODE_OK_FOR_BASE_P (XEXP (XEXP (ad, 0), 0), mode)
>  	   && ! maybe_memory_address_p (mode, ad, &XEXP (XEXP (ad, 0), 1)))
>      {
>        *loc = ad = gen_rtx_PLUS (GET_MODE (ad),

This causes a bootstrap failure on s390.

If we have an address like

  (plus:SI (plus:SI (reg:SI 0) (reg:SI 1)) (const_int 16))

which is invalid since reg 0 is not a valid base register on s390,
the right thing to do would be to just reload reg 0 into another
register -- this is what used to happen before this patch.

With this patch, however, reload now tries to load

    (plus:SI (reg:SI 0) (const_int 16))

into a base register and add that to (reg:SI 1),
however this fails as well because reg 0 is not a valid
base register and hence cannot be used in a load-address
type pattern.

As I understand it, this was exactly what that REG_OK_FOR_BASE
check was supposed to ensure: that the sum that is generated
here is certain to be computable via a load-address pattern ...

I do not understand the reason for removing that check in order
to fix a bug: this whole if is just an optimization, so even
with the if completely disabled everything should work.


  Dr. Ulrich Weigand

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