summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-structalias.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-ssa-structalias.cc')
-rw-r--r--gcc/tree-ssa-structalias.cc15
1 files changed, 11 insertions, 4 deletions
diff --git a/gcc/tree-ssa-structalias.cc b/gcc/tree-ssa-structalias.cc
index d318f883e70..581bdcf5652 100644
--- a/gcc/tree-ssa-structalias.cc
+++ b/gcc/tree-ssa-structalias.cc
@@ -6995,10 +6995,12 @@ pt_solution_singleton_or_null_p (struct pt_solution *pt, unsigned *uid)
return true;
}
-/* Return true if the points-to solution *PT includes global memory. */
+/* Return true if the points-to solution *PT includes global memory.
+ If ESCAPED_LOCAL_P is true then escaped local variables are also
+ considered global. */
bool
-pt_solution_includes_global (struct pt_solution *pt)
+pt_solution_includes_global (struct pt_solution *pt, bool escaped_local_p)
{
if (pt->anything
|| pt->nonlocal
@@ -7009,12 +7011,17 @@ pt_solution_includes_global (struct pt_solution *pt)
|| pt->vars_contains_escaped_heap)
return true;
+ if (escaped_local_p && pt->vars_contains_escaped)
+ return true;
+
/* 'escaped' is also a placeholder so we have to look into it. */
if (pt->escaped)
- return pt_solution_includes_global (&cfun->gimple_df->escaped);
+ return pt_solution_includes_global (&cfun->gimple_df->escaped,
+ escaped_local_p);
if (pt->ipa_escaped)
- return pt_solution_includes_global (&ipa_escaped_pt);
+ return pt_solution_includes_global (&ipa_escaped_pt,
+ escaped_local_p);
return false;
}