aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-alias.h
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2022-04-07 14:07:54 +0200
committerRichard Biener <rguenther@suse.de>2022-04-07 15:03:36 +0200
commit8c0ebaf9f586100920a3c0849fb10e9985d7ae58 (patch)
tree6d15d0cf669d155035d261647744f8eadb7a8d72 /gcc/tree-ssa-alias.h
parent88b939b19ab454ab2d932ef292bbc557abe4431c (diff)
downloadgcc-8c0ebaf9f586100920a3c0849fb10e9985d7ae58.zip
gcc-8c0ebaf9f586100920a3c0849fb10e9985d7ae58.tar.gz
gcc-8c0ebaf9f586100920a3c0849fb10e9985d7ae58.tar.bz2
ipa/104303 - miscompilation of gnatmake
Modref attempts to track memory accesses relative to the base pointers which are parameters of functions. If it fails, it still makes difference between unknown memory access and global memory access. The second makes it possible to disambiguate with memory that is not accessible from outside world (i.e. everything that does not escape from the caller function). This is useful so we do not punt when unknown function is called. The added ref_may_access_global_memory_p ends up using ptr_deref_may_alias_global_p which does not consider escaped automatic variables as global. For modref those are still global since they can be accessed from functions called. The following adds a flag to the *_global_p APIs indicating whether escaped local memory should be considered as global or not and removes ref_may_access_global_memory_p in favor of using ref_may_alias_global_p with the flag set to true. 2022-04-07 Richard Biener <rguenther@suse.de> Jan Hubicka <hubicka@ucw.cz> PR ipa/104303 * tree-ssa-alias.h (ptr_deref_may_alias_global_p, ref_may_alias_global_p, ref_may_alias_global_p, stmt_may_clobber_global_p, pt_solution_includes_global): Add bool parameters indicating whether escaped locals should be considered global. * tree-ssa-structalias.cc (pt_solution_includes_global): When the new escaped_nonlocal_p flag is true also consider pt->vars_contains_escaped. * tree-ssa-alias.cc (ptr_deref_may_alias_global_p): Pass down new escaped_nonlocal_p flag. (ref_may_alias_global_p): Likewise. (stmt_may_clobber_global_p): Likewise. (ref_may_alias_global_p_1): Likewise. For decls also query the escaped solution if true. (ref_may_access_global_memory_p): Remove. (modref_may_conflict): Use ref_may_alias_global_p with escaped locals considered global. (ref_maybe_used_by_stmt_p): Adjust. * ipa-fnsummary.cc (points_to_local_or_readonly_memory_p): Likewise. * tree-ssa-dse.cc (dse_classify_store): Likewise. * trans-mem.cc (thread_private_new_memory): Likewise, but consider escaped locals global. * tree-ssa-dce.cc (mark_stmt_if_obviously_necessary): Likewise. * gnat.dg/concat5.adb: New. * gnat.dg/concat5_pkg1.adb: Likewise. * gnat.dg/concat5_pkg1.ads: Likewise. * gnat.dg/concat5_pkg2.adb: Likewise. * gnat.dg/concat5_pkg2.ads: Likewise.
Diffstat (limited to 'gcc/tree-ssa-alias.h')
-rw-r--r--gcc/tree-ssa-alias.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/gcc/tree-ssa-alias.h b/gcc/tree-ssa-alias.h
index dfb2127..fa081ab 100644
--- a/gcc/tree-ssa-alias.h
+++ b/gcc/tree-ssa-alias.h
@@ -121,18 +121,18 @@ extern tree ao_ref_alias_ptr_type (ao_ref *);
extern tree ao_ref_base_alias_ptr_type (ao_ref *);
extern bool ao_ref_alignment (ao_ref *, unsigned int *,
unsigned HOST_WIDE_INT *);
-extern bool ptr_deref_may_alias_global_p (tree);
+extern bool ptr_deref_may_alias_global_p (tree, bool);
extern bool ptr_derefs_may_alias_p (tree, tree);
extern bool ptrs_compare_unequal (tree, tree);
-extern bool ref_may_alias_global_p (tree);
-extern bool ref_may_alias_global_p (ao_ref *);
+extern bool ref_may_alias_global_p (tree, bool);
+extern bool ref_may_alias_global_p (ao_ref *, bool);
extern bool refs_may_alias_p (tree, tree, bool = true);
extern bool refs_may_alias_p_1 (ao_ref *, ao_ref *, bool);
extern bool refs_anti_dependent_p (tree, tree);
extern bool refs_output_dependent_p (tree, tree);
extern bool ref_maybe_used_by_stmt_p (gimple *, tree, bool = true);
extern bool ref_maybe_used_by_stmt_p (gimple *, ao_ref *, bool = true);
-extern bool stmt_may_clobber_global_p (gimple *);
+extern bool stmt_may_clobber_global_p (gimple *, bool);
extern bool stmt_may_clobber_ref_p (gimple *, tree, bool = true);
extern bool stmt_may_clobber_ref_p_1 (gimple *, ao_ref *, bool = true);
extern bool call_may_clobber_ref_p (gcall *, tree, bool = true);
@@ -171,7 +171,7 @@ extern void dump_alias_stats (FILE *);
extern unsigned int compute_may_aliases (void);
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 *);
+extern bool pt_solution_includes_global (struct pt_solution *, bool);
extern bool pt_solution_includes (struct pt_solution *, const_tree);
extern bool pt_solutions_intersect (struct pt_solution *, struct pt_solution *);
extern void pt_solution_reset (struct pt_solution *);