Commit 649caaad by Richard Guenther Committed by Richard Biener

tree-ssa-sccvn.h (vn_reference_lookup): Adjust prototype.

2008-04-15  Richard Guenther  <rguenther@suse.de>

	* tree-ssa-sccvn.h (vn_reference_lookup): Adjust prototype.
	* tree-ssa-sccvn.c (vn_reference_lookup): New parameter maywalk.
	(visit_reference_op_load): Do walk vuse-vdef chains on
	vn_reference_lookup.
	(visit_reference_op_store): But do not here.
	* tree-vn.c (vn_lookup): Do not walk vuse-vdef chains on
	vn_reference_lookup.
	(vn_lookup_with_vuses): But do so here.

From-SVN: r134314
parent 462c31ef
2008-04-15 Richard Guenther <rguenther@suse.de>
* tree-ssa-sccvn.h (vn_reference_lookup): Adjust prototype.
* tree-ssa-sccvn.c (vn_reference_lookup): New parameter maywalk.
(visit_reference_op_load): Do walk vuse-vdef chains on
vn_reference_lookup.
(visit_reference_op_store): But do not here.
* tree-vn.c (vn_lookup): Do not walk vuse-vdef chains on
vn_reference_lookup.
(vn_lookup_with_vuses): But do so here.
2008-04-14 Ian Lance Taylor <iant@google.com> 2008-04-14 Ian Lance Taylor <iant@google.com>
* fold-const.c (fold_overflow_warning): Remove assertion. * fold-const.c (fold_overflow_warning): Remove assertion.
......
...@@ -735,7 +735,7 @@ vn_reference_lookup_1 (vn_reference_t vr) ...@@ -735,7 +735,7 @@ vn_reference_lookup_1 (vn_reference_t vr)
it does not exist in the hash table. */ it does not exist in the hash table. */
tree tree
vn_reference_lookup (tree op, VEC (tree, gc) *vuses) vn_reference_lookup (tree op, VEC (tree, gc) *vuses, bool maywalk)
{ {
struct vn_reference_s vr1; struct vn_reference_s vr1;
tree result, def_stmt; tree result, def_stmt;
...@@ -748,6 +748,7 @@ vn_reference_lookup (tree op, VEC (tree, gc) *vuses) ...@@ -748,6 +748,7 @@ vn_reference_lookup (tree op, VEC (tree, gc) *vuses)
/* If there is a single defining statement for all virtual uses, we can /* If there is a single defining statement for all virtual uses, we can
use that, following virtual use-def chains. */ use that, following virtual use-def chains. */
if (!result if (!result
&& maywalk
&& vr1.vuses && vr1.vuses
&& VEC_length (tree, vr1.vuses) >= 1 && VEC_length (tree, vr1.vuses) >= 1
&& !get_call_expr_in (op) && !get_call_expr_in (op)
...@@ -1188,7 +1189,7 @@ static bool ...@@ -1188,7 +1189,7 @@ static bool
visit_reference_op_load (tree lhs, tree op, tree stmt) visit_reference_op_load (tree lhs, tree op, tree stmt)
{ {
bool changed = false; bool changed = false;
tree result = vn_reference_lookup (op, shared_vuses_from_stmt (stmt)); tree result = vn_reference_lookup (op, shared_vuses_from_stmt (stmt), true);
/* We handle type-punning through unions by value-numbering based /* We handle type-punning through unions by value-numbering based
on offset and size of the access. Be prepared to handle a on offset and size of the access. Be prepared to handle a
...@@ -1294,7 +1295,7 @@ visit_reference_op_store (tree lhs, tree op, tree stmt) ...@@ -1294,7 +1295,7 @@ visit_reference_op_store (tree lhs, tree op, tree stmt)
Otherwise, the vdefs for the store are used when inserting into Otherwise, the vdefs for the store are used when inserting into
the table, since the store generates a new memory state. */ the table, since the store generates a new memory state. */
result = vn_reference_lookup (lhs, shared_vuses_from_stmt (stmt)); result = vn_reference_lookup (lhs, shared_vuses_from_stmt (stmt), false);
if (result) if (result)
{ {
......
...@@ -59,7 +59,7 @@ void free_scc_vn (void); ...@@ -59,7 +59,7 @@ void free_scc_vn (void);
void switch_to_PRE_table (void); void switch_to_PRE_table (void);
tree vn_nary_op_lookup (tree); tree vn_nary_op_lookup (tree);
void vn_nary_op_insert (tree, tree); void vn_nary_op_insert (tree, tree);
tree vn_reference_lookup (tree, VEC (tree, gc) *); tree vn_reference_lookup (tree, VEC (tree, gc) *, bool);
void vn_reference_insert (tree, tree, VEC (tree, gc) *); void vn_reference_insert (tree, tree, VEC (tree, gc) *);
VEC (tree, gc) *shared_vuses_from_stmt (tree); VEC (tree, gc) *shared_vuses_from_stmt (tree);
VEC (tree, gc) *copy_vuses_from_stmt (tree); VEC (tree, gc) *copy_vuses_from_stmt (tree);
......
...@@ -255,7 +255,7 @@ vn_lookup (tree expr) ...@@ -255,7 +255,7 @@ vn_lookup (tree expr)
/* In the case of array-refs of constants, for example, we can /* In the case of array-refs of constants, for example, we can
end up with no vuses. */ end up with no vuses. */
case tcc_reference: case tcc_reference:
return vn_reference_lookup (expr, NULL); return vn_reference_lookup (expr, NULL, false);
break; break;
/* It is possible to have CALL_EXPR with no vuses for things /* It is possible to have CALL_EXPR with no vuses for things
like "cos", and these will fall into vn_lookup. */ like "cos", and these will fall into vn_lookup. */
...@@ -264,7 +264,7 @@ vn_lookup (tree expr) ...@@ -264,7 +264,7 @@ vn_lookup (tree expr)
case tcc_expression: case tcc_expression:
case tcc_declaration: case tcc_declaration:
if (TREE_CODE (expr) == CALL_EXPR || DECL_P (expr)) if (TREE_CODE (expr) == CALL_EXPR || DECL_P (expr))
return vn_reference_lookup (expr, NULL); return vn_reference_lookup (expr, NULL, false);
else if (TREE_CODE (expr) == SSA_NAME) else if (TREE_CODE (expr) == SSA_NAME)
return SSA_NAME_VALUE (expr); return SSA_NAME_VALUE (expr);
else if (TREE_CODE (expr) == ADDR_EXPR) else if (TREE_CODE (expr) == ADDR_EXPR)
...@@ -308,7 +308,7 @@ vn_lookup_with_vuses (tree expr, VEC (tree, gc) *vuses) ...@@ -308,7 +308,7 @@ vn_lookup_with_vuses (tree expr, VEC (tree, gc) *vuses)
if (is_gimple_min_invariant (expr) || TREE_CODE (expr) == FIELD_DECL) if (is_gimple_min_invariant (expr) || TREE_CODE (expr) == FIELD_DECL)
return expr; return expr;
return vn_reference_lookup (expr, vuses); return vn_reference_lookup (expr, vuses, true);
} }
static tree static tree
......
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