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

--- Comment #17 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <[email protected]>:

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

commit r17-4921-g8b90726a28bb63038b4f80242c7f5af7f53b60ff
Author: Richard Biener <[email protected]>
Date:   Mon Sep 28 15:44:56 2026 +0200

    Preserve comparison operand order whem if-combining

    When combining conditions ifcombine_ifandif passes inner_cond_code as the
    first comparison and outer_cond_code as the second to
    maybe_fold_and_comparisons and maybe_fold_and_comparisons calls
    and_comparisons_1 with both comparison orders.  Both defeats preserving
    IEEE exceptions of trapping outer comparisons which combine_comparisons
    handles, but only when the order of the comparisons is preserved correctly.

    This disables some optimization in and_comparisons_1 which only looks
    through SSA defs for the first comparison.  This requires larger
    refactoring and the overall design seems dubious with recursions
    going in ways that with the swapping look exponential.

            PR tree-optimization/53805
            * tree-ssa-ifcombine.cc (ifcombine_ifandif): Pass comparisons
            in the correct order.
            * gimple-fold.cc (and_comparisons_1): Add FIXME comment.
            (maybe_fold_and_comparisons): Do not call and_comparisons_1 with
            swapped comparisons.

            * gcc.dg/tree-ssa/fp-trapping-cmp-6.c: New testcase
            * gcc.dg/tree-ssa/fp-trapping-cmp-7.c: Likewise.

Reply via email to