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

--- Comment #23 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:1f619fe25925a5f79b9c33962e7a72e1f9fa4444

commit r15-4033-g1f619fe25925a5f79b9c33962e7a72e1f9fa4444
Author: Andrew Pinski <quic_apin...@quicinc.com>
Date:   Tue Oct 1 18:34:00 2024 +0000

    phiopt: Fix VCE moving by rewriting it into cast [PR116098]

    Phiopt match_and_simplify might move a well defined VCE assign statement
    from being conditional to being uncondtitional; that VCE might no longer
    being defined. It will need a rewrite into a cast instead.

    This adds the rewriting code to move_stmt for the VCE case.
    This is enough to fix the issue at hand. It should also be using
rewrite_to_defined_overflow
    but first I need to move the check to see a rewrite is needed into its own
function
    and that is causing issues (see
https://gcc.gnu.org/pipermail/gcc-patches/2024-September/663938.html).
    Plus this version is easiest to backport.

    Bootstrapped and tested on x86_64-linux-gnu.

            PR tree-optimization/116098

    gcc/ChangeLog:

            * tree-ssa-phiopt.cc (move_stmt): Rewrite VCEs from integer to
integer
            types to case.

    gcc/testsuite/ChangeLog:

            * c-c++-common/torture/pr116098-2.c: New test.
            * g++.dg/torture/pr116098-1.C: New test.

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

Reply via email to