[Bug rtl-optimization/92925] New: RTl expansion throws away alignment info

hubicka at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Dec 12 23:52:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92925

            Bug ID: 92925
           Summary: RTl expansion throws away alignment info
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hubicka at gcc dot gnu.org
  Target Milestone: ---

Hi,
this testcase originally started as attempt to produce self contained
reproducer for ipa-cp bug.  Problem is that RTL expansion is too limited and
refuses to produce aligned moves for me.  
struct a {long a1; long a2;};
struct b {long b; struct a a[10];};
struct c {long c; struct b b;__int128 e;};
int l;
__attribute__ ((noinline))
static void
set(struct b *bptr)
{
  for (int i=0;i<l;i+=2)
    bptr->a[i]=(struct a){};
}
test ()
{
  struct c c;
  set (&c.b);
}

Here ipa-cp propagates that BPTR is always aligned to 16 with misaligment 8.
This should let expansion to use movaps for the "bptr->a[i]=(struct a){};"
constructions but it does not.

set:
.LFB0:
        .cfi_startproc
        movl    l(%rip), %ecx
        testl   %ecx, %ecx
        jle     .L1
        xorl    %eax, %eax
        .p2align 4,,10
        .p2align 3
.L3:
        movslq  %eax, %rdx
        pxor    %xmm0, %xmm0
        addl    $2, %eax
        salq    $4, %rdx
        movups  %xmm0, 8(%rdi,%rdx)
        cmpl    %ecx, %eax
        jl      .L3
.L1:

Overall the loop codegen is quite bad.


More information about the Gcc-bugs mailing list