http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43814

--- Comment #12 from rguenther at suse dot de <rguenther at suse dot de> 
2010-12-04 21:12:35 UTC ---
On Sat, 4 Dec 2010, mkuvyrkov at gcc dot gnu.org wrote:

> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43814
> 
> --- Comment #11 from Maxim Kuvyrkov <mkuvyrkov at gcc dot gnu.org> 2010-12-04 
> 19:04:29 UTC ---
> I looked into CCP a bit and it seems like no alignment analysis whatsoever is
> done for either &tmp nor &src[0] in
> ==
> __builtin_memcpy (&tmp, &src[0], 8);
> ==
> 
> That is because
> 1. ccp_initialize() sees __builtin_memcpy,
> 2. infers that its return value varies,
> 3. exits without processing the arguments.
> 
> If the code was structured like so
> ==
> D1 = &tmp;
> D2 = &src[0];
> __builtin_memcpy (D1, D2, 8);
> ==
> CCP would have a better chance inferring alignment for D1 and D2.
> 
> I'm mostly walking in the dark trying improve CCP, so any pointers would be
> appreciated.

&tmp and &src[0] are irrelevant for CCP.  get_{pointer,object}_alignment
does a proper job on them already.

You can only improve CCP by handling SSA name default defs according
to their type (thus, give them initial alignment).  But that's
dangerous in my opinion.

If CCP wants to seed alignment from dereferences like

 d.134_2 = *p_4;

then it needs to insert stuff like assert-exprs like VRP does
to have SSA name defs at the point of the dereference.  Of course
it also needs to retain the so introduced copies.

But I haven't wrapped my brain about this enough to say if this
approach would make sense or would be beneficial.

Reply via email to