Commit 209b636e by Richard Biener Committed by Richard Biener

re PR tree-optimization/77479 (Compile time hog w/ -O2 (-Os))

2016-09-06  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/77479
	* tree-vrp.c (update_value_range): Extend overflow handling to
	VARYING.

	* gcc.dg/torture/pr77479.c: New testcase.

From-SVN: r240007
parent b772a565
2016-09-06 Richard Biener <rguenther@suse.de>
PR tree-optimization/77479
* tree-vrp.c (update_value_range): Extend overflow handling to
VARYING.
2016-09-05 Jakub Jelinek <jakub@redhat.com> 2016-09-05 Jakub Jelinek <jakub@redhat.com>
PR target/77476 PR target/77476
......
2016-09-06 Richard Biener <rguenther@suse.de> 2016-09-06 Richard Biener <rguenther@suse.de>
PR tree-optimization/77479
* gcc.dg/torture/pr77479.c: New testcase.
2016-09-06 Richard Biener <rguenther@suse.de>
PR c/77450 PR c/77450
* c-c++-common/vector-subscript-7.c: Adjust. * c-c++-common/vector-subscript-7.c: Adjust.
* c-c++-common/vector-subscript-8.c: New testcase. * c-c++-common/vector-subscript-8.c: New testcase.
......
/* { dg-do compile } */
/* { dg-additional-options "-fstrict-overflow -ftree-vrp" } */
void
vr (int of, unsigned char bw)
{
int d1;
int lm = 0;
for (d1 = 0; d1 < 3; ++d1)
{
const int vl = 2;
while (bw < vl)
{
}
if (bw != vl)
lm -= vl;
}
while (++of < 1)
{
lm /= bw;
of += lm;
}
}
...@@ -744,23 +744,29 @@ update_value_range (const_tree var, value_range *new_vr) ...@@ -744,23 +744,29 @@ update_value_range (const_tree var, value_range *new_vr)
value_range_type rtype = get_range_info (var, &min, &max); value_range_type rtype = get_range_info (var, &min, &max);
if (rtype == VR_RANGE || rtype == VR_ANTI_RANGE) if (rtype == VR_RANGE || rtype == VR_ANTI_RANGE)
{ {
value_range nr; tree nr_min, nr_max;
nr.type = rtype;
/* Range info on SSA names doesn't carry overflow information /* Range info on SSA names doesn't carry overflow information
so make sure to preserve the overflow bit on the lattice. */ so make sure to preserve the overflow bit on the lattice. */
if (new_vr->type == VR_RANGE if (rtype == VR_RANGE
&& is_negative_overflow_infinity (new_vr->min) && needs_overflow_infinity (TREE_TYPE (var))
&& wi::eq_p (new_vr->min, min)) && (new_vr->type == VR_VARYING
nr.min = new_vr->min; || (new_vr->type == VR_RANGE
&& is_negative_overflow_infinity (new_vr->min)))
&& wi::eq_p (vrp_val_min (TREE_TYPE (var)), min))
nr_min = negative_overflow_infinity (TREE_TYPE (var));
else else
nr.min = wide_int_to_tree (TREE_TYPE (var), min); nr_min = wide_int_to_tree (TREE_TYPE (var), min);
if (new_vr->type == VR_RANGE if (rtype == VR_RANGE
&& is_positive_overflow_infinity (new_vr->max) && needs_overflow_infinity (TREE_TYPE (var))
&& wi::eq_p (new_vr->max, max)) && (new_vr->type == VR_VARYING
nr.max = new_vr->max; || (new_vr->type == VR_RANGE
&& is_positive_overflow_infinity (new_vr->max)))
&& wi::eq_p (vrp_val_max (TREE_TYPE (var)), max))
nr_max = positive_overflow_infinity (TREE_TYPE (var));
else else
nr.max = wide_int_to_tree (TREE_TYPE (var), max); nr_max = wide_int_to_tree (TREE_TYPE (var), max);
nr.equiv = NULL; value_range nr = VR_INITIALIZER;
set_and_canonicalize_value_range (&nr, rtype, nr_min, nr_max, NULL);
vrp_intersect_ranges (new_vr, &nr); vrp_intersect_ranges (new_vr, &nr);
} }
} }
......
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