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

--- Comment #22 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:65061ea287a80cfb214e402cfd2373a14bfec95a

commit r12-864-g65061ea287a80cfb214e402cfd2373a14bfec95a
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Tue May 18 10:08:51 2021 +0200

    phiopt: Optimize partial_ordering spaceship >= 0 -ffinite-math-only
[PR94589]

    As mentioned earlier, spaceship_replacement didn't optimize
partial_ordering
    >= 0 comparisons, because the possible values are -1, 0, 1, 2 and the
    >= comparison is implemented as (res & 1) == res to choose the 0 and 1
    cases from that.  As we optimize that only with -ffinite-math-only, the
    2 case is assumed not to happen and my earlier match.pd change optimizes
    (res & 1) == res into (res & ~1) == 0, so this patch pattern matches
    that case and handles it like res >= 0.

    2021-05-18  Jakub Jelinek  <ja...@redhat.com>

            PR tree-optimization/94589
            * tree-ssa-phiopt.c (spaceship_replacement): Pattern match
            phi result used in (res & ~1) == 0 comparison as res >= 0 as
            res == 2 would be UB with -ffinite-math-only.

            * g++.dg/opt/pr94589-2.C: Adjust scan-tree-dump count from 14 to
12.

Reply via email to