https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104582
--- Comment #13 from Richard Biener <rguenth at gcc dot gnu.org> --- Created attachment 52476 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52476&action=edit minimal patch This is a minimal untested patch adjusting APIs to allow for the cost hook to receive a slp_node in addition to a stmt_vec_info and make the x86 backend use it and successfully disregard the vectorization that's not doing a CTOR from memory. Other targets need minimal adjustments as well of course and some of the cleanups (additional overloads for record/add_stmt_cost for scalar and branch stmts and two fixes using scalar_stmt rather than vector_stmt kinds for versioning costs can and will be split out). Richard - any comments? Would you object to doing this for GCC 12 (give we changed the costing API anyway)?