From 917f08fa720784bbdfc3a54e8e953b696e7e9ba8 Mon Sep 17 00:00:00 2001 From: rguenth Date: Thu, 25 Jun 2009 15:19:45 +0000 Subject: [PATCH] 2009-06-25 Richard Guenther * tree-ssa-alias.c (ref_maybe_used_by_call_p_1): Disambiguate indirect references against the callused/escaped solutions. (call_may_clobber_ref_p_1): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@148947 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/tree-ssa-alias.c | 53 +++++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 52 insertions(+), 7 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1141473..adb14e3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2009-06-25 Richard Guenther + + * tree-ssa-alias.c (ref_maybe_used_by_call_p_1): Disambiguate + indirect references against the callused/escaped solutions. + (call_may_clobber_ref_p_1): Likewise. + 2009-06-25 Martin Jambor PR tree-optimization/40493 diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 9895524..1473367 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -858,12 +858,8 @@ ref_maybe_used_by_call_p_1 (gimple call, tree ref) && (flags & (ECF_CONST|ECF_NOVOPS))) goto process_args; - /* If the reference is not based on a decl give up. - ??? Handle indirect references by intersecting the call-used - solution with that of the pointer. */ base = get_base_address (ref); - if (!base - || !DECL_P (base)) + if (!base) return true; /* If the reference is based on a decl that is not aliased the call @@ -945,12 +941,45 @@ ref_maybe_used_by_call_p_1 (gimple call, tree ref) it may be used. */ if (flags & (ECF_PURE|ECF_CONST|ECF_LOOPING_CONST_OR_PURE|ECF_NOVOPS)) { - if (is_call_used (base)) + if (DECL_P (base)) + { + if (is_call_used (base)) + return true; + } + else if (INDIRECT_REF_P (base) + && TREE_CODE (TREE_OPERAND (base, 0)) == SSA_NAME) + { + struct ptr_info_def *pi = SSA_NAME_PTR_INFO (TREE_OPERAND (base, 0)); + if (!pi) + return true; + + if (pt_solution_includes_global (&pi->pt) + || pt_solutions_intersect (&cfun->gimple_df->callused, &pi->pt) + || pt_solutions_intersect (&cfun->gimple_df->escaped, &pi->pt)) + return true; + } + else return true; } else { - if (is_call_clobbered (base)) + if (DECL_P (base)) + { + if (is_call_clobbered (base)) + return true; + } + else if (INDIRECT_REF_P (base) + && TREE_CODE (TREE_OPERAND (base, 0)) == SSA_NAME) + { + struct ptr_info_def *pi = SSA_NAME_PTR_INFO (TREE_OPERAND (base, 0)); + if (!pi) + return true; + + if (pt_solution_includes_global (&pi->pt) + || pt_solutions_intersect (&cfun->gimple_df->escaped, &pi->pt)) + return true; + } + else return true; } @@ -1148,6 +1177,16 @@ call_may_clobber_ref_p_1 (gimple call, ao_ref *ref) if (DECL_P (base)) return is_call_clobbered (base); + else if (INDIRECT_REF_P (base) + && TREE_CODE (TREE_OPERAND (base, 0)) == SSA_NAME) + { + struct ptr_info_def *pi = SSA_NAME_PTR_INFO (TREE_OPERAND (base, 0)); + if (!pi) + return true; + + return (pt_solution_includes_global (&pi->pt) + || pt_solutions_intersect (&cfun->gimple_df->escaped, &pi->pt)); + } return true; } -- 2.7.4