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

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
typedef unsigned v2si __attribute__((vector_size(8)));
typedef unsigned v4si __attribute__((vector_size(16)));

unsigned bar(unsigned);

v4si x;
v2si y;

void foo(unsigned *p, unsigned i, unsigned j, unsigned k)
{ 
  unsigned tem0 = p[0] ^ i;
  unsigned tem1 = p[1] ^ j;
  unsigned p2 = p[2];
  unsigned p3 = p[3];
  y = (v2si) { tem0, tem1 };
  k = bar (k); 
  unsigned tem2 = p2 ^ k;
  unsigned tem3 = p3 ^ k;
  x = (v4si) { tem0, tem1, tem2, tem3 };
}


shows that we fail to compute scheduling viability, resulting in the
following after CSEing the RHS of y to the lowpart of the RHS of x.

t.c: In function ‘foo’:
t.c:6:6: error: definition in block 2 follows the use
    6 | void foo(unsigned int *p, unsigned int i, unsigned int j, unsigned int
k)
      |      ^~~
for SSA_NAME: _24 in statement:
_3 = _24;


Similar for

unsigned bar(unsigned);
unsigned x[4];
unsigned y[2];
void foo(unsigned int *p, unsigned int i, unsigned int j, unsigned int k)
{
  unsigned int tem0 = p[0] ^ i;
  unsigned int tem1 = p[1] ^ j;
  unsigned p2 = p[2];
  unsigned p3 = p[3];
  y[0] = tem0;
  y[1] = tem1;
  k = bar (k);
  unsigned int tem2 = p2 ^ k;
  unsigned int tem3 = p3 ^ k;
  x[0] = tem0;
  x[1] = tem1;
  x[2] = tem2;
  x[3] = tem3;
}

Reply via email to