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

--- Comment #25 from Richard Biener <rguenth at gcc dot gnu.org> ---
diff --git a/gcc/tree-vect-patterns.cc b/gcc/tree-vect-patterns.cc
index bea04992160..856b8bd222e 100644
--- a/gcc/tree-vect-patterns.cc
+++ b/gcc/tree-vect-patterns.cc
@@ -3050,13 +3050,13 @@ vect_synth_mult_by_constant (vec_info *vinfo, tree op,
tree val,
   /* Use MAX_COST here as we don't want to limit the sequence on rtx costs.
      The vectorizer's benefit analysis will decide whether it's beneficial
      to do this.  */
-  bool possible = choose_mult_variant (mode, hwval, &alg,
+  tree vectype = get_vectype_for_scalar_type (vinfo, multtype);
+
+  bool possible = choose_mult_variant (TYPE_MODE (vectype), hwval, &alg,
                                        &variant, MAX_COST);
   if (!possible)
     return NULL;

-  tree vectype = get_vectype_for_scalar_type (vinfo, multtype);
-
   if (!vectype
       || !target_supports_mult_synth_alg (&alg, variant,
                                           vectype, synth_shift_p))


improves compile-time from 29s to 12s for the testcase (-O0 compiled cc1 with
checking enabled ...), I didn't analyze what the actual difference in
the chosen multiplication sequence is of course.

Reply via email to