Commit 32dba5ef by Richard Guenther Committed by Richard Biener

tree-ssa-sccvn.c (visit_use): CSE stmt pieces and simplify matching.

2011-09-06  Richard Guenther  <rguenther@suse.de>

	* tree-ssa-sccvn.c (visit_use): CSE stmt pieces and simplify
	matching.

From-SVN: r178584
parent ba759acd
2011-09-06 Richard Guenther <rguenther@suse.de>
* tree-ssa-sccvn.c (visit_use): CSE stmt pieces and simplify
matching.
2011-09-06 Tom de Vries <tom@codesourcery.com> 2011-09-06 Tom de Vries <tom@codesourcery.com>
* recog.c (asm_labels_ok): New function. * recog.c (asm_labels_ok): New function.
...@@ -3043,16 +3043,17 @@ visit_use (tree use) ...@@ -3043,16 +3043,17 @@ visit_use (tree use)
changed = defs_to_varying (stmt); changed = defs_to_varying (stmt);
else if (is_gimple_assign (stmt)) else if (is_gimple_assign (stmt))
{ {
enum tree_code code = gimple_assign_rhs_code (stmt);
tree lhs = gimple_assign_lhs (stmt); tree lhs = gimple_assign_lhs (stmt);
tree rhs1 = gimple_assign_rhs1 (stmt);
tree simplified; tree simplified;
/* Shortcut for copies. Simplifying copies is pointless, /* Shortcut for copies. Simplifying copies is pointless,
since we copy the expression and value they represent. */ since we copy the expression and value they represent. */
if (gimple_assign_copy_p (stmt) if (code == SSA_NAME
&& TREE_CODE (gimple_assign_rhs1 (stmt)) == SSA_NAME
&& TREE_CODE (lhs) == SSA_NAME) && TREE_CODE (lhs) == SSA_NAME)
{ {
changed = visit_copy (lhs, gimple_assign_rhs1 (stmt)); changed = visit_copy (lhs, rhs1);
goto done; goto done;
} }
simplified = try_to_simplify (stmt); simplified = try_to_simplify (stmt);
...@@ -3119,24 +3120,22 @@ visit_use (tree use) ...@@ -3119,24 +3120,22 @@ visit_use (tree use)
/* We can substitute SSA_NAMEs that are live over /* We can substitute SSA_NAMEs that are live over
abnormal edges with their constant value. */ abnormal edges with their constant value. */
&& !(gimple_assign_copy_p (stmt) && !(gimple_assign_copy_p (stmt)
&& is_gimple_min_invariant (gimple_assign_rhs1 (stmt))) && is_gimple_min_invariant (rhs1))
&& !(simplified && !(simplified
&& is_gimple_min_invariant (simplified)) && is_gimple_min_invariant (simplified))
&& SSA_NAME_OCCURS_IN_ABNORMAL_PHI (lhs)) && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (lhs))
/* Stores or copies from SSA_NAMEs that are live over /* Stores or copies from SSA_NAMEs that are live over
abnormal edges are a problem. */ abnormal edges are a problem. */
|| (gimple_assign_single_p (stmt) || (code == SSA_NAME
&& TREE_CODE (gimple_assign_rhs1 (stmt)) == SSA_NAME && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rhs1)))
&& SSA_NAME_OCCURS_IN_ABNORMAL_PHI (gimple_assign_rhs1 (stmt))))
changed = defs_to_varying (stmt); changed = defs_to_varying (stmt);
else if (REFERENCE_CLASS_P (lhs) || DECL_P (lhs)) else if (REFERENCE_CLASS_P (lhs)
{ || DECL_P (lhs))
changed = visit_reference_op_store (lhs, gimple_assign_rhs1 (stmt), stmt); changed = visit_reference_op_store (lhs, rhs1, stmt);
}
else if (TREE_CODE (lhs) == SSA_NAME) else if (TREE_CODE (lhs) == SSA_NAME)
{ {
if ((gimple_assign_copy_p (stmt) if ((gimple_assign_copy_p (stmt)
&& is_gimple_min_invariant (gimple_assign_rhs1 (stmt))) && is_gimple_min_invariant (rhs1))
|| (simplified || (simplified
&& is_gimple_min_invariant (simplified))) && is_gimple_min_invariant (simplified)))
{ {
...@@ -3144,11 +3143,11 @@ visit_use (tree use) ...@@ -3144,11 +3143,11 @@ visit_use (tree use)
if (simplified) if (simplified)
changed = set_ssa_val_to (lhs, simplified); changed = set_ssa_val_to (lhs, simplified);
else else
changed = set_ssa_val_to (lhs, gimple_assign_rhs1 (stmt)); changed = set_ssa_val_to (lhs, rhs1);
} }
else else
{ {
switch (get_gimple_rhs_class (gimple_assign_rhs_code (stmt))) switch (get_gimple_rhs_class (code))
{ {
case GIMPLE_UNARY_RHS: case GIMPLE_UNARY_RHS:
case GIMPLE_BINARY_RHS: case GIMPLE_BINARY_RHS:
...@@ -3156,25 +3155,24 @@ visit_use (tree use) ...@@ -3156,25 +3155,24 @@ visit_use (tree use)
changed = visit_nary_op (lhs, stmt); changed = visit_nary_op (lhs, stmt);
break; break;
case GIMPLE_SINGLE_RHS: case GIMPLE_SINGLE_RHS:
switch (TREE_CODE_CLASS (gimple_assign_rhs_code (stmt))) switch (TREE_CODE_CLASS (code))
{ {
case tcc_reference: case tcc_reference:
/* VOP-less references can go through unary case. */ /* VOP-less references can go through unary case. */
if ((gimple_assign_rhs_code (stmt) == REALPART_EXPR if ((code == REALPART_EXPR
|| gimple_assign_rhs_code (stmt) == IMAGPART_EXPR || code == IMAGPART_EXPR
|| gimple_assign_rhs_code (stmt) == VIEW_CONVERT_EXPR) || code == VIEW_CONVERT_EXPR)
&& TREE_CODE (TREE_OPERAND (gimple_assign_rhs1 (stmt), 0)) == SSA_NAME) && TREE_CODE (TREE_OPERAND (rhs1, 0)) == SSA_NAME)
{ {
changed = visit_nary_op (lhs, stmt); changed = visit_nary_op (lhs, stmt);
break; break;
} }
/* Fallthrough. */ /* Fallthrough. */
case tcc_declaration: case tcc_declaration:
changed = visit_reference_op_load changed = visit_reference_op_load (lhs, rhs1, stmt);
(lhs, gimple_assign_rhs1 (stmt), stmt);
break; break;
case tcc_expression: case tcc_expression:
if (gimple_assign_rhs_code (stmt) == ADDR_EXPR) if (code == ADDR_EXPR)
{ {
changed = visit_nary_op (lhs, stmt); changed = visit_nary_op (lhs, stmt);
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