https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126028
--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Richard Biener <[email protected]>: https://gcc.gnu.org/g:5e63fb58f84e3ce19cb336710f69094ecbd4b63d commit r17-3220-g5e63fb58f84e3ce19cb336710f69094ecbd4b63d Author: Richard Biener <[email protected]> Date: Wed Jul 15 15:33:31 2026 +0200 tree-optimization/126028 - vector placement and live lane extracts We currently conservatively assume vector stmt placement when determining whether we can place a lane extraction for a live scalar value. The following attempts to improve this by pre-computing an insertion place for all nodes and using that to improve live lane extract feasibility computation. While we'd like to re-use such computation for the actual insertion there are issues preventing that such as scalar stmts eventually getting elided and thus iterators invalidated. So the following re-computes the scheduling again but at least validates the earlier schedule against it. For PR126099 I have to turn this into schedule validation, but not as part of this initial work. The major pain-point of chosing a gimple * as scheduling anchor are that for placement in empty BBs that is NULL (this hits us with region boundaries), a gsi would be able to handle this case. But then, as you can see in the blob that attempts to verify the early schedule constraints hold at transform time there's issues like the scalar stmts vanishing and statements being inserted. As most viable and ugly option I briefly considered inserting GIMPLE_NOPs as anchors. Instead of vect_schedule_slp_node computing the insertion place this could be also handled (or just overridden?) by vectorizable_* which sometimes has its own idea where to place. PR tree-optimization/126028 * tree-vectorizer.h (_slp_tree::si): New member. (vect_schedule_slp): Adjust prototype. * tree-vect-loop.cc (vect_transform_loop): Adjust. * tree-vect-slp.cc (_slp_tree::_slp_tree): Initialize si. (vect_bb_slp_mark_live_stmts): Use vector stmt placement constraint computed by pre-scheduling of SLP nodes. (vect_slp_analyze_bb_1): Pre-schedule SLP nodes before computing live lane extraction points. (vect_slp_region): Adjust. (vect_schedule_slp_node): Add parameter indicating to whether we should perform pre-scehduling or not. Compute the insertion place suitable for dominance checks when pre-scheduling. (vect_schedule_scc): Adjust. (vect_schedule_slp): Likewise. * gcc.dg/vect/bb-slp-46.c: Un-XFAIL. * gcc.dg/vect/bb-slp-pr126053.c: New testcase. * gcc.dg/vect/costmodel/x86_64/costmodel-pr126028.c: Likewise.
