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

            Bug ID: 118297
           Summary: vect_analyze_loop_form gets confused by outer loop
                    that only executes its body once
           Product: gcc
           Version: 15.0
               URL: https://godbolt.org/z/a5nKv3xnx
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tiborgyri at gmail dot com
                CC: tiborgyri at gmail dot com
  Target Milestone: ---

See: https://godbolt.org/z/a5nKv3xnx
The outer loop of the loop nest trivially only runs its body exactly once, yet
something prints "not vectorized: unsupported outerloop form."

I have looked at the tree vectorizer source file and the only place I could
find this message was in vect_analyze_loop_form (line 1824):

      entryedge = loop_preheader_edge (innerloop);
      if (entryedge->src != loop->header
          || !single_exit (innerloop)
          || single_exit (innerloop)->dest != EDGE_PRED (loop->latch, 0)->src)
        return opt_result::failure_at (vect_location,
                                       "not vectorized:"
                                       " unsupported outerloop form.\n");

I am not sure which of these conditions ends up being true, but to me it sounds
a bit silly when GCC says this trivial outer loop is unsupported by the
vectorizer.

Reply via email to