diff options
author | Richard Biener <rguenth@gcc.gnu.org> | 2018-10-22 13:57:47 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2018-10-22 13:57:47 +0000 |
commit | e86087eeb8b9cab8caf7f223b602383a3216c810 (patch) | |
tree | 98dfbd3555145dc4c6d3c6137793b4e489f4672b /gcc | |
parent | d1e14d97207fafc3b9873bb06a3a6f1fc1f6d305 (diff) | |
download | gcc-e86087eeb8b9cab8caf7f223b602383a3216c810.zip gcc-e86087eeb8b9cab8caf7f223b602383a3216c810.tar.gz gcc-e86087eeb8b9cab8caf7f223b602383a3216c810.tar.bz2 |
2018-10-22 Richard Biener <rguenther@suse.de>
* gimple-ssa-evrp-analyze.c
(evrp_range_analyzer::record_ranges_from_incoming_edge): Be
smarter about what ranges to use.
* tree-vrp.c (add_assert_info): Dump here.
(register_edge_assert_for_2): Instead of here at multiple but
not all places.
* gcc.dg/tree-ssa/evrp12.c: New testcase.
* gcc.dg/predict-6.c: Adjust.
* gcc.dg/tree-ssa/vrp33.c: Disable EVRP.
* gcc.dg/tree-ssa/vrp02.c: Likewise.
* gcc.dg/tree-ssa/cunroll-9.c: Likewise.
From-SVN: r265391
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 15 | ||||
-rw-r--r-- | gcc/gimple-ssa-evrp-analyze.c | 10 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/predict-6.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/cunroll-9.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/evrp12.c | 21 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/vrp02.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/vrp33.c | 2 | ||||
-rw-r--r-- | gcc/tree-vrp.c | 56 |
9 files changed, 64 insertions, 58 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 54f36a1..96f1875 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,18 @@ +2018-10-22 Richard Biener <rguenther@suse.de> + + * gimple-ssa-evrp-analyze.c + (evrp_range_analyzer::record_ranges_from_incoming_edge): Be + smarter about what ranges to use. + * tree-vrp.c (add_assert_info): Dump here. + (register_edge_assert_for_2): Instead of here at multiple but + not all places. + + * gcc.dg/tree-ssa/evrp12.c: New testcase. + * gcc.dg/predict-6.c: Adjust. + * gcc.dg/tree-ssa/vrp33.c: Disable EVRP. + * gcc.dg/tree-ssa/vrp02.c: Likewise. + * gcc.dg/tree-ssa/cunroll-9.c: Likewise. + 2018-10-22 Steven Bosscher <steven@gcc.gnu.org> Richard Biener <rguenther@suse.de> diff --git a/gcc/gimple-ssa-evrp-analyze.c b/gcc/gimple-ssa-evrp-analyze.c index 83917f5..b7b0fd8 100644 --- a/gcc/gimple-ssa-evrp-analyze.c +++ b/gcc/gimple-ssa-evrp-analyze.c @@ -203,6 +203,16 @@ evrp_range_analyzer::record_ranges_from_incoming_edge (basic_block bb) ordering issues that can lead to worse ranges. */ for (unsigned i = 0; i < vrs.length (); ++i) { + /* But make sure we do not weaken ranges like when + getting first [64, +INF] and then ~[0, 0] from + conditions like (s & 0x3cc0) == 0). */ + value_range *old_vr = get_value_range (vrs[i].first); + value_range tem (old_vr->kind (), old_vr->min (), old_vr->max ()); + tem.intersect (vrs[i].second); + if (tem.kind () == old_vr->kind () + && tem.min () == old_vr->min () + && tem.max () == old_vr->max ()) + continue; push_value_range (vrs[i].first, vrs[i].second); if (is_fallthru && all_uses_feed_or_dominated_by_stmt (vrs[i].first, stmt)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b803f72..629f777 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,14 @@ +2018-10-22 Richard Biener <rguenther@suse.de> + + * gcc.dg/tree-ssa/evrp12.c: New testcase. + * gcc.dg/predict-6.c: Adjust. + * gcc.dg/tree-ssa/vrp33.c: Disable EVRP. + * gcc.dg/tree-ssa/vrp02.c: Likewise. + * gcc.dg/tree-ssa/cunroll-9.c: Likewise. + 2018-10-22 Martin Liska <mliska@suse.cz> - PR tree-optimization/87686 + PR tree-optimization/87686 * g++.dg/tree-ssa/pr87686.C: New test. 2018-10-22 Jakub Jelinek <jakub@redhat.com> diff --git a/gcc/testsuite/gcc.dg/predict-6.c b/gcc/testsuite/gcc.dg/predict-6.c index 5d6fbf1..08ce5cd 100644 --- a/gcc/testsuite/gcc.dg/predict-6.c +++ b/gcc/testsuite/gcc.dg/predict-6.c @@ -10,9 +10,9 @@ void foo (int base, int bound) int i, ret = 0; for (i = base; i <= bound; i++) { - if (i < base) + if (i <= base) global += bar (i); - if (i < base + 1) + if (i < base + 2) global += bar (i); if (i <= base + 3) global += bar (i); diff --git a/gcc/testsuite/gcc.dg/tree-ssa/cunroll-9.c b/gcc/testsuite/gcc.dg/tree-ssa/cunroll-9.c index 0e4407d..886dc14 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/cunroll-9.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/cunroll-9.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-cunrolli-details" } */ +/* { dg-options "-O2 -fdump-tree-cunrolli-details -fdisable-tree-evrp" } */ void abort (void); int q (void); int a[10]; diff --git a/gcc/testsuite/gcc.dg/tree-ssa/evrp12.c b/gcc/testsuite/gcc.dg/tree-ssa/evrp12.c new file mode 100644 index 0000000..b3906c2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/evrp12.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-evrp" } */ + +extern void link_error (); + +void +f3 (unsigned int s) +{ + if ((s & 0x3cc0) == 0) + { + if (s >= -15552U) + link_error (); + } + else + { + if (s <= 0x3f) + link_error (); + } +} + +/* { dg-final { scan-tree-dump-not "link_error" "evrp" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp02.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp02.c index 8d14fea..4be538f 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/vrp02.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp02.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-vrp1 -fdelete-null-pointer-checks" } */ +/* { dg-options "-O2 -fdump-tree-vrp1 -fdelete-null-pointer-checks -fdisable-tree-evrp" } */ struct A { diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp33.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp33.c index 75fefa4..f1d3863 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/vrp33.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp33.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-vrp1 -fno-tree-fre" } */ +/* { dg-options "-O2 -fdump-tree-vrp1 -fno-tree-fre -fdisable-tree-evrp" } */ /* This is from PR14052. */ diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 28b4d56..e3a64fd 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -2299,6 +2299,9 @@ add_assert_info (vec<assert_info> &asserts, info.val = val; info.expr = expr; asserts.safe_push (info); + dump_printf (MSG_NOTE | MSG_PRIORITY_INTERNALS, + "Adding assert for %T from %T %s %T\n", + name, expr, op_symbol_code (comp_code), val); } /* If NAME doesn't have an ASSERT_EXPR registered for asserting @@ -2698,16 +2701,6 @@ register_edge_assert_for_2 (tree name, edge e, tmp = build1 (NOP_EXPR, TREE_TYPE (name), name3); if (cst2 != NULL_TREE) tmp = build2 (PLUS_EXPR, TREE_TYPE (name), tmp, cst2); - - if (dump_file) - { - fprintf (dump_file, "Adding assert for "); - print_generic_expr (dump_file, name3); - fprintf (dump_file, " from "); - print_generic_expr (dump_file, tmp); - fprintf (dump_file, "\n"); - } - add_assert_info (asserts, name3, tmp, comp_code, val); } @@ -2725,16 +2718,6 @@ register_edge_assert_for_2 (tree name, edge e, tmp = build1 (NOP_EXPR, TREE_TYPE (name), tmp); if (cst2 != NULL_TREE) tmp = build2 (PLUS_EXPR, TREE_TYPE (name), tmp, cst2); - - if (dump_file) - { - fprintf (dump_file, "Adding assert for "); - print_generic_expr (dump_file, name2); - fprintf (dump_file, " from "); - print_generic_expr (dump_file, tmp); - fprintf (dump_file, "\n"); - } - add_assert_info (asserts, name2, tmp, comp_code, val); } } @@ -2857,16 +2840,6 @@ register_edge_assert_for_2 (tree name, edge e, cst = fold_build2 (MINUS_EXPR, TREE_TYPE (name2), cst, build_int_cst (TREE_TYPE (name2), 1)); } - - if (dump_file) - { - fprintf (dump_file, "Adding assert for "); - print_generic_expr (dump_file, name2); - fprintf (dump_file, " from "); - print_generic_expr (dump_file, tmp); - fprintf (dump_file, "\n"); - } - add_assert_info (asserts, name2, tmp, new_comp_code, cst); } } @@ -2931,18 +2904,7 @@ register_edge_assert_for_2 (tree name, edge e, } if (new_val) - { - if (dump_file) - { - fprintf (dump_file, "Adding assert for "); - print_generic_expr (dump_file, name2); - fprintf (dump_file, " from "); - print_generic_expr (dump_file, tmp); - fprintf (dump_file, "\n"); - } - - add_assert_info (asserts, name2, tmp, new_comp_code, new_val); - } + add_assert_info (asserts, name2, tmp, new_comp_code, new_val); } /* Add asserts for NAME cmp CST and NAME being defined as @@ -3170,16 +3132,6 @@ register_edge_assert_for_2 (tree name, edge e, maxv2 = maxv - minv; } new_val = wide_int_to_tree (type, maxv2); - - if (dump_file) - { - fprintf (dump_file, "Adding assert for "); - print_generic_expr (dump_file, names[i]); - fprintf (dump_file, " from "); - print_generic_expr (dump_file, tmp); - fprintf (dump_file, "\n"); - } - add_assert_info (asserts, names[i], tmp, LE_EXPR, new_val); } } |