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

            Bug ID: 117195
           Summary: Invalid IR after vectorization
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kristerw at gcc dot gnu.org
  Target Milestone: ---

The vectorizer creates IR that I believe is invalid for the function:

```
void
zz (int x9, short int gt)
{
  if (0)
    {
      while (gt < 1)
        {
          int pz;

k6:
          for (pz = 0; pz < 3; ++pz)
            x9 += gt;
          ++gt;
        }
    }

  if (x9 != 0)
    goto k6;
```

when compiled for AArch64 as
  aarch64-elf-gcc -O3 -S bug.c

The issue here is that we get WIDEN_SUM_EXPR instructions where the arguments
are vectors with a different number of elements. You can find them right after
the k6 label:

```
k6:
  vect_patt_33.14_106 = vect_vec_iv_.10_76 w+ vect_x9_4.13_100;
  vect_patt_33.14_107 = vect_vec_iv_.11_84 w+ vect_x9_4.13_101;
  vect_patt_33.14_108 = vect_vec_iv_.12_92 w+ vect_x9_4.13_102;
```

where the variables are declared as:
  vector(4) int vect_patt_33.14;
  vector(8) short int vect_vec_iv_.12;
  vector(8) short int vect_vec_iv_.11;
  vector(8) short int vect_vec_iv_.10;
  vector(4) int vect_x9_4.13;

Reply via email to