r242860 - in /trunk/gcc: ChangeLog testsuite/Ch...
rsandifo@gcc.gnu.org
rsandifo@gcc.gnu.org
Fri Nov 25 08:17:00 GMT 2016
Author: rsandifo
Date: Fri Nov 25 08:17:46 2016
New Revision: 242860
URL: https://gcc.gnu.org/viewcvs?rev=242860&root=gcc&view=rev
Log:
Tighten check for whether sibcall references local variables
This loop:
/* Make sure the tail invocation of this function does not refer
to local variables. */
FOR_EACH_LOCAL_DECL (cfun, idx, var)
{
if (TREE_CODE (var) != PARM_DECL
&& auto_var_in_fn_p (var, cfun->decl)
&& (ref_maybe_used_by_stmt_p (call, var)
|| call_may_clobber_ref_p (call, var)))
return;
}
triggered even for local variables that are passed by value.
This meant that we didn't allow local aggregates to be passed
to a sibling call but did (for example) allow global aggregates
to be passed.
I think the loop is really checking for indirect references,
so should be able to skip any variables that never have their
address taken.
gcc/
* tree-tailcall.c (find_tail_calls): Allow calls to reference
local variables if all references are known to be direct.
gcc/testsuite/
* gcc.dg/tree-ssa/tailcall-8.c: New test.
Added:
trunk/gcc/testsuite/gcc.dg/tree-ssa/tailcall-8.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-tailcall.c
More information about the Gcc-cvs
mailing list