A bit off-topic but could you add [PATCH] (or [PATCH v2]) to your subjects?
That's convention and makes it easier for my mail client to recognize :)
> + if (this_overhead != other_overhead)
> + {
> + if (dump_enabled_p ())
> + dump_printf_loc (MSG_NOTE, vect_location,
> + "Preferring %s loop because it has lower"
> + " main-loop overhead ("
Let's also change this to just "loop overhead".
> + HOST_WIDE_INT_PRINT_UNSIGNED " vs. "
> + HOST_WIDE_INT_PRINT_UNSIGNED ")\n",
> + GET_MODE_NAME ((this_overhead < other_overhead
> + ? this_loop_vinfo
> + : other_loop_vinfo)->vector_mode),
> + this_overhead, other_overhead);
> + return this_overhead < other_overhead ? -1 : 1;
> + }
> +
> + return 0;
> +}
> +
> bool
> costs::better_main_loop_than_p (const vector_costs *uncast_other) const
> {
> @@ -1213,7 +1281,23 @@ costs::better_main_loop_than_p (const vector_costs
> *uncast_other) const
> && m_cost_type == VLS_VECTOR_COST)
> return false;
>
> - return vector_costs::better_main_loop_than_p (other);
> + if (!LOOP_VINFO_NITERS_KNOWN_P (this_loop_vinfo)
> + || !LOOP_VINFO_NITERS_KNOWN_P (other_loop_vinfo))
> + return vector_costs::better_main_loop_than_p (other);
> +
Please add a comment here still that for a known iteration count we can do
better than better_main_loop_than_p by factoring in the loop overhead which
is important when comparing different LMULs. Maybe also reference your newly
opened PR regarding outside cost.
> + int diff = compare_inside_loop_cost (other);
> + if (diff != 0)
> + return diff < 0;
> +
> + diff = compare_loop_overhead (this_loop_vinfo, other_loop_vinfo);
> + if (diff != 0)
> + return diff < 0;
> +
> + diff = compare_outside_loop_cost (other);
> + if (diff != 0)
> + return diff < 0;
> +
> + return false;
> }
>
> /* Returns the group size i.e. the number of vectors to be loaded by a
OK with these changed, no need to re-spin, thanks.
--
Regards
Robin