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: [patch] Fix regression (Re: Fix PR tree-optimization/41857)


2009/11/17 Zdenek Dvorak <rakdver@kam.mff.cuni.cz>:
> Hi,
>
>> >> > Tested on s390-ibm-linux and spu-elf with no regressions.
>> >> > OK for mainline?
>> >>
>> >> Ugh. ?Well, good enough for now :(
>> >>
>> >> I think TMR is broken as it basically treats the base pointer
>> >> as "value" compared to everywhere else where pointers have
>> >> semantics attached (like target type, ref-all status, etc.).
>> >
>> > I think you paint TMRs too much evil. ?It's whole point is to be
>> > a lower-level representation of memory access, corresponding to
>> > the addressing modes available on the target. ?Thus, you should
>> > expect to lose some information in the lowering.
>>
>> But then why try so hard and preserve TMR_ORIGINAL at all?
>
> because alias analysis uses it. ?Of course, another option would be to throw it
> away completely and use some safe default. ?A better option would be to have a
> representation of alias analysis information that would be independent on the
> shape of the memory reference.

We do have that now ...

>> >> 4) a way to recover a base pointer from TMR_ORIGINAL.
>> >
>> > Why would you want to do that?
>>
>> Because of the way TMRs are translated to RTL MEM_REFs.
>
> Can you please explain in more details? ?TMR_ORIGINAL was only ment
> as a quick hack to allow the existing alias analysis cope with TMRs,
> I did not know it started to be used for anything else.

well, unfortunately with TMRs we use all kinds of pointers as
base objects that are not related (type-wise) to the access itself.
But we have flags on the _pointer_ that influence TBAA ...
(like TYPE_REF_CAN_ALIAS_ALL).  Also TBAA tries to
disambiguate based on the base object alias-set which is also
gone here.

The RTL alias-analysis now uses the "tree" oracle to be able to
benefit from PTA.  The communication with the "tree" oracle
is done with ao_refs which is basically a decomposed reference.
See ao_ref_from_mem in alias.c.  It should pretty much match
what we have in MEM_EXPRs if we'd not have the fancy
random stripping of handled components there.  In the end
I would have liked to generate ao_refs directly at expansion
time and replace the existing MEM_EXPR / MEM_OFFSET
and friends.  But that was too a big can of worms.

We can also consolidate some duplicate disambiguation done
by the "tree" oracle and the old RTL oracle.  In the end only
one should survive.

Btw, on the tree level even before eventually lowering memory
references we should transition TBAA related pointer type flags
to flags on the INDIRECT_REF at access sites.  That way
we should be able to finally treat pointers as special integer
types, get rid of most pointer type conversions and even handle
some must-alias TBAA violations gracefully for free.

Richard.


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