From d8e54c6203f4134b3a9ee7311f885a2dcf476673 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Tue, 23 Jul 2019 14:05:48 -0600 Subject: [PATCH] Add PR markers to recent DSE changes. And... PR tree-optimization/86061 * gcc.dg/tree-ssa/pr86061.c: New test. From-SVN: r273745 --- gcc/ChangeLog | 1 + gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gcc.dg/tree-ssa/pr86061.c | 20 ++++++++++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr86061.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d405921425f..c6c0f4a70af 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -400,6 +400,7 @@ 2019-07-19 Jeff Law + PR tree-optimization/86061 * tree-ssa-dse.c (initialize_ao_ref_for_dse): Handle strncpy. Drop some trivial dead code. (maybe_trim_memstar_call): Handle strncpy. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8e6b02668fb..14fe6b9cb27 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-07-23 Jeff Law + + PR tree-optimization/86061 + * gcc.dg/tree-ssa/pr86061.c: New test. + 2019-07-23 Richard Biener PR tree-optimization/83518 @@ -176,6 +181,7 @@ 2019-07-19 Jeff Law + PR tree-optimization/86061 * gcc.dg/tree-ssa/ssa-dse-37.c: New test. * gcc.dg/tree-ssa/ssa-dse-38.c: New test. diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr86061.c b/gcc/testsuite/gcc.dg/tree-ssa/pr86061.c new file mode 100644 index 00000000000..f2b079298c4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr86061.c @@ -0,0 +1,20 @@ +/* { dg-options "-O2 -fdump-tree-dse-details -fno-tree-fre" } */ + + +struct S { int i; char n[128]; int j; }; + +void f (char*); + +void g (struct S *p) +{ + char a[sizeof p->n + 1]; + + __builtin_memset (a, 0, sizeof a); // dead store, can be eliminated + + __builtin_strncpy (a, p->n, sizeof a - 1); + a[sizeof a - 1] = '\0'; + + f (a); +} + +/* { dg-final { scan-tree-dump-times "Deleted dead call" 1 "dse1" } } */ -- 2.30.2