https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100089
--- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> ---
So this fixes it for -fvect-cost-model=very-cheap. One could argue that we
should enable the code for all cost models, fixing the -O3 regression (and
backportable to the branch).
I'll see to experiment with "fancy" costing of the stray vectorizations. I'll
also note that the scanning for load/store (and other ifns not supported)
could be handled in the costing as well (but the costing would need to run
also for -fno-vect-cost-model then, just the result ignored if not forced).
I'm talking about
bool require_loop_vectorize = false;
for (gimple_stmt_iterator gsi = gsi_start_bb (bb);
!gsi_end_p (gsi); gsi_next (&gsi))
{
gimple *stmt = gsi_stmt (gsi);
gcall *call = dyn_cast <gcall *> (stmt);
if (call && gimple_call_internal_p (call))
{
internal_fn ifn = gimple_call_internal_fn (call);
if (ifn == IFN_MASK_LOAD || ifn == IFN_MASK_STORE
/* Don't keep the if-converted parts when the ifn with
specifc type is not supported by the backend. */
|| (direct_internal_fn_p (ifn)
&& !direct_internal_fn_supported_p
(call, OPTIMIZE_FOR_SPEED)))
{
require_loop_vectorize = true;
break;
}
}