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

--- Comment #6 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:eaee2df409ae40ab4a0c557839d6f64b9c6b936d

commit r16-600-geaee2df409ae40ab4a0c557839d6f64b9c6b936d
Author: Andrew Pinski <quic_apin...@quicinc.com>
Date:   Tue Apr 22 09:40:28 2025 -0700

    gimple-fold: Don't replace `tmp = FP0 CMP FP1; if (tmp != 0)` over and over
again when comparison can throw

    with -ftrapping-math -fnon-call-exceptions and:
    ```
    tmp = FP0 CMP FP1;

    if (tmp != 0) ...
    ```
    a call fold_stmt on the GIMPLE_COND will replace the above with
    a new tmp each time and we even lose the eh informatin on the
    previous comparison too.

    Changes since v1:
    * v2: Use INTEGRAL_TYPE_P instead of a check against BOOLEAN_TYPE.
          Add testcase which shows where losing of landing pad happened.

            PR tree-optimization/119903
    gcc/ChangeLog:

            * gimple-fold.cc (replace_stmt_with_simplification): Reject for
            noncall exceptions replacing comparison with itself.
    gcc/testsuite/ChangeLog:

            * g++.dg/tree-ssa/pr119903-1.C: New test.

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

Reply via email to