Hi Bohan,
Apologies for the delay.
> diff --git a/gcc/config/riscv/riscv-vector-costs.cc
> b/gcc/config/riscv/riscv-vector-costs.cc
> index dfb80bee679..73e73634503 100644
> --- a/gcc/config/riscv/riscv-vector-costs.cc
> +++ b/gcc/config/riscv/riscv-vector-costs.cc
> @@ -1261,14 +1261,6 @@ costs::better_main_loop_than_p (const vector_costs
> *uncast_other) const
> return false;
> }
> }
> - else
> - {
> - if (dump_enabled_p ())
> - dump_printf_loc (MSG_NOTE, vect_location,
> - "Keep current LMUL loop because"
> - " it is unknown NITERS\n");
> - return false;
> - }
As discussed, I think this is the right idea. So let's go ahead with
this. But I'd rather also have two checks
if (this->spills () && !other->spills ())
return false;
if (!this->spills () && other->spills ())
return true;
to make it clearer and symmetric.
Actually, we should also remove the vla_mode_p guard above but let's not
go there yet and rather do separate patches.
> }
> }
> /* If NITERS is unknown, we should not use VLS modes to vectorize
> @@ -1277,8 +1269,8 @@ costs::better_main_loop_than_p (const vector_costs
> *uncast_other) const
> and partial vectors (VLAmodes) on loop epilogue which is very
> inefficient. Instead, we should apply partial vectors (VLAmodes)
> on loop body without an epilogue on unknown NITERS loop. */
> - else if (!LOOP_VINFO_NITERS_KNOWN_P (this_loop_vinfo)
> - && m_cost_type == VLS_VECTOR_COST)
> + if (!LOOP_VINFO_NITERS_KNOWN_P (this_loop_vinfo)
> + && m_cost_type == VLS_VECTOR_COST)
> return false;
I think we could remove that hunk altogether as VLS can handle
!niters_known.
I would expect some more testsuite fallout with the requested changes
but hopefully still bearable.
Once this patch is in (and my changes afterwards), we can continue with
the Ovlt specialization if needed. But I'd still like to understand
what exactly is slower with your local experiment.
--
Regards
Robin