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

--- Comment #10 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Alexandre Oliva <aol...@gcc.gnu.org>:

https://gcc.gnu.org/g:91fa9c15cc4fb9947e7e2f7990f7d5a58845d5cf

commit r15-7173-g91fa9c15cc4fb9947e7e2f7990f7d5a58845d5cf
Author: Alexandre Oliva <ol...@adacore.com>
Date:   Thu Jan 23 23:23:16 2025 -0300

    [ifcombine] check for more zero-extension cases [PR118572]

    When comparing a signed narrow variable with a wider constant that has
    the bit corresponding to the variable's sign bit set, we would check
    that the constant is a sign-extension from that sign bit, and conclude
    that the compare fails if it isn't.

    When the signed variable is masked without getting the [lr]l_signbit
    variable set, or when the sign bit itself is masked out, we know the
    sign-extension bits from the extended variable are going to be zero,
    so the constant will only compare equal if it is a zero- rather than
    sign-extension from the narrow variable's precision, therefore, check
    that it satisfies this property, and yield a false compare result
    otherwise.


    for  gcc/ChangeLog

            PR tree-optimization/118572
            * gimple-fold.cc (fold_truth_andor_for_ifcombine): Compare as
            unsigned the variables whose extension bits are masked out.

    for  gcc/testsuite/ChangeLog

            PR tree-optimization/118572
            * gcc.dg/field-merge-24.c: New.

Reply via email to