re PR tree-optimization/88217 (Compile time and memory hog w/ -O2 -fstrict-enums -fno-tree-forwprop -fno-tree-fre)

2018-11-28  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/88217
	* vr-values.c (vr_values::extract_range_from_phi_node): Make
	sure to handle results > +INF and < -INF correctly when
	trying to drop down to +INF - 1 or -INF + 1.

	* g++.dg/pr88217.C: New testcase.

From-SVN: r266557
This commit is contained in:
Richard Biener 2018-11-28 13:04:27 +00:00 committed by Richard Biener
parent 20f65b5607
commit a257ad4668
4 changed files with 34 additions and 2 deletions

View File

@ -1,3 +1,10 @@
2018-11-28 Richard Biener <rguenther@suse.de>
PR tree-optimization/88217
* vr-values.c (vr_values::extract_range_from_phi_node): Make
sure to handle results > +INF and < -INF correctly when
trying to drop down to +INF - 1 or -INF + 1.
2018-11-28 Alan Modra <amodra@gmail.com>
* xcoffout.c (do_block): Signed/unsigned warning fix.

View File

@ -1,3 +1,8 @@
2018-11-28 Richard Biener <rguenther@suse.de>
PR tree-optimization/88217
* g++.dg/pr88217.C: New testcase.
2018-11-28 Richard Biener <rguenther@suse.de>
PR tree-optimization/79351

View File

@ -0,0 +1,18 @@
// { dg-do compile { target c++11 } }
// { dg-options "-O2 -fstrict-enums -fno-tree-forwprop -fno-tree-fre" }
extern "C" int printf (const char *, ...);
enum E { e1, e2, e3, X };
E operator*(E e) { return e; }
E begin(E e) { return e; }
E end(E e) { return X; }
E operator++(E& e) { return e = E(e+1); }
int main()
{
for (auto e: e1)
{
printf ("%d ", e);
}
}

View File

@ -2857,7 +2857,8 @@ 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
&& !vrp_val_is_min (vr_result->min ()))
&& 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));
@ -2866,7 +2867,8 @@ 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
&& !vrp_val_is_max (vr_result->max ()))
&& 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));