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

--- Comment #10 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pins...@gcc.gnu.org>:

https://gcc.gnu.org/g:a51bf9e10182cf7ac858db0ea6c5cb11b4f12377

commit r16-2590-ga51bf9e10182cf7ac858db0ea6c5cb11b4f12377
Author: Andrew Pinski <quic_apin...@quicinc.com>
Date:   Fri Jul 25 13:54:32 2025 -0700

    ifcvt: Fix ifcvt for multiple phi nodes after factoring operator [PR121236]

    When I added the factor operations to ifcvt, I messed how handling of
removing
    the phi nodes. The fix is we need to remove the phi node that was factored
out
    as we factored out the operator because otherwise scev can go when it comes
    to detecting if the new args are from a reduction.

    Also the need to change the interface for is_cond_scalar_reduction as the
    phi node that was being passed after the factoring no longer exists so need
    to pass the parts that were being used.

            PR tree-optimization/121236

    gcc/ChangeLog:

            * tree-if-conv.cc (is_cond_scalar_reduction): Instead of phi
argument,
            pass bb and res of the phi.
            (factor_out_operators): Add iterator for the phi. Remove the phi
            if this is the first time. Return if we had removed the phi.
            (predicate_scalar_phi): Add the phi iterator argument.
            Update call to is_cond_scalar_reduction.
            Update call to factor_out_operators and set the return value to
true
            when factor_out_operators returns true.
            (predicate_all_scalar_phis): Don't remove the phi if
predicate_scalar_phi
            already removed it.

    gcc/testsuite/ChangeLog:

            * gcc.dg/torture/pr121236-1.c: New test.

    Signed-off-by: Andrew Pinski <quic_apin...@quicinc.com>

Reply via email to