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

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-16 branch has been updated by Jakub Jelinek
<[email protected]>:

https://gcc.gnu.org/g:8ddb287efebf7f8c73e9839ae9562c060456b56d

commit r16-9872-g8ddb287efebf7f8c73e9839ae9562c060456b56d
Author: Jakub Jelinek <[email protected]>
Date:   Mon Oct 19 09:55:20 2026 +0200

    bitintlower: Remove unused large/huge _BitInt PHIs [PR127904]

    tree-outof-ssa.cc before performing coalescing does
    eliminate_useless_phis (), which removes removes PHIs and dead PHIs.
    The following testcase is miscompiled because the coalescing performed
    for the large/huge _BitInt SSA_NAME subset is apparently confused by
    such dead PHIs and puts the result of such an PHI into the same partition
    as one of the PHI args which is unfortunately used later on in the
    function as well, so by reusing the partition we clobber the value of
    the argument and then use the incorrect value later on.
    From this, I think the remove dead PHIs part of
    eliminate_useless_phis is not just an optimization but I think the
    coalescing somehow relies on it.
    So, this patch performs such removal (again, for large/huge _BitInt
    PHIs only) before doing the coalescing as well.

    2026-10-19  Jakub Jelinek  <[email protected]>

            PR tree-optimization/127904
            * tree-outof-ssa.h (remove_gimple_phi_args): Declare.
            * tree-outof-ssa.cc (remove_gimple_phi_args): No longer static.
            * gimple-lower-bitint.cc: Include tree-outof-ssa.h.
            (gimple_lower_bitint): Remove zero uses large/huge _BitInt
            PHI results.

            * gcc.dg/torture/bitint-111.c: New test.

    Reviewed-by: Richard Biener <[email protected]>
    (cherry picked from commit 2653d6c63d491dd8f61efff553ad4d7bcc33d53c)

Reply via email to