https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108601
--- Comment #11 from rguenther at suse dot de <rguenther at suse dot de> --- On Wed, 1 Feb 2023, crazylht at gmail dot com wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108601 > > --- Comment #10 from Hongtao.liu <crazylht at gmail dot com> --- > (In reply to Hongtao.liu from comment #9) > > > ---- > > > > > > decode_options() { > > > int flag = 1; > > > for (; flag <= 1 << 21; flag <<= 1) > > > ; > > > } > > Normally when vf is not constant, it will be prevented by > vectorizable_nonlinear_inductions, but for this case, it failed going > into > > if (STMT_VINFO_RELEVANT_P (stmt_info)) > { > need_to_vectorize = true; > if (STMT_VINFO_DEF_TYPE (stmt_info) == vect_induction_def > && ! PURE_SLP_STMT (stmt_info)) > ok = vectorizable_induction (loop_vinfo, > stmt_info, NULL, NULL, > &cost_vec); > > since the iv is never used outside of the loop, and will be dce later, so > vectorizer doesn't bother checking if it's vectorizable. It's > true but hit gcc_assert in vect_peel_nonlinear_iv_init when vf is not > constant. One solution is ignoring the nonlinear iv peeling if it's > !STMT_VINFO_RELEVANT_P (stmt_info) just like the upper code, the other > solution is returning false earlier in the > vect_can_peel_nonlinear_iv_p when vf is not known. When the VF is not known we usually do not require an epilogue? If we don't require one we should avoid creating one.