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

--- Comment #75 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <[email protected]>:

https://gcc.gnu.org/g:2f7edefc54e6967168c3cce3a4347cc0bc6a8155

commit r16-4669-g2f7edefc54e6967168c3cce3a4347cc0bc6a8155
Author: Andrew Pinski <[email protected]>
Date:   Sun Oct 5 22:39:35 2025 -0700

    [PATCH] match: simplify `VCE<bool>({0,1}) ==/!= 0` to `{0,1} ==/!= 0`
[PR105749]

    SRA likes to create VCE<bool>(a) when it comes to bool. This confuses
    a few different passes including jump threading and uninitialization
    warning. This removes the VCE in one case where it will help and when it
    is known not to have any undefined behavior since the ranges of a is known
    to be 0/1.

    This implements similar was done for PR 80635 but without VRP's help; ccp
    provides enough on the range/non-zeroness to implement this in match.

    This will fix many of the std::optional reported warnings at -O1 too.
    pr80635-[34].C are the same as pr80635-[12].C but compiled at -O1 rather
    than just -O2.

            PR tree-optimization/105749
            PR tree-optimization/80635

    gcc/ChangeLog:

            * match.pd (`VCE<bool>(zero_one_valued_p) ==\!= 0`): New pattern.

    gcc/testsuite/ChangeLog:

            * g++.dg/warn/pr80635-3.C: New test.
            * g++.dg/warn/pr80635-4.C: New test.

    Signed-off-by: Andrew Pinski <[email protected]>

Reply via email to