summaryrefslogtreecommitdiff
path: root/gcc/vr-values.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2018-12-10 13:56:51 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2018-12-10 13:56:51 +0000
commitdee75828b49690e14b12b949d07826774a023cfd (patch)
tree4855c8f6d1c205d85e4e598d58c84ed0cbcaf23b /gcc/vr-values.c
parent4a902ec80fd0be5d102dc0cc781a651b3e59b91c (diff)
re PR tree-optimization/88427 (ICE: tree check: expected integer_cst, have plus_expr in get_len, at tree.h:5617)
2018-12-10 Richard Biener <rguenther@suse.de> PR tree-optimization/88427 * vr-values.c (vr_values::extract_range_from_phi_node): Handle symbolic ranges conservatively when trying to drop to Inf +- 1. * gcc.dg/pr88427.c: New testcase. From-SVN: r266955
Diffstat (limited to 'gcc/vr-values.c')
-rw-r--r--gcc/vr-values.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/gcc/vr-values.c b/gcc/vr-values.c
index 075ea8431a6..cbc759a18e6 100644
--- a/gcc/vr-values.c
+++ b/gcc/vr-values.c
@@ -2891,8 +2891,9 @@ vr_values::extract_range_from_phi_node (gphi *phi, value_range *vr_result)
if (cmp_min < 0)
new_min = lhs_vr->min ();
else if (cmp_min > 0
- && tree_int_cst_lt (vrp_val_min (vr_result->type ()),
- vr_result->min ()))
+ && (TREE_CODE (vr_result->min ()) != INTEGER_CST
+ || tree_int_cst_lt (vrp_val_min (vr_result->type ()),
+ vr_result->min ())))
new_min = int_const_binop (PLUS_EXPR,
vrp_val_min (vr_result->type ()),
build_int_cst (vr_result->type (), 1));
@@ -2901,8 +2902,9 @@ vr_values::extract_range_from_phi_node (gphi *phi, value_range *vr_result)
if (cmp_max > 0)
new_max = lhs_vr->max ();
else if (cmp_max < 0
- && tree_int_cst_lt (vr_result->max (),
- vrp_val_max (vr_result->type ())))
+ && (TREE_CODE (vr_result->max ()) != INTEGER_CST
+ || tree_int_cst_lt (vr_result->max (),
+ vrp_val_max (vr_result->type ()))))
new_max = int_const_binop (MINUS_EXPR,
vrp_val_max (vr_result->type ()),
build_int_cst (vr_result->type (), 1));