From: Richard Guenther Date: Thu, 21 Apr 2011 11:31:52 +0000 (+0000) Subject: tree-ssa-alias.c (ref_maybe_used_by_stmt_p): Handle return statements. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=53f94a5c18aa035ceb4f9ada2afb9ec8aa07ce57;p=gcc.git tree-ssa-alias.c (ref_maybe_used_by_stmt_p): Handle return statements. 2011-04-21 Richard Guenther * tree-ssa-alias.c (ref_maybe_used_by_stmt_p): Handle return statements. From-SVN: r172820 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a581d7a0ca1..a414107f799 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2011-04-21 Richard Guenther + + * tree-ssa-alias.c (ref_maybe_used_by_stmt_p): Handle + return statements. + 2011-04-21 Joseph Myers * config/i386/cygming.h (union tree_node, TREE): Don't define or diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index a77c803b98c..673073ee81a 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -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; }