https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125945
--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Andrea Pinski <[email protected]>: https://gcc.gnu.org/g:b1dcde565577e8ae1b6297e4a230f040e6aa6547 commit r17-4456-gb1dcde565577e8ae1b6297e4a230f040e6aa6547 Author: Andrea Pinski <[email protected]> Date: Wed Sep 16 00:01:13 2026 -0700 phiopt: Better pre-vect heurstics for factoring out loads [PR125945] Currently we reject most commonalization of loads in factor_out_conditional_load before the vectorizer. This was done as the easiest and simpliest herustics at the time I was writing the code. We can do better than that. This inproves the heurstics by allowing pointers which don't analyize via scalar evolution. This means loads which are from other loads can be factored out earlier than the loop optimizers. This changes 2 testcases which are now factored out in phiopt2 and one testcase where we don't want the factoring out before the vectorizer as we want to be able to vectorize the code (derived from eembc's telecom/viterb00data_1 benchmark). Bootstrapped and tested on x86_64-linux-gnu. PR tree-optimization/125945 gcc/ChangeLog: * tree-ssa-phiopt.cc (induction_based): New function. (factor_out_conditional_load): Allow some factoring out with early and/or before_vect. (factor_out_all): Set before_vect to false when not vectorizing. (pass_phiopt::execute): Initialize scev in some cases. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/scc-diamond-1.c: Update to look at phiopt2 rather than phiopt4. * gcc.dg/tree-ssa/scc-diamond-3.c: Likewise. * gcc.dg/tree-ssa/factor_op_phi-load-vect-1.c: New test. Signed-off-by: Andrea Pinski <[email protected]>
