aboutsummaryrefslogtreecommitdiff
path: root/gcc/ipa-modref.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2021-11-16 23:01:28 +0100
committerJan Hubicka <jh@suse.cz>2021-11-16 23:01:28 +0100
commit6dc90c4dbb6f9589dea9c670c3468496bb207de5 (patch)
tree7edf8771b392b9a437bee0c50c5fd430b1603c0f /gcc/ipa-modref.c
parent42cdf08ad84bfde669adaa80984fcf3b7f21ec69 (diff)
downloadgcc-6dc90c4dbb6f9589dea9c670c3468496bb207de5.zip
gcc-6dc90c4dbb6f9589dea9c670c3468496bb207de5.tar.gz
gcc-6dc90c4dbb6f9589dea9c670c3468496bb207de5.tar.bz2
Use modref summaries for byte-wise dead store elimination.
gcc/ChangeLog: * ipa-modref.c (get_modref_function_summary): Declare. * ipa-modref.h (get_modref_function_summary): New function. * tree-ssa-dse.c (clear_live_bytes_for_ref): Break out from ... (clear_bytes_written_by): ... here; also clear memory killed by calls. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/modref-dse-4.c: New test.
Diffstat (limited to 'gcc/ipa-modref.c')
-rw-r--r--gcc/ipa-modref.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/ipa-modref.c b/gcc/ipa-modref.c
index 5783430..a70575bc 100644
--- a/gcc/ipa-modref.c
+++ b/gcc/ipa-modref.c
@@ -740,6 +740,28 @@ get_modref_function_summary (cgraph_node *func)
return r;
}
+/* Get function summary for CALL if it exists, return NULL otherwise.
+ If non-null set interposed to indicate whether function may not
+ bind to current def. In this case sometimes loads from function
+ needs to be ignored. */
+
+modref_summary *
+get_modref_function_summary (gcall *call, bool *interposed)
+{
+ tree callee = gimple_call_fndecl (call);
+ if (!callee)
+ return NULL;
+ struct cgraph_node *node = cgraph_node::get (callee);
+ if (!node)
+ return NULL;
+ modref_summary *r = get_modref_function_summary (node);
+ if (interposed && r)
+ *interposed = r->calls_interposable
+ || !node->binds_to_current_def_p ();
+ return r;
+}
+
+
namespace {
/* Construct modref_access_node from REF. */