Commit 5be891a4 by Richard Guenther Committed by Richard Biener

tree-ssa-pre.c (get_sccvn_value): Create missing VNs via vn_lookup_or_add.

2008-02-29  Richard Guenther  <rguenther@suse.de>

	* tree-ssa-pre.c (get_sccvn_value): Create missing VNs via
	vn_lookup_or_add.
	* tree-ssa-sccnv.c (visit_reference_op_store): Use the rhs
	value for comparing for a store match.
	(simplify_unary_expression): Do nothing for SSA_NAMEs.
	(try_to_simplify): Do not do a full-blown reference lookup.

From-SVN: r132768
parent 0a5fe110
2008-02-29 Richard Guenther <rguenther@suse.de>
* tree-ssa-pre.c (get_sccvn_value): Create missing VNs via
vn_lookup_or_add.
* tree-ssa-sccnv.c (visit_reference_op_store): Use the rhs
value for comparing for a store match.
(simplify_unary_expression): Do nothing for SSA_NAMEs.
(try_to_simplify): Do not do a full-blown reference lookup.
2008-02-29 Kaz Kojima <kkojima@gcc.gnu.org> 2008-02-29 Kaz Kojima <kkojima@gcc.gnu.org>
* config/sh/sh.c (sh_scalar_mode_supported_p): New function. * config/sh/sh.c (sh_scalar_mode_supported_p): New function.
......
...@@ -3256,7 +3256,9 @@ get_sccvn_value (tree name) ...@@ -3256,7 +3256,9 @@ get_sccvn_value (tree name)
!ZERO_SSA_OPERANDS (defstmt2, SSA_OP_ALL_VIRTUALS)) !ZERO_SSA_OPERANDS (defstmt2, SSA_OP_ALL_VIRTUALS))
gcc_assert (defstmt); gcc_assert (defstmt);
} }
valvh = vn_lookup_or_add_with_stmt (val, defstmt); /* We lookup with the LHS, so do not use vn_lookup_or_add_with_stmt
here, as that will result in useless reference lookups. */
valvh = vn_lookup_or_add (val);
} }
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
......
...@@ -1231,6 +1231,8 @@ visit_reference_op_store (tree lhs, tree op, tree stmt) ...@@ -1231,6 +1231,8 @@ visit_reference_op_store (tree lhs, tree op, tree stmt)
{ {
if (TREE_CODE (result) == SSA_NAME) if (TREE_CODE (result) == SSA_NAME)
result = SSA_VAL (result); result = SSA_VAL (result);
if (TREE_CODE (op) == SSA_NAME)
op = SSA_VAL (op);
resultsame = expressions_equal_p (result, op); resultsame = expressions_equal_p (result, op);
} }
...@@ -1527,13 +1529,10 @@ simplify_unary_expression (tree rhs) ...@@ -1527,13 +1529,10 @@ simplify_unary_expression (tree rhs)
static tree static tree
try_to_simplify (tree stmt, tree rhs) try_to_simplify (tree stmt, tree rhs)
{ {
/* For stores we can end up simplifying a SSA_NAME rhs. Just return
in this case, there is no point in doing extra work. */
if (TREE_CODE (rhs) == SSA_NAME) if (TREE_CODE (rhs) == SSA_NAME)
{ return rhs;
if (is_gimple_min_invariant (SSA_VAL (rhs)))
return SSA_VAL (rhs);
else if (VN_INFO (rhs)->has_constants)
return VN_INFO (rhs)->expr;
}
else else
{ {
switch (TREE_CODE_CLASS (TREE_CODE (rhs))) switch (TREE_CODE_CLASS (TREE_CODE (rhs)))
...@@ -1550,13 +1549,11 @@ try_to_simplify (tree stmt, tree rhs) ...@@ -1550,13 +1549,11 @@ try_to_simplify (tree stmt, tree rhs)
/* Fallthrough. */ /* Fallthrough. */
case tcc_reference: case tcc_reference:
{ /* Do not do full-blown reference lookup here.
tree result = vn_reference_lookup (rhs, ??? But like for tcc_declaration, we should simplify
shared_vuses_from_stmt (stmt)); from constant initializers. */
if (result)
return result; /* Fallthrough for some codes that can operate on registers. */
}
/* Fallthrough for some codes. */
if (!(TREE_CODE (rhs) == REALPART_EXPR if (!(TREE_CODE (rhs) == REALPART_EXPR
|| TREE_CODE (rhs) == IMAGPART_EXPR)) || TREE_CODE (rhs) == IMAGPART_EXPR))
break; break;
......
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