This is the mail archive of the gcc-cvs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

r242668 - in /trunk/gcc: ChangeLog testsuite/Ch...


Author: rsandifo
Date: Mon Nov 21 15:52:09 2016
New Revision: 242668

URL: https://gcc.gnu.org/viewcvs?rev=242668&root=gcc&view=rev
Log:
Handle sibcalls with aggregate returns

We treated this g as a sibling call to f:

      int f (int);
      int g (void) { return f (1); }

but not this one:

      struct s { int i; };
      struct s f (int);
      struct s g (void) { return f (1); }

We treated them both as sibcalls on x86 before the first patch for PR36326,
so I suppose this is a regression of sorts from 4.3.

The patch allows function returns to be local aggregate variables as well
as gimple registers.

gcc/
	* tree-tailcall.c (process_assignment): Simplify the check for
	a valid copy, allowing the source to be a local variable as
	well as an SSA name.
	(find_tail_calls): Allow copies between local variables to follow
	the call.  Allow the result to be stored in any local variable,
	even if it's an aggregate.
	(eliminate_tail_call): Check whether the result is an SSA name
	before updating its SSA_NAME_DEF_STMT.

gcc/testsuite/
	* gcc.dg/tree-ssa/tailcall-7.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/tree-ssa/tailcall-7.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-tailcall.c


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]