On 02/26/2016 01:03 PM, Segher Boessenkool wrote:
> On Thu, Feb 25, 2016 at 09:08:32PM -0800, Richard Henderson wrote:
>> +      /* Perform rematerialization if only all operands are registers and
>> +         all operations are PLUS.  */
>> +      for (i = 0; i < n_ops; i++)
>> +    if (ops[i].neg || !REG_P (ops[i].op))
>> +      return NULL_RTX;
>> +      goto gen_result;
>> +    }
> 
> If you check for fixed registers as well here, does that work for you?

Maybe.  It prevents canonicalization of reg+fp vs fp+reg, which could well
occur via arithmetic on locally allocated arrays.

I guess for the purposes of stage4 I'd be willing to do

  if (ops[i].neg
      || !REG_P (ops[i].op)
      || (REGNO (ops[i].op) < FIRST_PSEUDO_REGISTER
          && fixed_regs[REGNO (ops[i].op)]
          && !global_regs[REGNO (ops[i].op)]
          && ops[i].op != frame_pointer_rtx
          && ops[i].op != arg_pointer_rtx
          && ops[i].op != stack_pointer_rtx))

It's pretty ugly though, and I wouldn't want to keep this forever.

The rs6000 change really ought to be evaluated at some point.  Given its scope,
I see little difference to doing that now vs putting it off to gcc7.


r~

Reply via email to