Commit 9fabf0d4 by Diego Novillo Committed by Diego Novillo

re PR tree-optimization/20920 (ICE with eh and VRP)


	PR tree-optimization/20920
	* tree-pretty-print.c (dump_generic_node): Show '(ab)' if an
	SSA_NAME flows through an abnormal edge.
	* tree-vrp.c (infer_value_range): Ignore SSA names that flow
	through abnormal edges.
	(maybe_add_assert_expr): Likewise.

	PR tree-optimization/20920
	* g++.dg/tree-ssa/pr20920.C: New test.

From-SVN: r97971
parent f5db779b
2005-04-11 Diego Novillo <dnovillo@redhat.com>
PR tree-optimization/20920
* tree-pretty-print.c (dump_generic_node): Show '(ab)' if an
SSA_NAME flows through an abnormal edge.
* tree-vrp.c (infer_value_range): Ignore SSA names that flow
through abnormal edges.
(maybe_add_assert_expr): Likewise.
2005-04-11 Richard Sandiford <rsandifo@redhat.com> 2005-04-11 Richard Sandiford <rsandifo@redhat.com>
* config/s390/s390.h (s390_tune_string, s390_arch_string) * config/s390/s390.h (s390_tune_string, s390_arch_string)
......
2005-04-11 Diego Novillo <dnovillo@redhat.com>
PR tree-optimization/20920
* g++.dg/tree-ssa/pr20920.C: New test.
2005-04-11 Uros Bizjak <uros@kss-loka.si> 2005-04-11 Uros Bizjak <uros@kss-loka.si>
* gcc.dg/builtins-53.c: Also check (int)ceil* and * gcc.dg/builtins-53.c: Also check (int)ceil* and
......
/* { dg-do compile } */
/* { dg-options "-O2" } */
/* This was causing a failure in the out of SSA pass because VRP was
trying to insert assertions for SSA names that flow through
abnormal edges. */
void f(int) __attribute__((__noreturn__));
int d(const char *);
char * j ();
char *
foo (int x)
{
char *path = __null;
try
{
path = j ();
if (path != __null)
if (d (path) != 0)
f (127);
f (127);
}
catch (...) { }
return path;
}
...@@ -1416,6 +1416,8 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags, ...@@ -1416,6 +1416,8 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
dump_generic_node (buffer, SSA_NAME_VAR (node), spc, flags, false); dump_generic_node (buffer, SSA_NAME_VAR (node), spc, flags, false);
pp_string (buffer, "_"); pp_string (buffer, "_");
pp_decimal_int (buffer, SSA_NAME_VERSION (node)); pp_decimal_int (buffer, SSA_NAME_VERSION (node));
if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node))
pp_string (buffer, "(ab)");
break; break;
case WITH_SIZE_EXPR: case WITH_SIZE_EXPR:
......
...@@ -1280,6 +1280,11 @@ fp_predicate (tree expr) ...@@ -1280,6 +1280,11 @@ fp_predicate (tree expr)
static tree static tree
infer_value_range (tree stmt, tree op) infer_value_range (tree stmt, tree op)
{ {
/* Do not attempt to infer anything in names that flow through
abnormal edges. */
if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (op))
return NULL_TREE;
if (POINTER_TYPE_P (TREE_TYPE (op))) if (POINTER_TYPE_P (TREE_TYPE (op)))
{ {
bool is_store; bool is_store;
...@@ -1385,7 +1390,7 @@ has_assert_expr (tree op, tree cond) ...@@ -1385,7 +1390,7 @@ has_assert_expr (tree op, tree cond)
d) Mark X and Y in FOUND. d) Mark X and Y in FOUND.
3- If BB does not end in a conditional expression, then we recurse 4- If BB does not end in a conditional expression, then we recurse
into BB's dominator children. into BB's dominator children.
At the end of the recursive traversal, ASSERT_EXPRs will have been At the end of the recursive traversal, ASSERT_EXPRs will have been
...@@ -1441,7 +1446,7 @@ maybe_add_assert_expr (basic_block bb) ...@@ -1441,7 +1446,7 @@ maybe_add_assert_expr (basic_block bb)
if (!cond) if (!cond)
continue; continue;
/* Step 3. If OP is used in such a way that we can infer a /* Step 2. If OP is used in such a way that we can infer a
value range for it, create a new ASSERT_EXPR for OP value range for it, create a new ASSERT_EXPR for OP
(unless OP already has an ASSERT_EXPR). */ (unless OP already has an ASSERT_EXPR). */
gcc_assert (!is_ctrl_stmt (stmt)); gcc_assert (!is_ctrl_stmt (stmt));
...@@ -1504,6 +1509,12 @@ maybe_add_assert_expr (basic_block bb) ...@@ -1504,6 +1509,12 @@ maybe_add_assert_expr (basic_block bb)
sub-graphs or if they had been found in a block upstream from sub-graphs or if they had been found in a block upstream from
BB. */ BB. */
op = USE_OP (uses, 0); op = USE_OP (uses, 0);
/* Do not attempt to infer anything in names that flow through
abnormal edges. */
if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (op))
return false;
RESET_BIT (found, SSA_NAME_VERSION (op)); RESET_BIT (found, SSA_NAME_VERSION (op));
/* Look for uses of the operands in each of the sub-graphs /* Look for uses of the operands in each of the sub-graphs
...@@ -1546,7 +1557,7 @@ maybe_add_assert_expr (basic_block bb) ...@@ -1546,7 +1557,7 @@ maybe_add_assert_expr (basic_block bb)
} }
else else
{ {
/* Step 3. Recurse into the dominator children of BB. */ /* Step 4. Recurse into the dominator children of BB. */
basic_block son; basic_block son;
for (son = first_dom_son (CDI_DOMINATORS, bb); for (son = first_dom_son (CDI_DOMINATORS, bb);
......
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