aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-dse.c
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2019-06-26 12:00:00 -0600
committerJeff Law <law@gcc.gnu.org>2019-06-26 12:00:00 -0600
commit4a61cf9c62212fd04f21704efc2decffe9544651 (patch)
tree8a77e9e1bb86fbebcf8adcaa6f027ce901a2a13b /gcc/tree-ssa-dse.c
parentf363fc5b49cb83aa98d89efa98fe42f57af4de05 (diff)
downloadgcc-4a61cf9c62212fd04f21704efc2decffe9544651.zip
gcc-4a61cf9c62212fd04f21704efc2decffe9544651.tar.gz
gcc-4a61cf9c62212fd04f21704efc2decffe9544651.tar.bz2
tree-ssa-dse.c (initialize_ao_ref_for_dse): Handle _chk variants of memcpy, memmove and memset builtins.
* tree-ssa-dse.c (initialize_ao_ref_for_dse): Handle _chk variants of memcpy, memmove and memset builtins. (maybe_trim_memstar_call): Likewise. * gcc.c-torture/execute/builtins/builtins.exp: Add -fno-tree-dse as DSE compromises several of these tests. * gcc.dg/builtin-stringop-chk-1.c: Similarly. * gcc.dg/memcpy-2.c: Similarly. * gcc.dg/pr40340-1.c: Similarly. * gcc.dg/pr40340-2.c: Similarly. * gcc.dg/pr40340-5.c: Similarly. From-SVN: r272704
Diffstat (limited to 'gcc/tree-ssa-dse.c')
-rw-r--r--gcc/tree-ssa-dse.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c
index aa998f4..ea71f49 100644
--- a/gcc/tree-ssa-dse.c
+++ b/gcc/tree-ssa-dse.c
@@ -98,6 +98,9 @@ initialize_ao_ref_for_dse (gimple *stmt, ao_ref *write)
case BUILT_IN_MEMCPY:
case BUILT_IN_MEMMOVE:
case BUILT_IN_MEMSET:
+ case BUILT_IN_MEMCPY_CHK:
+ case BUILT_IN_MEMMOVE_CHK:
+ case BUILT_IN_MEMSET_CHK:
{
tree size = NULL_TREE;
if (gimple_call_num_args (stmt) == 3)
@@ -434,6 +437,8 @@ maybe_trim_memstar_call (ao_ref *ref, sbitmap live, gimple *stmt)
{
case BUILT_IN_MEMCPY:
case BUILT_IN_MEMMOVE:
+ case BUILT_IN_MEMCPY_CHK:
+ case BUILT_IN_MEMMOVE_CHK:
{
int head_trim, tail_trim;
compute_trims (ref, live, &head_trim, &tail_trim, stmt);
@@ -455,6 +460,7 @@ maybe_trim_memstar_call (ao_ref *ref, sbitmap live, gimple *stmt)
}
case BUILT_IN_MEMSET:
+ case BUILT_IN_MEMSET_CHK:
{
int head_trim, tail_trim;
compute_trims (ref, live, &head_trim, &tail_trim, stmt);
@@ -860,6 +866,9 @@ dse_dom_walker::dse_optimize_stmt (gimple_stmt_iterator *gsi)
case BUILT_IN_MEMCPY:
case BUILT_IN_MEMMOVE:
case BUILT_IN_MEMSET:
+ case BUILT_IN_MEMCPY_CHK:
+ case BUILT_IN_MEMMOVE_CHK:
+ case BUILT_IN_MEMSET_CHK:
{
/* Occasionally calls with an explicit length of zero
show up in the IL. It's pointless to do analysis