[Bug tree-optimization/126138] `fp0 == fp1 || fp0 CMP fp1` can be combined always even with trapping

"cvs-commit at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126138

--- Comment #9 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:ea33efbbdcf69794b9962bf4926b07e73618d016

commit r17-2708-gea33efbbdcf69794b9962bf4926b07e73618d016
Author: Andrea Pinski <[email protected]>
Date:   Sat Jul 11 22:57:39 2026 -0700

    ifcombine: Handle trapping ifcombining better. [PR126138]

    We can sometimes combine comparisons that are trapping.
    This adds that optimization to ifcombine; using combine_comparison
    from fold-const to do most of the work.

    This does not handle all cases though; mostly dealing with where we need an
    inversion of the outer comparison and it does not invert is not currently
handled.
    This will be handled later on as it needs some extra code added to
combine_comparisons.

    Bootstrapped and tested on x86_64-linux-gnu.

            PR tree-optimization/126138
    gcc/ChangeLog:

            * tree-ssa-ifcombine.cc (bb_no_side_effects_p): Don't reject
GIMPLE_COND
            that can trap.
            (ifcombine_ifandif): Handle trapping inner conditional specially.

    gcc/testsuite/ChangeLog:

            * gcc.dg/tree-ssa/fp-trapping-cmp-2.c: New test.
            * gcc.dg/tree-ssa/fp-trapping-cmp-3.c: New test.

    Signed-off-by: Andrea Pinski <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.