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

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Here is a testcase which fails with -O3 -fno-tree-loop-ivcanon
-fno-tree-forwprop -mgeneral-regs-only -fno-tree-loop-distribute-patterns
-fno-vect-cost-model -mstrict-align -fno-tree-fre -fno-tree-loop-vectorize :


typedef decltype(sizeof(0)) size_t;
typedef unsigned short uint16_t;
typedef unsigned uint32_t;

void zero_two_uint16(uint16_t* ptr) {
  ptr[0] = 0;
  ptr[1] = 0;
}

#define vector __attribute__((vector_size(sizeof(uint16_t)*4)))
void f(uint16_t *a)
{
    vector uint16_t *b = (vector uint16_t *)a;
    *b = (vector uint16_t){};
}

void g(uint16_t *a)
{
    size_t t = (size_t)a;
    if ((t & 0x7)==0) {
        for(size_t i = 0;i < 2;i++)
      f((a + i*4));
    } else {
        for(size_t i = 0;i < 2;i++)
    zero_two_uint16((a + i*2));
    }
}

Which shows the cleanups don't make a difference and some other patch is
causing it but it was still working in GCC 10.

Reply via email to