https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113441
--- Comment #12 from JuzheZhong <juzhe.zhong at rivai dot ai> --- (In reply to Richard Biener from comment #11) > (In reply to Tamar Christina from comment #9) > > There is a weird costing going on in the PHI nodes though: > > > > m_108 = PHI <m_92(16), m_111(5)> 1 times vector_stmt costs 0 in body > > m_108 = PHI <m_92(16), m_111(5)> 2 times scalar_to_vec costs 0 in prologue > > > > they have collapsed to 0. which can't be right.. > > Note this is likely because of the backend going wrong. > > bool > vectorizable_phi (vec_info *, > stmt_vec_info stmt_info, gimple **vec_stmt, > slp_tree slp_node, stmt_vector_for_cost *cost_vec) > { > .. > > /* For single-argument PHIs assume coalescing which means zero cost > for the scalar and the vector PHIs. This avoids artificially > favoring the vector path (but may pessimize it in some cases). */ > if (gimple_phi_num_args (as_a <gphi *> (stmt_info->stmt)) > 1) > record_stmt_cost (cost_vec, SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node), > vector_stmt, stmt_info, vectype, 0, vect_body); > > You could check if we call this with sane values. Do you mean it's RISC-V backend cost model issue ?