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

Richard Sandiford <rsandifo at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |juzhe.zhong at rivai dot ai,
                   |                            |law at gcc dot gnu.org,
                   |                            |pan2.li at intel dot com
             Target|                            |riscv64*-*-*
            Summary|SLP permutation for VLA     |RISC-V: SLP permutation for
                   |vectors broken              |VLA vectors broken
          Component|tree-optimization           |target

--- Comment #6 from Richard Sandiford <rsandifo at gcc dot gnu.org> ---
Ah!  I think I see the problem, and RTL checking confirms:

foo.c:10:23: internal compiler error: RTL check: expected code 'const_int',
have 'const_poly_int' in expand_const_vector, at config/riscv/riscv-v.cc:1365
   10 |           dest[i * 4] = value;
      |           ~~~~~~~~~~~~^~~~~~~

riscv-v.cc:expand_const_vector assumes that the elements of a stepped
variable-length CONST_VECTOR are simple integer constants, but they can be
poly_ints (wheels in wheels!).  E.g.:

              /* Step 4: Multiply to step size n.  */
              HOST_WIDE_INT step_size =
                INTVAL (builder.elt (builder.npatterns ()))
                - INTVAL (builder.elt (0));

this step size is actually a poly_int64 in general.  Similarly here:

              /* Step 5: Add starting value to all elements.  */
              HOST_WIDE_INT init_val = INTVAL (builder.elt (0));

So I think this is a target issue.  I haven't checked whether there are other
PRs for this already.

ALthough this particular instance depends on your patch, I imagine there are
other instances that fail in a similar way without it (and perhaps wouldn't
have failed before GCC 15, due to the new SLP permute support).

Reply via email to