Commit a58eeb31 by Nathan Sidwell

tree-tailcall.c (tree_optimize_tail_calls_1): Use fold_convert, reverting my…

tree-tailcall.c (tree_optimize_tail_calls_1): Use fold_convert, reverting my 2004-09-07 patch to use build_int_cst.

.:	* tree-tailcall.c (tree_optimize_tail_calls_1): Use fold_convert,
	reverting my 2004-09-07 patch to use build_int_cst.
testsuite:
	* gcc.c-torture/compile/acc1.c: New.

From-SVN: r88759
parent 8d488306
2004-10-08 Nathan Sidwell <nathan@codesourcery.com>
* tree-tailcall.c (tree_optimize_tail_calls_1): Use fold_convert,
reverting my 2004-09-07 patch to use build_int_cst.
2004-10-08 Eric Botcazou <ebotcazou@libertysurf.fr> 2004-10-08 Eric Botcazou <ebotcazou@libertysurf.fr>
PR target/17245 PR target/17245
......
2004-10-08 Nathan Sidwell <nathan@codesourcery.com>
* gcc.c-torture/compile/acc1.c: New.
2004-10-08 Andrew Pinski <pinskia@physics.uc.edu> 2004-10-08 Andrew Pinski <pinskia@physics.uc.edu>
* gcc.dg/darwin-longdouble.c: Include stdlib.h and string.h. * gcc.dg/darwin-longdouble.c: Include stdlib.h and string.h.
...@@ -22329,7 +22333,7 @@ Thu Apr 27 15:58:18 MET DST 2000 Jan Hubicka <jh@suse.cz> ...@@ -22329,7 +22333,7 @@ Thu Apr 27 15:58:18 MET DST 2000 Jan Hubicka <jh@suse.cz>
* gcc.c-torture/compile/labels-2.c: New test. * gcc.c-torture/compile/labels-2.c: New test.
1999-12-27 Martin von Löwis <loewis@informatik.hu-berlin.de> 1999-12-27 Martin von Lwis <loewis@informatik.hu-berlin.de>
* gcc.c-torture/execute/991227-1.c: New test. * gcc.c-torture/execute/991227-1.c: New test.
...@@ -22337,7 +22341,7 @@ Thu Apr 27 15:58:18 MET DST 2000 Jan Hubicka <jh@suse.cz> ...@@ -22337,7 +22341,7 @@ Thu Apr 27 15:58:18 MET DST 2000 Jan Hubicka <jh@suse.cz>
* g++.old-deja/g++.pt/instantiate6.C: Remove excess errors XFAIL. * g++.old-deja/g++.pt/instantiate6.C: Remove excess errors XFAIL.
1999-12-21 Martin von Löwis <loewis@informatik.hu-berlin.de> 1999-12-21 Martin von Lwis <loewis@informatik.hu-berlin.de>
* gcc.c-torture/execute/991221-1.c: New test. * gcc.c-torture/execute/991221-1.c: New test.
......
/* { dg-options "-O2 -ffast-math" } */
/* Fast maths allows tail recursion to be turned into iteration. */
double
foo (int n, double f)
{
if (n == 0)
return f;
else
return f + foo (n - 1, f);
}
double
bar (int n, double f)
{
if (n == 0)
return f;
else
return f * bar (n - 1, f);
}
...@@ -896,7 +896,11 @@ tree_optimize_tail_calls_1 (bool opt_tailcalls) ...@@ -896,7 +896,11 @@ tree_optimize_tail_calls_1 (bool opt_tailcalls)
add_referenced_tmp_var (tmp); add_referenced_tmp_var (tmp);
phi = create_phi_node (tmp, first); phi = create_phi_node (tmp, first);
add_phi_arg (&phi, build_int_cst (ret_type, 0), EDGE_PRED (first, 0)); add_phi_arg (&phi,
/* RET_TYPE can be a float when -ffast-maths is
enabled. */
fold_convert (ret_type, integer_zero_node),
EDGE_PRED (first, 0));
a_acc = PHI_RESULT (phi); a_acc = PHI_RESULT (phi);
} }
...@@ -908,7 +912,11 @@ tree_optimize_tail_calls_1 (bool opt_tailcalls) ...@@ -908,7 +912,11 @@ tree_optimize_tail_calls_1 (bool opt_tailcalls)
add_referenced_tmp_var (tmp); add_referenced_tmp_var (tmp);
phi = create_phi_node (tmp, first); phi = create_phi_node (tmp, first);
add_phi_arg (&phi, build_int_cst (ret_type, 1), EDGE_PRED (first, 0)); add_phi_arg (&phi,
/* RET_TYPE can be a float when -ffast-maths is
enabled. */
fold_convert (ret_type, integer_one_node),
EDGE_PRED (first, 0));
m_acc = PHI_RESULT (phi); m_acc = PHI_RESULT (phi);
} }
} }
......
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