From: Richard Biener Date: Wed, 27 Aug 2025 12:39:00 +0000 (+0200) Subject: The divmod pattern will break reduction constraints X-Git-Tag: basepoints/gcc-17~5377 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=674b1d73e437cbdbe86da45dbb67364297bb2216;p=thirdparty%2Fgcc.git The divmod pattern will break reduction constraints When we apply a divmod pattern this will break reductions by introducing multiple uses of the reduction var, so avoid this pattern in reductions. * tree-vect-patterns.cc (vect_recog_divmod_pattern): Avoid for stmts participating in a reduction. --- diff --git a/gcc/tree-vect-patterns.cc b/gcc/tree-vect-patterns.cc index ffb320fbf23..3fffcac4b3a 100644 --- a/gcc/tree-vect-patterns.cc +++ b/gcc/tree-vect-patterns.cc @@ -4818,7 +4818,9 @@ vect_recog_divmod_pattern (vec_info *vinfo, tree q, cst; int prec; - if (!is_gimple_assign (last_stmt)) + if (!is_gimple_assign (last_stmt) + /* The pattern will disrupt the reduction chain with multiple uses. */ + || vect_is_reduction (stmt_vinfo)) return NULL; rhs_code = gimple_assign_rhs_code (last_stmt);