aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2017-01-11 09:06:29 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2017-01-11 09:06:29 +0000
commit80c74722bc934e376b06fa2e59925cb134202266 (patch)
tree3bdccc60769ba543734fa198aa5ebb8041cced1a
parent4c4b47031d4bcbf116cbc3c479933adf14b2b4fe (diff)
downloadgcc-80c74722bc934e376b06fa2e59925cb134202266.zip
gcc-80c74722bc934e376b06fa2e59925cb134202266.tar.gz
gcc-80c74722bc934e376b06fa2e59925cb134202266.tar.bz2
tree-vrp.c (evrp_dom_walker::before_dom_children): Also set range/nonnull info for PHI results.
2017-01-11 Richard Biener <rguenther@suse.de> * tree-vrp.c (evrp_dom_walker::before_dom_children): Also set range/nonnull info for PHI results. Do not set it on stmts marked for removal. * gcc.dg/tree-ssa/pr61743-1.c: Adjust. From-SVN: r244305
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr61743-1.c6
-rw-r--r--gcc/tree-vrp.c46
4 files changed, 47 insertions, 15 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index cc81d79..caa26f8 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2017-01-11 Richard Biener <rguenther@suse.de>
+
+ * tree-vrp.c (evrp_dom_walker::before_dom_children): Also
+ set range/nonnull info for PHI results. Do not set it on
+ stmts marked for removal.
+
2017-01-10 Eric Botcazou <ebotcazou@adacore.com>
* expr.c (store_field): In the bitfield case, fetch the return value
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 2b5f3b9..f189a44 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2017-01-11 Richard Biener <rguenther@suse.de>
+
+ * gcc.dg/tree-ssa/pr61743-1.c: Adjust.
+
2017-01-11 Jakub Jelinek <jakub@redhat.com>
PR middle-end/50199
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr61743-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr61743-1.c
index 8041c6a..a5c83cf 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr61743-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr61743-1.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O3 -funroll-loops -fno-tree-vectorize -fdump-tree-cunroll-details -fno-peel-loops" } */
+/* { dg-options "-O3 -funroll-loops -fno-tree-vectorize -fdump-tree-cunroll-details -fdump-tree-cunrolli-details -fno-peel-loops" } */
#define N 8
#define M 14
@@ -48,5 +48,5 @@ int foo1 (e_u8 a[4][N], int b1, int b2, e_u8 b[M+1][4][N])
return 0;
}
-/* { dg-final { scan-tree-dump-times "loop with 4 iterations completely unrolled" 2 "cunroll" } } */
-/* { dg-final { scan-tree-dump-times "loop with 8 iterations completely unrolled" 2 "cunroll" } } */
+/* { dg-final { scan-tree-dump-times "loop with 4 iterations completely unrolled" 8 "cunroll" } } */
+/* { dg-final { scan-tree-dump-times "loop with 9 iterations completely unrolled" 2 "cunrolli" } } */
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 54df161..4cfdd0a 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -10862,7 +10862,29 @@ evrp_dom_walker::before_dom_children (basic_block bb)
/* Mark PHIs whose lhs we fully propagate for removal. */
tree val = op_with_constant_singleton_value_range (lhs);
if (val && may_propagate_copy (lhs, val))
- stmts_to_remove.safe_push (phi);
+ {
+ stmts_to_remove.safe_push (phi);
+ continue;
+ }
+
+ /* Set the SSA with the value range. */
+ if (INTEGRAL_TYPE_P (TREE_TYPE (lhs)))
+ {
+ if ((vr_result.type == VR_RANGE
+ || vr_result.type == VR_ANTI_RANGE)
+ && (TREE_CODE (vr_result.min) == INTEGER_CST)
+ && (TREE_CODE (vr_result.max) == INTEGER_CST))
+ set_range_info (lhs,
+ vr_result.type, vr_result.min, vr_result.max);
+ }
+ else if (POINTER_TYPE_P (TREE_TYPE (lhs))
+ && ((vr_result.type == VR_RANGE
+ && range_includes_zero_p (vr_result.min,
+ vr_result.max) == 0)
+ || (vr_result.type == VR_ANTI_RANGE
+ && range_includes_zero_p (vr_result.min,
+ vr_result.max) == 1)))
+ set_ptr_nonnull (lhs);
}
edge taken_edge = NULL;
@@ -10908,6 +10930,17 @@ evrp_dom_walker::before_dom_children (basic_block bb)
update_value_range (output, &vr);
vr = *get_value_range (output);
+ /* Mark stmts whose output we fully propagate for removal. */
+ tree val;
+ if ((val = op_with_constant_singleton_value_range (output))
+ && may_propagate_copy (output, val)
+ && !stmt_could_throw_p (stmt)
+ && !gimple_has_side_effects (stmt))
+ {
+ stmts_to_remove.safe_push (stmt);
+ continue;
+ }
+
/* Set the SSA with the value range. */
if (INTEGRAL_TYPE_P (TREE_TYPE (output)))
{
@@ -10925,17 +10958,6 @@ evrp_dom_walker::before_dom_children (basic_block bb)
&& range_includes_zero_p (vr.min,
vr.max) == 1)))
set_ptr_nonnull (output);
-
- /* Mark stmts whose output we fully propagate for removal. */
- tree val;
- if ((val = op_with_constant_singleton_value_range (output))
- && may_propagate_copy (output, val)
- && !stmt_could_throw_p (stmt)
- && !gimple_has_side_effects (stmt))
- {
- stmts_to_remove.safe_push (stmt);
- continue;
- }
}
else
set_defs_to_varying (stmt);