https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127471
Bug ID: 127471
Summary: vectorizer scalar loop costing misses non-root pattern
covered stmts
Product: gcc
Version: 17.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: ---
vect_compute_single_scalar_iteration_cost does
/* Skip stmts that are not vectorized inside the loop. */
stmt_vec_info vstmt_info = vect_stmt_to_vectorize (stmt_info);
if (!STMT_VINFO_RELEVANT_P (vstmt_info)
but if there's a sequence of stmts matched to a pattern stmt, like for
widening multiplication or highpart multiplication, only the root scalar
stmt is costed, not the other stmts part of the detected pattern stmt.
This under-estimates scalar cost.
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53947
[Bug 53947] [meta-bug] vectorizer missed-optimizations