Commit b89e96ac by Steven Bosscher Committed by Steven Bosscher

re PR rtl-optimization/14472 ([tree-ssa] [regression] no sib calling for enum to int functions)

	PR opt/14472
	* tree-tailcall.c (process_assignment): Use STRIP_NOPS to
	ignore type conversions that do not inhibit tail calling.
	(find_tail_calls): Likewise.

From-SVN: r81855
parent 14bc8dc2
2004-05-14 Steven Bosscher <stevenb@suse.de>
PR opt/14472
* tree-tailcall.c (process_assignment): Use STRIP_NOPS to
ignore type conversions that do not inhibit tail calling.
(find_tail_calls): Likewise.
2004-05-14 Jeff Law <law@redhat.com> 2004-05-14 Jeff Law <law@redhat.com>
* tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Reorganize * tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Reorganize
......
...@@ -72,7 +72,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -72,7 +72,7 @@ Boston, MA 02111-1307, USA. */
omit the accumulator. omit the accumulator.
There are three cases how the function may exit. The first one is There are three cases how the function may exit. The first one is
handled in adjust_return_value, the later two in adjust_accumulator_values handled in adjust_return_value, the other two in adjust_accumulator_values
(the second case is actually a special case of the third one and we (the second case is actually a special case of the third one and we
present it separately just for clarity): present it separately just for clarity):
...@@ -260,10 +260,16 @@ process_assignment (tree ass, tree stmt, block_stmt_iterator call, tree *m, ...@@ -260,10 +260,16 @@ process_assignment (tree ass, tree stmt, block_stmt_iterator call, tree *m,
tree dest = TREE_OPERAND (ass, 0); tree dest = TREE_OPERAND (ass, 0);
tree src = TREE_OPERAND (ass, 1); tree src = TREE_OPERAND (ass, 1);
enum tree_code code = TREE_CODE (src); enum tree_code code = TREE_CODE (src);
tree src_var = src;
if (code == SSA_NAME)
/* See if this is a simple copy operation of an SSA name to the function
result. In that case we may have a simple tail call. Ignore type
conversions that can never produce extra code between the function
call and the function return. */
STRIP_NOPS (src_var);
if (TREE_CODE (src_var) == SSA_NAME)
{ {
if (src != *ass_var) if (src_var != *ass_var)
return false; return false;
*ass_var = dest; *ass_var = dest;
...@@ -295,7 +301,7 @@ process_assignment (tree ass, tree stmt, block_stmt_iterator call, tree *m, ...@@ -295,7 +301,7 @@ process_assignment (tree ass, tree stmt, block_stmt_iterator call, tree *m,
else else
return false; return false;
switch (TREE_CODE (src)) switch (code)
{ {
case PLUS_EXPR: case PLUS_EXPR:
/* There should be no previous addition. TODO -- it should be fairly /* There should be no previous addition. TODO -- it should be fairly
...@@ -463,12 +469,15 @@ find_tail_calls (basic_block bb, struct tailcall **ret) ...@@ -463,12 +469,15 @@ find_tail_calls (basic_block bb, struct tailcall **ret)
return; return;
} }
/* See if this is a tail call we can handle. */
ret_var = TREE_OPERAND (stmt, 0); ret_var = TREE_OPERAND (stmt, 0);
if (ret_var if (ret_var
&& TREE_CODE (ret_var) == MODIFY_EXPR) && TREE_CODE (ret_var) == MODIFY_EXPR)
{ {
tree ret_op = TREE_OPERAND (ret_var, 1);
STRIP_NOPS (ret_op);
if (!tail_recursion if (!tail_recursion
&& TREE_CODE (TREE_OPERAND (ret_var, 1)) != SSA_NAME) && TREE_CODE (ret_op) != SSA_NAME)
return; return;
if (!process_assignment (ret_var, stmt, bsi, &m, &a, &ass_var)) if (!process_assignment (ret_var, stmt, bsi, &m, &a, &ass_var))
......
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