https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116979
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |deferred --- Comment #23 from Richard Biener <rguenth at gcc dot gnu.org> --- So in particular, vect_bb_slp_scalar_cost only ever considers scalar stmts recorded in SLP_TREE_SCALAR_STMTS which for the case of the FMADDSUB SLP pattern does not get to see the multiplication. There's a similar issue for scalar patterns where we only consider the scalar pattern root but not all original covered stmts (or alternatively all stmts covered in the pattern def sequence). A reasonable fix would look at this (scalar stmt coverage) and the problem of determining out-of-SLP-subgraph uses (live lanes) at the same time since both are very much related. Which means a rewrite - I don't see any easy workaround suitable for stage4 or even backporting.