re PR middle-end/42577 (array bounds false positive with -O3, goes away with -O2)

2010-01-02  Richard Guenther  <rguenther@suse.de>

	PR middle-end/42577
	* tree-vrp.c (check_all_array_refs): Skip non-excutable blocks.
	(simplify_switch_using_ranges): Mark to be removed edges
	as non-executable.

From-SVN: r155577
This commit is contained in:
Richard Guenther 2010-01-02 19:14:52 +00:00 committed by Richard Biener
parent 78ce4053fa
commit 1d86f5e9ec
2 changed files with 17 additions and 29 deletions

View File

@ -1,3 +1,10 @@
2010-01-02 Richard Guenther <rguenther@suse.de>
PR middle-end/42577
* tree-vrp.c (check_all_array_refs): Skip non-excutable blocks.
(simplify_switch_using_ranges): Mark to be removed edges
as non-executable.
2010-01-02 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
* config/pa/t-slibgcc-dwarf-ver (SHLIB_SOVERSION): Bump by two.

View File

@ -5122,36 +5122,16 @@ check_all_array_refs (void)
FOR_EACH_BB (bb)
{
/* Skip bb's that are clearly unreachable. */
if (single_pred_p (bb))
{
int i;
bool reachable = true;
edge e2;
edge e = EDGE_PRED (bb, 0);
basic_block pred_bb = e->src;
gimple ls = NULL;
edge_iterator ei;
edge e;
bool executable = false;
for (i = 0; VEC_iterate (edge, to_remove_edges, i, e2); ++i)
if (e == e2)
{
reachable = false;
break;
}
/* Skip blocks that were found to be unreachable. */
FOR_EACH_EDGE (e, ei, bb->preds)
executable |= !!(e->flags & EDGE_EXECUTABLE);
if (!executable)
continue;
if (!reachable)
continue;
if (!gsi_end_p (gsi_last_bb (pred_bb)))
ls = gsi_stmt (gsi_last_bb (pred_bb));
if (ls && gimple_code (ls) == GIMPLE_COND
&& ((gimple_cond_false_p (ls)
&& (EDGE_PRED (bb, 0)->flags & EDGE_TRUE_VALUE))
|| (gimple_cond_true_p (ls)
&& (EDGE_PRED (bb, 0)->flags & EDGE_FALSE_VALUE))))
continue;
}
for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
{
gimple stmt = gsi_stmt (si);
@ -6926,6 +6906,7 @@ simplify_switch_using_ranges (gimple stmt)
fprintf (dump_file, "removing unreachable case label\n");
}
VEC_safe_push (edge, heap, to_remove_edges, e);
e->flags &= ~EDGE_EXECUTABLE;
}
/* And queue an update for the stmt. */
@ -7255,7 +7236,7 @@ vrp_finalize (void)
substitute_and_fold (single_val_range, vrp_fold_stmt);
if (warn_array_bounds)
check_all_array_refs ();
check_all_array_refs ();
/* We must identify jump threading opportunities before we release
the datastructures built by VRP. */