From 7352e27c3c4fd7992b858d9395c62c422ce798a9 Mon Sep 17 00:00:00 2001 From: Andrew Pinski Date: Tue, 5 Aug 2008 18:23:07 +0000 Subject: [PATCH] re PR tree-optimization/37024 (bad tail call from tuples merge) 2008-08-05 Andrew Pinski PR tree-opt/37024 * tree-tailcall.c (process_assignment): Use gimple_assign_cast_p instead of IS_CONVERT_EXPR_CODE_P for seeing if the assignment is a conversion. 2008-08-05 Andrew Pinski PR tree-opt/37024 * gcc.dg/tree-ssa/tailcall-4.c: New testcase. From-SVN: r138735 --- gcc/ChangeLog | 7 +++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/tree-ssa/tailcall-4.c | 16 ++++++++++++++++ gcc/tree-tailcall.c | 2 +- 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/tailcall-4.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7884fa833b6..cdc4d87d107 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2008-08-05 Andrew Pinski + + PR tree-opt/37024 + * tree-tailcall.c (process_assignment): Use gimple_assign_cast_p + instead of IS_CONVERT_EXPR_CODE_P for seeing if the assignment + is a conversion. + 2008-08-05 Richard Henderson * Makefile.in (c-cppbuiltin.o): Depend on debug.h. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index dda2c2a34f8..aae61b48eab 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-08-05 Andrew Pinski + + PR tree-opt/37024 + * gcc.dg/tree-ssa/tailcall-4.c: New testcase. + 2008-08-05 Richard Guenther PR middle-end/37026 diff --git a/gcc/testsuite/gcc.dg/tree-ssa/tailcall-4.c b/gcc/testsuite/gcc.dg/tree-ssa/tailcall-4.c new file mode 100644 index 00000000000..e7983da31da --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/tailcall-4.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-tailc-details" } */ +/* PR tree-opt/37024 */ + +double doubleValue(); + +long +longValue () +{ + return (long) doubleValue (); +} + +/* We should not tail call doubleValue in longValue as the mode changes. */ +/* { dg-final { scan-tree-dump-times "Found tail call" 0 "tailc"} } */ +/* { dg-final { cleanup-tree-dump "tailc" } } */ + diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c index 78bf1550d2b..935b41941a0 100644 --- a/gcc/tree-tailcall.c +++ b/gcc/tree-tailcall.c @@ -283,7 +283,7 @@ process_assignment (gimple stmt, gimple_stmt_iterator call, tree *m, { /* Reject a tailcall if the type conversion might need additional code. */ - if (IS_CONVERT_EXPR_CODE_P (code) + if (gimple_assign_cast_p (stmt) && TYPE_MODE (TREE_TYPE (dest)) != TYPE_MODE (TREE_TYPE (src_var))) return false;