Bug 108785 - nested cycle vectorization too restrictive
Summary: nested cycle vectorization too restrictive
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 13.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: missed-optimization
Depends on:
Blocks: vectorizer
  Show dependency treegraph
 
Reported: 2023-02-14 10:10 UTC by Richard Biener
Modified: 2023-02-14 10:10 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Biener 2023-02-14 10:10:05 UTC
For the testcase in PR108782 we're rejecting to vectorize the nested cycle
because

      if (!flow_bb_inside_loop_p (loop, gimple_bb (use_stmt)))
        {
          if (dump_enabled_p ())
            dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
                             "intermediate value used outside loop.\n");

          return NULL;
        }

but really all inner PHIs should be trivially vectorizable without
further restrictions.  The only thing we need to do is detect double
reductions, that is, when there's an outer reduction feeding the inner
loop PHI.