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, pretty-ipa] Make intra-SRA propagate subaccesses accros assignments


2009/4/9 Martin Jambor <mjambor@suse.cz>:
> Hi,
>
> the new ?SRA in ?pretty-ipa, as ?it is now, ?only scalarizes ?parts of
> aggregates that are actually accessed in a function (hence the name of
> access which is also the ?fundamental internal structure of the pass).
> However, ?that means that ?when transforming ?the following ?code, the
> value of one scalarized component is not transformed into the other.
>
> ?A.x = val;
> ?B = A;
> ?C = B;
> ?D = C;
> ?sth = C.x;
>
> The ?patch ?below ?attempts ?to ?add artificial ?sub-accesses ?to ?the
> accesses on the ?left hand side so that they match ?those on the right
> hand side. ? In the example above ?(given that all ?A, B, C and ?D are
> reducible), there would be replacements A$x, B$x, C$x and D$x.

Just to try to understand without looking into the patch.  So the above
means that the internal access tracking of SRA will see the above as

 A.x = val;
 B.x = A.x;
 C.x = B.x;
 D.x = C.x;
 sth = C.x;

?  But for the scalarization itself only A.x = val and sth = C.x will be
considered?  Does this work for

 A.x.y = val;
 B.x = A.x;
 C = B;
 sth = C.x.y;

as well?  I suppose so.

IMHO this looks reasonable and will do struct copy-propagation.  Nice.
Note that the old SRA would have produced complete scalarized
struct copies for all elements which often created a complete mess
(also due to doing that "clevery" with bitfield members ...)

Richard.


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