Commit 3d3fa3a1 by Daniel Berlin Committed by Daniel Berlin

tree-ssa-pre.c (reference_node_pool): New pool.

2004-07-06  Daniel Berlin  <dberlin@dberlin.org>

	* tree-ssa-pre.c (reference_node_pool): New pool.
	(find_or_generate_expression): Class 'r' is okay too.
	(create_value_expr_from): Ditto.
	(add_to_sets): LHS should not include vuses.
	(eliminate): Ditto.
	(compute_avail): Reverse ordering of tests.
	Valuize INDIRECT_REF as well.

From-SVN: r84164
parent 60e20b90
2004-07-06 Daniel Berlin <dberlin@dberlin.org>
* tree-ssa-pre.c (reference_node_pool): New pool.
(find_or_generate_expression): Class 'r' is okay too.
(create_value_expr_from): Ditto.
(add_to_sets): LHS should not include vuses.
(eliminate): Ditto.
(compute_avail): Reverse ordering of tests.
Valuize INDIRECT_REF as well.
2004-07-06 Richard Sandiford <rsandifo@redhat.com> 2004-07-06 Richard Sandiford <rsandifo@redhat.com>
PR rtl-optimization/16380 PR rtl-optimization/16380
......
...@@ -305,6 +305,7 @@ static alloc_pool bitmap_set_pool; ...@@ -305,6 +305,7 @@ static alloc_pool bitmap_set_pool;
static alloc_pool value_set_node_pool; static alloc_pool value_set_node_pool;
static alloc_pool binary_node_pool; static alloc_pool binary_node_pool;
static alloc_pool unary_node_pool; static alloc_pool unary_node_pool;
static alloc_pool reference_node_pool;
/* The phi_translate_table caches phi translations for a given /* The phi_translate_table caches phi translations for a given
expression and predecessor. */ expression and predecessor. */
...@@ -1294,7 +1295,8 @@ find_or_generate_expression (basic_block block, tree expr, tree stmts) ...@@ -1294,7 +1295,8 @@ find_or_generate_expression (basic_block block, tree expr, tree stmts)
{ {
genop = VALUE_HANDLE_EXPR_SET (expr)->head->expr; genop = VALUE_HANDLE_EXPR_SET (expr)->head->expr;
if (TREE_CODE_CLASS (TREE_CODE (genop)) != '1' if (TREE_CODE_CLASS (TREE_CODE (genop)) != '1'
&& TREE_CODE_CLASS (TREE_CODE (genop)) != '2') && TREE_CODE_CLASS (TREE_CODE (genop)) != '2'
&& TREE_CODE_CLASS (TREE_CODE (genop)) != 'r')
abort (); abort ();
genop = create_expression_by_pieces (block, genop, stmts); genop = create_expression_by_pieces (block, genop, stmts);
} }
...@@ -1640,7 +1642,7 @@ add_to_sets (tree var, tree expr, vuse_optype vuses, bitmap_set_t s1, ...@@ -1640,7 +1642,7 @@ add_to_sets (tree var, tree expr, vuse_optype vuses, bitmap_set_t s1,
statements that make aliased stores). In those cases, we are statements that make aliased stores). In those cases, we are
only interested in making VAR available as its own value. */ only interested in making VAR available as its own value. */
if (var != expr) if (var != expr)
vn_add (var, val, vuses); vn_add (var, val, NULL);
bitmap_insert_into_set (s1, var); bitmap_insert_into_set (s1, var);
bitmap_value_insert_into_set (s2, var); bitmap_value_insert_into_set (s2, var);
...@@ -1664,12 +1666,15 @@ create_value_expr_from (tree expr, basic_block block, vuse_optype vuses) ...@@ -1664,12 +1666,15 @@ create_value_expr_from (tree expr, basic_block block, vuse_optype vuses)
#if defined ENABLE_CHECKING #if defined ENABLE_CHECKING
if (TREE_CODE_CLASS (code) != '1' if (TREE_CODE_CLASS (code) != '1'
&& TREE_CODE_CLASS (code) != '2') && TREE_CODE_CLASS (code) != '2'
&& TREE_CODE_CLASS (code) != 'r')
abort (); abort ();
#endif #endif
if (TREE_CODE_CLASS (code) == '1') if (TREE_CODE_CLASS (code) == '1')
vexpr = pool_alloc (unary_node_pool); vexpr = pool_alloc (unary_node_pool);
else if (TREE_CODE_CLASS (code) == 'r')
vexpr = pool_alloc (reference_node_pool);
else else
vexpr = pool_alloc (binary_node_pool); vexpr = pool_alloc (binary_node_pool);
...@@ -1770,9 +1775,23 @@ compute_avail (basic_block block) ...@@ -1770,9 +1775,23 @@ compute_avail (basic_block block)
vuse_optype vuses = STMT_VUSE_OPS (stmt); vuse_optype vuses = STMT_VUSE_OPS (stmt);
STRIP_USELESS_TYPE_CONVERSION (rhs); STRIP_USELESS_TYPE_CONVERSION (rhs);
if (TREE_CODE (rhs) == SSA_NAME
if (TREE_CODE_CLASS (TREE_CODE (rhs)) == '1' || is_gimple_min_invariant (rhs))
|| TREE_CODE_CLASS (TREE_CODE (rhs)) == '2') {
/* Compute a value number for the RHS of the statement
and add its value to the AVAIL_OUT set for the block.
Add the LHS to TMP_GEN. */
add_to_sets (lhs, rhs, vuses, TMP_GEN (block),
AVAIL_OUT (block));
if (TREE_CODE (rhs) == SSA_NAME
&& !is_undefined_value (rhs))
value_insert_into_set (EXP_GEN (block), rhs);
continue;
}
else if (TREE_CODE_CLASS (TREE_CODE (rhs)) == '1'
|| TREE_CODE_CLASS (TREE_CODE (rhs)) == '2'
|| TREE_CODE (rhs) == INDIRECT_REF)
{ {
/* For binary, unary, and reference expressions, /* For binary, unary, and reference expressions,
create a duplicate expression with the operands create a duplicate expression with the operands
...@@ -1784,20 +1803,6 @@ compute_avail (basic_block block) ...@@ -1784,20 +1803,6 @@ compute_avail (basic_block block)
value_insert_into_set (EXP_GEN (block), newt); value_insert_into_set (EXP_GEN (block), newt);
continue; continue;
} }
else if (TREE_CODE (rhs) == SSA_NAME
|| is_gimple_min_invariant (rhs))
{
/* Compute a value number for the RHS of the statement
and add its value to the AVAIL_OUT set for the block.
Add the LHS to TMP_GEN. */
add_to_sets (lhs, rhs, vuses, TMP_GEN (block),
AVAIL_OUT (block));
if (TREE_CODE (rhs) == SSA_NAME
&& !is_undefined_value (rhs))
value_insert_into_set (EXP_GEN (block), rhs);
continue;
}
} }
/* For any other statement that we don't recognize, simply /* For any other statement that we don't recognize, simply
...@@ -1854,9 +1859,9 @@ eliminate (void) ...@@ -1854,9 +1859,9 @@ eliminate (void)
tree lhs = TREE_OPERAND (stmt, 0); tree lhs = TREE_OPERAND (stmt, 0);
tree *rhs_p = &TREE_OPERAND (stmt, 1); tree *rhs_p = &TREE_OPERAND (stmt, 1);
tree sprime; tree sprime;
vuse_optype vuses = STMT_VUSE_OPS (stmt);
sprime = bitmap_find_leader (AVAIL_OUT (b), vn_lookup (lhs, vuses)); sprime = bitmap_find_leader (AVAIL_OUT (b),
vn_lookup (lhs, NULL));
if (sprime if (sprime
&& sprime != lhs && sprime != lhs
&& (TREE_CODE (*rhs_p) != SSA_NAME && (TREE_CODE (*rhs_p) != SSA_NAME
...@@ -1911,7 +1916,8 @@ init_pre (void) ...@@ -1911,7 +1916,8 @@ init_pre (void)
binary_node_pool = create_alloc_pool ("Binary tree nodes", tsize, 30); binary_node_pool = create_alloc_pool ("Binary tree nodes", tsize, 30);
tsize = tree_size (build1 (NEGATE_EXPR, void_type_node, NULL_TREE)); tsize = tree_size (build1 (NEGATE_EXPR, void_type_node, NULL_TREE));
unary_node_pool = create_alloc_pool ("Unary tree nodes", tsize, 30); unary_node_pool = create_alloc_pool ("Unary tree nodes", tsize, 30);
tsize = tree_size (build (COMPONENT_REF, void_type_node, NULL_TREE, NULL_TREE, NULL_TREE));
reference_node_pool = create_alloc_pool ("Reference tree nodes", tsize, 30);
FOR_ALL_BB (bb) FOR_ALL_BB (bb)
{ {
EXP_GEN (bb) = set_new (true); EXP_GEN (bb) = set_new (true);
...@@ -1933,6 +1939,7 @@ fini_pre (void) ...@@ -1933,6 +1939,7 @@ fini_pre (void)
free_alloc_pool (bitmap_set_pool); free_alloc_pool (bitmap_set_pool);
free_alloc_pool (value_set_node_pool); free_alloc_pool (value_set_node_pool);
free_alloc_pool (binary_node_pool); free_alloc_pool (binary_node_pool);
free_alloc_pool (reference_node_pool);
free_alloc_pool (unary_node_pool); free_alloc_pool (unary_node_pool);
htab_delete (phi_translate_table); htab_delete (phi_translate_table);
......
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