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] Fix PR80222


> Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.
> 
> Richard.
> 
> 2017-03-28  Richard Biener  <rguenther@suse.de>
> 
> 	PR middle-end/80222
> 	* gimple-fold.c (gimple_fold_indirect_ref): Do not touch
> 	TYPE_REF_CAN_ALIAS_ALL references.
> 	* fold-const.c (fold_indirect_ref_1): Likewise.

You just backported it onto the 6 branch and the fold_indirect_ref_1 hunk 
alone introduced regressions in the C testsuite on the branch for strict-
alignment architectures, e.g. SPARC.  Reduced testcase:

typedef long long V
__attribute__ ((vector_size (2 * sizeof (long long)), may_alias));

typedef struct S { V b; } P __attribute__((aligned (1)));

__attribute__((noinline, noclone)) void
bar (P *p)
{
  p->b[1] = 5;
}

Before the patch at -O0:

bar:
        save    %sp, -96, %sp
        st      %i0, [%fp+68]
        ld      [%fp+68], %g1
        ldub    [%g1+12], %g2
        and     %g2, 0, %g2
        stb     %g2, [%g1+12]
        ldub    [%g1+13], %g2
        and     %g2, 0, %g2
        stb     %g2, [%g1+13]
        ldub    [%g1+14], %g2
        and     %g2, 0, %g2
        stb     %g2, [%g1+14]
        ldub    [%g1+15], %g2
        and     %g2, 0, %g2
        or      %g2, 5, %g2
        stb     %g2, [%g1+15]
        ldub    [%g1+8], %g2
        and     %g2, 0, %g2
        stb     %g2, [%g1+8]
        ldub    [%g1+9], %g2
        and     %g2, 0, %g2
        stb     %g2, [%g1+9]
        ldub    [%g1+10], %g2
        and     %g2, 0, %g2
        stb     %g2, [%g1+10]
        ldub    [%g1+11], %g2
        and     %g2, 0, %g2
        stb     %g2, [%g1+11]
        nop
        return  %i7+8
         nop


After the patch:

bar:
        save    %sp, -96, %sp
        st      %i0, [%fp+68]
        ld      [%fp+68], %g1
        add     %g1, 8, %g1
        mov     0, %g2
        mov     5, %g3
        std     %g2, [%g1]
        nop
        return  %i7+8
         nop

that is to say, the compiler now generates an unaligned store.

-- 
Eric Botcazou


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