This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/81346] Missed constant propagation into comparison


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

--- Comment #14 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Wed Jul 19 12:31:59 2017
New Revision: 250338

URL: https://gcc.gnu.org/viewcvs?rev=250338&root=gcc&view=rev
Log:
        PR tree-optimization/81346
        * fold-const.h (fold_div_compare, range_check_type): Declare.
        * fold-const.c (range_check_type): New function.
        (build_range_check): Use range_check_type.
        (fold_div_compare): No longer static, rewritten into
        a match.pd helper function.
        (fold_comparison): Don't call fold_div_compare here.
        * match.pd (X / C1 op C2): New optimization using fold_div_compare
        as helper function.

        * gcc.dg/tree-ssa/pr81346-1.c: New test.
        * gcc.dg/tree-ssa/pr81346-2.c: New test.
        * gcc.dg/tree-ssa/pr81346-3.c: New test.
        * gcc.dg/tree-ssa/pr81346-4.c: New test.
        * gcc.target/i386/umod-3.c: Hide comparison against 1 from the
        compiler to avoid X / C1 op C2 optimization to trigger.

Added:
    trunk/gcc/testsuite/gcc.dg/tree-ssa/pr81346-1.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/pr81346-2.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/pr81346-3.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/pr81346-4.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/fold-const.c
    trunk/gcc/fold-const.h
    trunk/gcc/match.pd
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.target/i386/umod-3.c

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]