Hi,

On Mon, 8 Oct 2018, Paul Koning wrote:

> > So all you'd actually have to say is
> > 
> > void f1(void)
> > {
> >    *i; *j;
> >    __builtin_memcpy (i, j, 32);
> > }
> 
> No, that doesn't help.  Not even if I make it:
> 
> void f1(void)
> {
>     k = *i + *j;
>     __builtin_memcpy (i, j, 4);
> }
> 
> The first line does word aligned references to *i and *j, but the memcpy 
> stubbornly remains a byte move.

k is a global, so the loads from i/j can't be optimized away?  If so, now 
you have a missed optimization bug ;-)  Might be non-trivial to fix for 
general situations (basically the natural alignment can only be inferred 
in regions that are dominated by such accesses, but not e.g. for:
   if (cond()) k = *i+*j;
   memcpy(i,j,4);
as cond() might be always false).


Ciao,
Michael.

Reply via email to