Bug 15108 - [4.0 Regression] [tree-ssa] [regression] missed sib-calling for pointer changes
Summary: [4.0 Regression] [tree-ssa] [regression] missed sib-calling for pointer changes
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: tree-ssa
: P2 minor
Target Milestone: 4.0.0
Assignee: Richard Henderson
URL:
Keywords: missed-optimization, patch
Depends on:
Blocks: 15109
  Show dependency treegraph
 
Reported: 2004-04-23 22:45 UTC by Andrew Pinski
Modified: 2004-09-13 14:15 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work: 3.4.0
Known to fail: tree-ssa
Last reconfirmed: 2004-04-23 22:51:55


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Pinski 2004-04-23 22:45:54 UTC
void *t();

char *f()
{
  return t();
}
Comment 1 Andrew Pinski 2004-04-23 22:51:54 UTC
This is related to bug 14440 which is because they are the same size (_Bool is the same 
size as int on powerpc-apple-darwin).
Comment 2 Andrew Pinski 2004-05-07 01:21:53 UTC
This is a dup of bug 14441, the patch which fixes that also fixes this one.

*** This bug has been marked as a duplicate of 14441 ***
Comment 3 Andrew Pinski 2004-06-07 18:15:18 UTC
Re-introduced by:
2004-06-07  Richard Henderson  <rth@redhat.com>

        * gimple-low.c (struct lower_data): Add the_return_label and
        one_return_stmt.
        (lower_function_body): Initialize and use them.
        (lower_return_expr): New.
        (lower_stmt): Call it.
        * gimplify.c (gimplify_return_expr): Force the argument to be either
        null or a result_decl.
        * tree-gimple.c: Update gimple grammer to match.
        * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Deny
        coalescing of result_decls.

The problem is that return statements no longer have stuff in them any more.
Comment 4 Andrew Pinski 2004-06-07 18:35:07 UTC
Here is the testcase I would add to the testsuite so this does not happen again:
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-tailc-details" } */
void *t();
char *f()
{
  return t();
}
/* { dg-final { scan-tree-dump-times "Found tail call" 1 "tailc"} } */
Comment 5 Richard Henderson 2004-06-09 22:18:23 UTC
Testing a patch.
Comment 6 GCC Commits 2004-06-09 23:49:02 UTC
Subject: Bug 15108

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	rth@gcc.gnu.org	2004-06-09 23:48:57

Modified files:
	gcc            : ChangeLog tree-tailcall.c 

Log message:
	PR opt/15108
	* tree-tailcall.c (find_tail_calls): Don't check early for
	tail_recursion failure.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.3900&r2=2.3901
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-tailcall.c.diff?cvsroot=gcc&r1=2.6&r2=2.7

Comment 7 Richard Henderson 2004-06-09 23:50:11 UTC
Fixed.