On 6/15/2026 11:00 AM, Andrew Pinski wrote: > This is a simplified version that I was mentioning. > It is based on https://gcc.gnu.org/pipermail/gcc-patches/2026-June/720170.html > but only handing in phi-opt. It is able to optimize > what is requested and will not have the regression dealing > with vectorization. There are some more tweaks we can do > to handle some more stuff. > Like before vectorization, if the two pointers are the same we should do > the factoring. Or handling stores before the load which will allow > us to iterate better with cs-elim limited. We can also tweak the > before vectorization cost to be rather based on if it just inside > a loop into what was done in the full patch. For the benchmark improvement > that was not needed. > > Changes since v1: > * v2: the factoring needs to be done on a diamond only, and the loads need to > come from the middle bbs. > > PR tree-optimization/125557 > > gcc/ChangeLog: > > * tree-ssa-phiopt.cc (factor_out_conditional_load): New function. > (factor_out_all): Call factor_out_conditional_load. > > gcc/testsuite/ChangeLog: > > * gcc.dg/tree-ssa/scc-diamond-1.c: New test. > * gcc.dg/tree-ssa/scc-diamond-3.c: New test. > * gcc.dg/tree-ssa/scc-diamond-4.c: New test. > * gcc.target/aarch64/scc-diamond-2.c: New test. > > Co-Authored-by: Kyrylo Tkachov <[email protected]> > Signed-off-by: Kyrylo Tkachov <[email protected]> > Signed-off-by: Andrew Pinski <[email protected]> OK. Presumably the tests include the snappy fragment Kyrylo was targeting in his version. Just want to make sure as that's a major motivator behidn this change.
jeff
