https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125557

--- Comment #12 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <[email protected]>:

https://gcc.gnu.org/g:3c0fd2976ab4f4d9e51f93eaf1e49121299e4875

commit r17-1703-g3c0fd2976ab4f4d9e51f93eaf1e49121299e4875
Author: Andrew Pinski <[email protected]>
Date:   Fri Jun 12 12:52:18 2026 -0700

    phiopt: Simplified factoring of loads [PR125557]

    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]>

Reply via email to