Commit 2650da88 by Richard Biener Committed by Richard Biener

tree-vrp.c (vrp_visit_phi_node): Allow a last iteration if the currently…

tree-vrp.c (vrp_visit_phi_node): Allow a last iteration if the currently executable edges have fixed ranges.

2016-08-12  Richard Biener  <rguenther@suse.de>

	* tree-vrp.c (vrp_visit_phi_node): Allow a last iteration if
	the currently executable edges have fixed ranges.  Always
	go through update_value_range.

From-SVN: r239404
parent e366d7d8
2016-08-12 Richard Biener <rguenther@suse.de>
* tree-vrp.c (vrp_visit_phi_node): Allow a last iteration if
the currently executable edges have fixed ranges. Always
go through update_value_range.
2016-08-12 Alexandre Oliva <aoliva@redhat.com>
PR debug/63240
......
......@@ -8725,6 +8725,7 @@ vrp_visit_phi_node (gphi *phi)
print_gimple_stmt (dump_file, phi, 0, dump_flags);
}
bool may_simulate_again = false;
edges = 0;
for (i = 0; i < gimple_phi_num_args (phi); i++)
{
......@@ -8747,6 +8748,12 @@ vrp_visit_phi_node (gphi *phi)
if (TREE_CODE (arg) == SSA_NAME)
{
/* See if we are eventually going to change one of the args. */
gimple *def_stmt = SSA_NAME_DEF_STMT (arg);
if (! gimple_nop_p (def_stmt)
&& prop_simulate_again_p (def_stmt))
may_simulate_again = true;
vr_arg = *(get_value_range (arg));
/* Do not allow equivalences or symbolic ranges to leak in from
backedges. That creates invalid equivalencies.
......@@ -8822,11 +8829,14 @@ vrp_visit_phi_node (gphi *phi)
previous one. We don't do this if we have seen a new executable
edge; this helps us avoid an overflow infinity for conditionals
which are not in a loop. If the old value-range was VR_UNDEFINED
use the updated range and iterate one more time. */
use the updated range and iterate one more time. If we will not
simulate this PHI again with the same number of edges then iterate
one more time. */
if (edges > 0
&& gimple_phi_num_args (phi) > 1
&& edges == old_edges
&& lhs_vr->type != VR_UNDEFINED)
&& lhs_vr->type != VR_UNDEFINED
&& may_simulate_again)
{
/* Compare old and new ranges, fall back to varying if the
values are not comparable. */
......@@ -8880,28 +8890,7 @@ vrp_visit_phi_node (gphi *phi)
goto infinite_check;
}
/* If the new range is different than the previous value, keep
iterating. */
update_range:
if (update_value_range (lhs, &vr_result))
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Found new range for ");
print_generic_expr (dump_file, lhs, 0);
fprintf (dump_file, ": ");
dump_value_range (dump_file, &vr_result);
fprintf (dump_file, "\n");
}
if (vr_result.type == VR_VARYING)
return SSA_PROP_VARYING;
return SSA_PROP_INTERESTING;
}
/* Nothing changed, don't add outgoing edges. */
return SSA_PROP_NOT_INTERESTING;
goto update_range;
varying:
set_value_range_to_varying (&vr_result);
......@@ -8922,11 +8911,32 @@ infinite_check:
if ((vr_result.type == VR_RANGE || vr_result.type == VR_ANTI_RANGE)
&& !((vrp_val_is_max (vr_result.max) && vrp_val_is_min (vr_result.min))
|| compare_values (vr_result.min, vr_result.max) > 0))
goto update_range;
;
else
set_value_range_to_varying (&vr_result);
/* No match found. Set the LHS to VARYING. */
set_value_range_to_varying (lhs_vr);
/* If the new range is different than the previous value, keep
iterating. */
update_range:
if (update_value_range (lhs, &vr_result))
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Found new range for ");
print_generic_expr (dump_file, lhs, 0);
fprintf (dump_file, ": ");
dump_value_range (dump_file, &vr_result);
fprintf (dump_file, "\n");
}
if (vr_result.type == VR_VARYING)
return SSA_PROP_VARYING;
return SSA_PROP_INTERESTING;
}
/* Nothing changed, don't add outgoing edges. */
return SSA_PROP_NOT_INTERESTING;
}
/* Simplify boolean operations if the source is known
......
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