diff options
author | Jan Hubicka <jh@suse.cz> | 2020-09-23 23:06:05 +0200 |
---|---|---|
committer | Jan Hubicka <jh@suse.cz> | 2020-09-23 23:06:05 +0200 |
commit | e977dd5edbcc3a3b88c3bd7efa1026c845af7487 (patch) | |
tree | 6603e18a37391e417b8b2c1e3821f747bf039c3d /gcc/ipa-modref.c | |
parent | e92779db3304bc96a6b861f87c5edde8dd4d4030 (diff) | |
download | gcc-e977dd5edbcc3a3b88c3bd7efa1026c845af7487.zip gcc-e977dd5edbcc3a3b88c3bd7efa1026c845af7487.tar.gz gcc-e977dd5edbcc3a3b88c3bd7efa1026c845af7487.tar.bz2 |
Cleanup modref interfaces.
* ipa-fnsummary.c (refs_local_or_readonly_memory_p): New function.
(points_to_local_or_readonly_memory_p): New function.
* ipa-fnsummary.h (refs_local_or_readonly_memory_p): Declare.
(points_to_local_or_readonly_memory_p): Declare.
* ipa-modref.c (record_access_p): Use refs_local_or_readonly_memory_p.
* ipa-pure-const.c (check_op): Likewise.
* gcc.dg/tree-ssa/local-pure-const.c: Update template.
Diffstat (limited to 'gcc/ipa-modref.c')
-rw-r--r-- | gcc/ipa-modref.c | 31 |
1 files changed, 5 insertions, 26 deletions
diff --git a/gcc/ipa-modref.c b/gcc/ipa-modref.c index 3e65159..9cc9056 100644 --- a/gcc/ipa-modref.c +++ b/gcc/ipa-modref.c @@ -62,6 +62,9 @@ along with GCC; see the file COPYING3. If not see #include "calls.h" #include "ipa-modref-tree.h" #include "ipa-modref.h" +#include "value-range.h" +#include "ipa-prop.h" +#include "ipa-fnsummary.h" /* Class (from which there is one global instance) that holds modref summaries for all analyzed functions. */ @@ -347,36 +350,12 @@ record_access_lto (modref_records_lto *tt, ao_ref *ref) static bool record_access_p (tree expr) { - /* Non-escaping memory is fine */ - tree t = get_base_address (expr); - if (t && (INDIRECT_REF_P (t) - || TREE_CODE (t) == MEM_REF - || TREE_CODE (t) == TARGET_MEM_REF) - && TREE_CODE (TREE_OPERAND (t, 0)) == SSA_NAME - && !ptr_deref_may_alias_global_p (TREE_OPERAND (t, 0))) + if (refs_local_or_readonly_memory_p (expr)) { if (dump_file) - fprintf (dump_file, " - Non-escaping memory, ignoring.\n"); + fprintf (dump_file, " - Read-only or local, ignoring.\n"); return false; } - - /* Automatic variables are fine. */ - if (DECL_P (t) - && auto_var_in_fn_p (t, current_function_decl)) - { - if (dump_file) - fprintf (dump_file, " - Automatic variable, ignoring.\n"); - return false; - } - - /* Read-only variables are fine. */ - if (DECL_P (t) && TREE_READONLY (t)) - { - if (dump_file) - fprintf (dump_file, " - Read-only variable, ignoring.\n"); - return false; - } - return true; } |