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

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
The following fails at -O2:

unsigned char a;
unsigned b;
int r[11];
static void __attribute__((noipa))
c(int e, unsigned s[][11][11])
{
  for (int u = -(e ? 2000424973 : 0) - 2294542319; u < 7; u += 4)
    for (int x = 0; x < 300000011; x += 4)
      for (int y = 0; y < (0 < s[u][4][1]) + 11; y += 3) {
        a = a ?: 1;
        b = r[2];
      }
}
long long ab;
int e = 1;
unsigned s[11][11][11];
int main()
{
  for (int t = 0; t < 11; ++t)
    r[t] = 308100;
  c(e,s);
  ab = b;
  if (ab != 308100)
    __builtin_abort ();
}

t.c:8:23: note:  ***** Choosing vector mode RVVM1QI
t.c:8:23: optimized: loop vectorized using variable length vectors
t.c:8:23: note:  OUTER LOOP VECTORIZED 

which is interesting.  There seems to be quite some confusion in the code
generation about the conditional reduction - and we end up with
using .VEC_EXTRACT ({ 1, ...}, _46) in the end rather than sth based
on the inner loop vect__*a_lsm.

Reply via email to