tree-ssa-alias.c (ref_maybe_used_by_stmt_p): Handle return statements.

2011-04-21  Richard Guenther  <rguenther@suse.de>

	* tree-ssa-alias.c (ref_maybe_used_by_stmt_p): Handle
	return statements.

From-SVN: r172820
This commit is contained in:
Richard Guenther 2011-04-21 11:31:52 +00:00 committed by Richard Biener
parent f0dca5baf2
commit 53f94a5c18
2 changed files with 25 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2011-04-21 Richard Guenther <rguenther@suse.de>
* tree-ssa-alias.c (ref_maybe_used_by_stmt_p): Handle
return statements.
2011-04-21 Joseph Myers <joseph@codesourcery.com>
* config/i386/cygming.h (union tree_node, TREE): Don't define or

View File

@ -1364,6 +1364,26 @@ ref_maybe_used_by_stmt_p (gimple stmt, tree ref)
}
else if (is_gimple_call (stmt))
return ref_maybe_used_by_call_p (stmt, ref);
else if (gimple_code (stmt) == GIMPLE_RETURN)
{
tree retval = gimple_return_retval (stmt);
tree base;
if (retval
&& TREE_CODE (retval) != SSA_NAME
&& !is_gimple_min_invariant (retval)
&& refs_may_alias_p (retval, ref))
return true;
/* If ref escapes the function then the return acts as a use. */
base = get_base_address (ref);
if (!base)
;
else if (DECL_P (base))
return is_global_var (base);
else if (TREE_CODE (base) == MEM_REF
|| TREE_CODE (base) == TARGET_MEM_REF)
return ptr_deref_may_alias_global_p (TREE_OPERAND (base, 0));
return false;
}
return true;
}