tree-tailcall.c
31.8 KB
-
Handle sibcalls with aggregate returns · 9713daa0
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. From-SVN: r242668Richard Sandiford committed