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]
Other format: [Raw text]

Re: PR rtl-optimization/15248 -- semi-latent reload bug


> Bernd Schmidt writes:
>> Jeffrey A Law wrote:
>> On Thu, 2005-04-21 at 20:52 +0200, Bernd Schmidt wrote:
>>
>>> Yes, that is exactly the thing that I'm not getting here. If the pseudo
>>> is equivalent to readonly memory, why is it ever written to?
>>
>> Because in the initial insn stream the pseudo had to be initialized.
>> It's the replacement of the pseudo with its equivalent memory location
>> in the initializing insn that causes the fault.
>> 
>> Normally the initialization insns are removed.  However, that's not the
>> case if the RHS of the equivalencing insn is not the equivalent
>> memory location (in this case the RHS of the equivalencing insn is
>> another pseudo which we know happens to hold the proper value).
>
> Ok. Still, we should be able to delete the initializing insn in this case
> if it has no other side effects, correct?
>
> If I understood everything correctly, the problem could be fixed by
>  - detecting equivalences made by reading from memory, either directly
>    or through an intermediate pseudo, but not by writing to memory
>  - deleting all insns that only store into a pseudo that has such an
>    equivalence
>  - making ignored output reloads for all other cases where such a
>    pseudo is stored
> 
> Would you agree that this would fix it?

Out of curiosity, why isn't it sufficient to possibly more simply:

- ignore all pseudo spills which are noted as being equivalent to a
  MEM_READONLY_P memory reference.

- load/reload a corresponding pseudo only if bound to a hard register
  from the MEM_READONLY_P memory equivalent reference directly.

- otherwise all corresponding pseudo references are logically substituted
  with it's equivalent MEM_READONLY_P memory reference when referenced.

(in effect MEM_READONLY_P equivalent pseudo's are never physically spilled,
 and only "loaded/reloaded" if previously bound to a hard register)



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