[Bug tree-optimization/80928] New: SLP vectorization does not handle induction

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed May 31 13:48:00 GMT 2017


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

            Bug ID: 80928
           Summary: SLP vectorization does not handle induction
           Product: gcc
           Version: 7.1.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
            Blocks: 53947
  Target Milestone: ---

int a[1024];
void foo (int n)
{
  for (int i = 0; i < 1020; i += 5)
    {
      a[i] = i;
      a[i+1] = i;
      a[i+2] = i;
      a[i+3] = i;
      a[i+4] = i;
    }
}

is not vectorized.

t.c:4:3: note: === vect_analyze_slp ===
t.c:4:3: note: Build SLP for a[i_17] = i_17;
t.c:4:3: note: Build SLP for a[_1] = i_17;
t.c:4:3: note: Build SLP for a[_2] = i_17;
t.c:4:3: note: Build SLP for a[_3] = i_17;
t.c:4:3: note: Build SLP for a[_4] = i_17;
t.c:4:3: note: vect_is_simple_use: operand i_17
t.c:4:3: note: def_stmt: i_17 = PHI <i_13(4), 0(2)>
t.c:4:3: note: type of def: induction
t.c:4:3: note: Build SLP failed: illegal type of def i_17

that's because we do not handle inductions (neither during SLP discovery
nor later during code-gen).

      /* Check the types of the definitions.  */
      switch (dt)
        {
        case vect_constant_def:
        case vect_external_def:
        case vect_reduction_def:
          break;

        case vect_internal_def:
          oprnd_info->def_stmts.quick_push (def_stmt);
          break;

        default:
          /* FORNOW: Not supported.  */
          if (dump_enabled_p ())
            {
              dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
                               "Build SLP failed: illegal type of def ");
              dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, oprnd);
              dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
            }

          return -1;
        }


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53947
[Bug 53947] [meta-bug] vectorizer missed-optimizations


More information about the Gcc-bugs mailing list