Commit e8c3ff97 by Eric Botcazou Committed by Eric Botcazou

tree-tailcall.c (pass_tail_recursion): Use gate_tail_calls too.

	* tree-tailcall.c (pass_tail_recursion): Use gate_tail_calls too.

testsuite/
	* gcc.dg/sibcall-7.c: New test.
	* gcc.dg/tree-ssa/tailrecursion-1.c: Pass -foptimize-sibling-calls.
	* gcc.dg/tree-ssa/tailrecursion-2.c: Likewise.
	* gcc.dg/tree-ssa/tailrecursion-3.c: Likewise.
	* gcc.dg/tree-ssa/tailrecursion-4.c: Likewise.
	* gcc.dg/tree-ssa/tailrecursion-5.c: Likewise.

From-SVN: r113200
parent 38a4afee
2006-04-23 Eric Botcazou <ebotcazou@adacore.com>
* tree-tailcall.c (pass_tail_recursion): Use gate_tail_calls too.
2006-04-23 Mark Mitchell <mark@codesourcery.com> 2006-04-23 Mark Mitchell <mark@codesourcery.com>
PR c++/26534 PR c++/26534
......
2006-04-23 Eric Botcazou <ebotcazou@adacore.com>
* gcc.dg/sibcall-7.c: New test.
* gcc.dg/tree-ssa/tailrecursion-1.c: Pass -foptimize-sibling-calls.
* gcc.dg/tree-ssa/tailrecursion-2.c: Likewise.
* gcc.dg/tree-ssa/tailrecursion-3.c: Likewise.
* gcc.dg/tree-ssa/tailrecursion-4.c: Likewise.
* gcc.dg/tree-ssa/tailrecursion-5.c: Likewise.
2006-04-23 Mark Mitchell <mark@codesourcery.com> 2006-04-23 Mark Mitchell <mark@codesourcery.com>
PR c++/26534 PR c++/26534
/* Simple check that tail recursive call optimization is also
controlled by -foptimize-sibling-calls.
Copyright (C) 2006 Free Software Foundation Inc.
Original test by Hans-Peter Nilsson <hp@bitrange.com> */
/* { dg-do run } */
/* { dg-options "-O2 -fno-optimize-sibling-calls" } */
extern void abort (void);
extern void recurser_void (int);
extern void track (int);
int main (void)
{
recurser_void (0);
return 0;
}
void recurser_void (int n)
{
if (n == 0 || n == 7)
track (n);
if (n == 10)
return;
recurser_void (n + 1);
}
void *trackpoint;
void track (int n)
{
char stackpos[1];
if (n == 0)
trackpoint = stackpos;
else if (n != 7 || trackpoint == stackpos)
abort ();
}
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O1 -fdump-tree-tailr-details" } */ /* { dg-options "-O1 -foptimize-sibling-calls -fdump-tree-tailr-details" } */
int int
t(int a) t(int a)
{ {
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O1 -fdump-tree-tailr-details" } */ /* { dg-options "-O1 -foptimize-sibling-calls -fdump-tree-tailr-details" } */
int int
t(char *a) t(char *a)
{ {
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O1 -fdump-tree-tailr-details" } */ /* { dg-options "-O1 -foptimize-sibling-calls -fdump-tree-tailr-details" } */
int int
t(int a) t(int a)
{ {
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O1 -fdump-tree-tailr-details" } */ /* { dg-options "-O1 -foptimize-sibling-calls -fdump-tree-tailr-details" } */
int int
t(int a) t(int a)
{ {
......
/* { dg-do run } */ /* { dg-do run } */
/* { dg-options "-O1 -fdump-tree-optimized" } */ /* { dg-options "-O1 -foptimize-sibling-calls -fdump-tree-optimized" } */
extern void abort (void); extern void abort (void);
extern void exit (int); extern void exit (int);
......
...@@ -1017,7 +1017,7 @@ execute_tail_calls (void) ...@@ -1017,7 +1017,7 @@ execute_tail_calls (void)
struct tree_opt_pass pass_tail_recursion = struct tree_opt_pass pass_tail_recursion =
{ {
"tailr", /* name */ "tailr", /* name */
NULL, /* gate */ gate_tail_calls, /* gate */
execute_tail_recursion, /* execute */ execute_tail_recursion, /* execute */
NULL, /* sub */ NULL, /* sub */
NULL, /* next */ NULL, /* next */
......
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