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

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Mon Oct 21 11:36:36 2019
New Revision: 277244

URL: https://gcc.gnu.org/viewcvs?rev=277244&root=gcc&view=rev
Log:
        Backported from mainline
        2019-09-02  Jakub Jelinek  <ja...@redhat.com>

        PR go/91617
        * fold-const.c (range_check_type): For enumeral and boolean
        type, pass 1 to type_for_size langhook instead of
        TYPE_UNSIGNED (etype).  Return unsigned_type_for result whenever
        etype isn't TYPE_UNSIGNED INTEGER_TYPE.
        (build_range_check): Don't call unsigned_type_for for pointer types.
        * match.pd (X / C1 op C2): Don't call unsigned_type_for on
        range_check_type result.

        2019-08-29  Jakub Jelinek  <ja...@redhat.com>

        PR tree-optimization/91351
        * tree-cfg.c (generate_range_test): Use range_check_type instead of
        unsigned_type_for.
        * tree-cfgcleanup.c (convert_single_case_switch): Punt if
        range_check_type returns NULL.
        * tree-switch-conversion.c (switch_conversion::build_one_array):
        Use range_check_type instead of unsigned_type_for, don't perform
        linear opt if it returns NULL.
        (bit_test_cluster::find_bit_tests): Formatting fix.
        (bit_test_cluster::emit): Use range_check_type instead of
        unsigned_type_for.
        (switch_decision_tree::try_switch_expansion): Punt if range_check_type
        returns NULL.

        * g++.dg/opt/pr91351.C: New test.

Added:
    branches/gcc-9-branch/gcc/testsuite/g++.dg/opt/pr91351.C
Modified:
    branches/gcc-9-branch/gcc/ChangeLog
    branches/gcc-9-branch/gcc/fold-const.c
    branches/gcc-9-branch/gcc/match.pd
    branches/gcc-9-branch/gcc/testsuite/ChangeLog
    branches/gcc-9-branch/gcc/tree-cfg.c
    branches/gcc-9-branch/gcc/tree-cfgcleanup.c
    branches/gcc-9-branch/gcc/tree-switch-conversion.c

Reply via email to