This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH, pretty-ipa] Make intra-SRA propagate subaccesses accros assignments
- From: Richard Guenther <richard dot guenther at gmail dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>, Jan Hubicka <hubicka at ucw dot cz>, Richard Guenther <rguenther at suse dot de>
- Date: Thu, 9 Apr 2009 13:36:08 +0200
- Subject: Re: [PATCH, pretty-ipa] Make intra-SRA propagate subaccesses accros assignments
- References: <20090409113129.GA7584@alvy.suse.cz>
2009/4/9 Martin Jambor <firstname.lastname@example.org>:
> 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 ...)