aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-tailcall.c
diff options
context:
space:
mode:
authorZdenek Dvorak <ook@ucw.cz>2011-05-07 21:43:18 +0200
committerZdenek Dvorak <rakdver@gcc.gnu.org>2011-05-07 19:43:18 +0000
commit1400c8e5013a0901298b3adfeb9c5dbfcef2f494 (patch)
tree691ff75d958a92205fca691305a1ba3940706a5e /gcc/tree-tailcall.c
parent5d0878e70dc34446015c4f2908869ad9e85cab8c (diff)
downloadgcc-1400c8e5013a0901298b3adfeb9c5dbfcef2f494.zip
gcc-1400c8e5013a0901298b3adfeb9c5dbfcef2f494.tar.gz
gcc-1400c8e5013a0901298b3adfeb9c5dbfcef2f494.tar.bz2
re PR tree-optimization/48837 (Wrong optimization of recursive function calls)
PR tree-optimization/48837 * tree-tailcall.c (tree_optimize_tail_calls_1): Do not mark tailcalls when accumulator transformation is performed. * gcc.dg/pr48837.c: New testcase. From-SVN: r173534
Diffstat (limited to 'gcc/tree-tailcall.c')
-rw-r--r--gcc/tree-tailcall.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c
index c94d6ca..6a23080 100644
--- a/gcc/tree-tailcall.c
+++ b/gcc/tree-tailcall.c
@@ -1021,6 +1021,14 @@ tree_optimize_tail_calls_1 (bool opt_tailcalls)
integer_one_node);
}
+ if (a_acc || m_acc)
+ {
+ /* When the tail call elimination using accumulators is performed,
+ statements adding the accumulated value are inserted at all exits.
+ This turns all other tail calls to non-tail ones. */
+ opt_tailcalls = false;
+ }
+
for (; tailcalls; tailcalls = next)
{
next = tailcalls->next;