Commit 9d6eefd5 by Eric Botcazou

tree-vrp.c (extract_range_from_assert): Set the range to VARYING for LT and GT…

tree-vrp.c (extract_range_from_assert): Set the range to VARYING for LT and GT if the computed range is effectively empty.

	* tree-vrp.c (extract_range_from_assert): Set the range to VARYING
	for LT and GT if the computed range is effectively empty.

From-SVN: r114108
parent c3c690ea
2006-06-24 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> 2006-05-25 Eric Botcazou <ebotcazou@adacore.com>
* tree-vrp.c (extract_range_from_assert): Set the range to VARYING
for LT and GT if the computed range is effectively empty.
2006-05-24 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
PR target/27627 PR target/27627
* pa/pa-modes.def: Use mips_single_format, mips_double_format and * pa/pa-modes.def: Use mips_single_format, mips_double_format and
......
...@@ -939,14 +939,22 @@ extract_range_from_assert (value_range_t *vr_p, tree expr) ...@@ -939,14 +939,22 @@ extract_range_from_assert (value_range_t *vr_p, tree expr)
max = limit_vr->max; max = limit_vr->max;
} }
/* For LT_EXPR, we create the range [MIN, MAX - 1]. */ /* If the maximum value forces us to be out of bounds, simply punt.
if (cond_code == LT_EXPR) It would be pointless to try and do anything more since this
all should be optimized away above us. */
if (cond_code == LT_EXPR && compare_values (max, min) == 0)
set_value_range_to_varying (vr_p);
else
{ {
tree one = build_int_cst (type, 1); /* For LT_EXPR, we create the range [MIN, MAX - 1]. */
max = fold_build2 (MINUS_EXPR, type, max, one); if (cond_code == LT_EXPR)
} {
tree one = build_int_cst (type, 1);
max = fold_build2 (MINUS_EXPR, type, max, one);
}
set_value_range (vr_p, VR_RANGE, min, max, vr_p->equiv); set_value_range (vr_p, VR_RANGE, min, max, vr_p->equiv);
}
} }
else if (cond_code == GE_EXPR || cond_code == GT_EXPR) else if (cond_code == GE_EXPR || cond_code == GT_EXPR)
{ {
...@@ -962,14 +970,22 @@ extract_range_from_assert (value_range_t *vr_p, tree expr) ...@@ -962,14 +970,22 @@ extract_range_from_assert (value_range_t *vr_p, tree expr)
min = limit_vr->min; min = limit_vr->min;
} }
/* For GT_EXPR, we create the range [MIN + 1, MAX]. */ /* If the minimum value forces us to be out of bounds, simply punt.
if (cond_code == GT_EXPR) It would be pointless to try and do anything more since this
all should be optimized away above us. */
if (cond_code == GT_EXPR && compare_values (min, max) == 0)
set_value_range_to_varying (vr_p);
else
{ {
tree one = build_int_cst (type, 1); /* For GT_EXPR, we create the range [MIN + 1, MAX]. */
min = fold_build2 (PLUS_EXPR, type, min, one); if (cond_code == GT_EXPR)
} {
tree one = build_int_cst (type, 1);
min = fold_build2 (PLUS_EXPR, type, min, one);
}
set_value_range (vr_p, VR_RANGE, min, max, vr_p->equiv); set_value_range (vr_p, VR_RANGE, min, max, vr_p->equiv);
}
} }
else else
gcc_unreachable (); gcc_unreachable ();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment