return pt_solution_includes_global (&pi->pt, escaped_local_p);
}
+/* Return true, if dereferencing PTR may alias with a local automatic
+ variable. */
+
+bool
+ptr_deref_may_alias_auto_p (tree ptr)
+{
+ struct ptr_info_def *pi;
+
+ /* If we end up with a pointer constant here that may point
+ to local stack memory. */
+ if (TREE_CODE (ptr) != SSA_NAME)
+ return true;
+
+ pi = SSA_NAME_PTR_INFO (ptr);
+
+ /* If we do not have points-to information for this variable,
+ we have to punt. */
+ if (!pi)
+ return true;
+
+ return pt_solution_includes_auto (&pi->pt);
+}
+
+
/* Return true if dereferencing PTR may alias DECL.
The caller is responsible for applying TBAA to see if PTR
may access DECL at all. */
/* Nonzero if the vars bitmap includes a variable included in 'nonlocal'. */
unsigned int vars_contains_nonlocal : 1;
+ /* Nonzero if the vars bitmap includes a local automatic variable. */
+ unsigned int vars_contains_auto : 1;
/* Nonzero if the vars bitmap includes a variable included in 'escaped'. */
unsigned int vars_contains_escaped : 1;
/* Nonzero if the vars bitmap includes a anonymous heap variable that
extern bool ao_ref_alignment (ao_ref *, unsigned int *,
unsigned HOST_WIDE_INT *);
extern bool ptr_deref_may_alias_global_p (tree, bool);
+extern bool ptr_deref_may_alias_auto_p (tree);
extern bool ptr_derefs_may_alias_p (tree, tree);
extern bool ptrs_compare_unequal (tree, tree);
extern bool ref_may_alias_global_p (tree, bool);
extern bool pt_solution_empty_p (const pt_solution *);
extern bool pt_solution_singleton_or_null_p (struct pt_solution *, unsigned *);
extern bool pt_solution_includes_global (struct pt_solution *, bool);
+extern bool pt_solution_includes_auto (struct pt_solution *);
extern bool pt_solution_includes (struct pt_solution *, const_tree);
extern bool pt_solution_includes_const_pool (struct pt_solution *);
extern bool pt_solutions_intersect (struct pt_solution *, struct pt_solution *);
&& ! auto_var_in_fn_p (vi->decl, fndecl)))
pt->vars_contains_nonlocal = true;
+ /* If the variable is an automatic in the local stack frame, record
+ that. Note this does not include PARM_DECL and RESULT_DECL which
+ are managed by the caller. */
+ if (VAR_P (vi->decl)
+ && auto_var_in_fn_p (vi->decl, fndecl))
+ pt->vars_contains_auto = true;
+
/* If we have a variable that is interposable record that fact
for pointer comparison simplification. */
if (VAR_P (vi->decl)
return false;
}
+/* Return true if the points-to solution *PT includes local automatic
+ storage. */
+
+bool
+pt_solution_includes_auto (struct pt_solution *pt)
+{
+ if (pt->anything
+ || pt->vars_contains_auto)
+ return true;
+
+ /* 'escaped' is also a placeholder so we have to look into it. */
+ if (pt->escaped)
+ return pt_solution_includes_auto (&cfun->gimple_df->escaped);
+
+ if (pt->ipa_escaped)
+ return pt_solution_includes_auto (&ipa_escaped_pt);
+
+ return false;
+}
+
+
/* Return true if the points-to solution *PT includes the variable
declaration DECL. */
/* IPA PTA solutions for ESCAPED. */
struct pt_solution ipa_escaped_pt
= { true, false, false, false, false, false,
- false, false, false, false, false, NULL };
+ false, false, false, false, false, false, NULL };
/* Execute the driver for IPA PTA. */