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

Re: A reload inheritance bug


Mark Shinwell wrote:
> As you say, one unusual thing about this situation must be the fact
> that the reload register is getting chosen by the code in
> push_reload heralded by "If this is an input reload and the operand
> contains a register that dies in this insn and is used nowhere else,
> see if it is the right class to be used for this reload.  Use it if so."

Not that unusual - this happens all the time.

> etc.  I suspect it is the conjunction of this code and the behaviour of
> reload in choosing r9 for pseudo 4082 in insn 5314 above that causes the
> problem.
> 
> I don't entirely follow your example below...
> 
>> Still, assume a similar sequence
>>
>> insn 5301: (set (reg/f:SI 4082) (reg/f:SI 3275))
>>
>> insn 5291 (set (reg:DF 4078])
>>                (unspec:DF (mem/s:DF (plus:SI (reg/f:SI 3275)
>>                                              (reg:SI 3812)))
>>                           (reg:SI 3275)))
>>   REG_DEAD 3275
>>
>> <some other insn where R9 is used for an input reload>
>>
>> insn 5314 (set (reg:DF 4096)
>>           (mem/s:DF (plus:SI (reg/f:SI 4082) (reg:SI 4084))))
>>
>> Here, we wouldn't use R9 as reload register in 5291
> 
> ...since here, as far as I understand it, the clause mentioned above
> in push_reload wouldn't select r9 to use as a reload register for
> 5291.

That, and the subsequent code won't use a reg that's also used in the
insn.  However, ...

>  My gut feeling is that this example will work as a consequence.

... note that I inserted <some other insn> which could conceivably use
R9 as an input reload, as the hard reg is dead.  Where would we
invalidate previous information about R9?  I assume it would be the loop
at the end of emit_reload_insns, specifically

              /* First, clear out memory of what used to be in this
spill reg.
                 If consecutive registers are used, clear them all.  */

              for (k = 0; k < nr; k++)
                {
                CLEAR_HARD_REG_BIT (reg_reloaded_valid, i + k);
                  CLEAR_HARD_REG_BIT (reg_reloaded_call_part_clobbered,
i + k);

Why isn't this triggering?

> (Perhaps you're getting at the fact that the decision procedure leading
> us to choose r9 for pseudo 4082 in insn 5314 might be at fault instead?

No, that seems fine.


Bernd
-- 
This footer brought to you by insane German lawmakers.
Analog Devices GmbH      Wilhelm-Wagenfeld-Str. 6      80807 Muenchen
Sitz der Gesellschaft Muenchen, Registergericht Muenchen HRB 40368
Geschaeftsfuehrer Thomas Wessel, William A. Martin, Margaret Seif


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