aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2017-01-15 02:34:01 -0700
committerJeff Law <law@gcc.gnu.org>2017-01-15 02:34:01 -0700
commit0cb4b758f5372ed1b5be14f79723ad59afba25f2 (patch)
treec0cef117b1e3d8ee31f6df5a6028a19c1339a086 /gcc
parent3d812e26eab44f72c6f047ea9a2b71dcbe009878 (diff)
downloadgcc-0cb4b758f5372ed1b5be14f79723ad59afba25f2.zip
gcc-0cb4b758f5372ed1b5be14f79723ad59afba25f2.tar.gz
gcc-0cb4b758f5372ed1b5be14f79723ad59afba25f2.tar.bz2
re PR tree-optimization/79090 (DSE wrongly removes store at variable offset)
PR tree-optimization/79090 * tree-ssa-dse.c (valid_ao_ref_for_dse): Reject zero length and variable length stores. (compute_trims): Delete dead assignment to *trim_tail. (dse_dom_walker::dse_optimize_stmt): Optimize mem* calls with zero length. From-SVN: r244472
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/tree-ssa-dse.c13
2 files changed, 21 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 746f6af..36982c6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2017-01-14 Jeff Law <law@redhat.com>
+
+ PR tree-optimization/79090
+ * tree-ssa-dse.c (valid_ao_ref_for_dse): Reject zero length and
+ variable length stores.
+ (compute_trims): Delete dead assignment to *trim_tail.
+ (dse_dom_walker::dse_optimize_stmt): Optimize mem* calls with
+ zero length.
+
2017-01-14 Bernd Schmidt <bschmidt@redhat.com>
PR rtl-optimization/78626
diff --git a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c
index 2e6f8ff..65dcb12 100644
--- a/gcc/tree-ssa-dse.c
+++ b/gcc/tree-ssa-dse.c
@@ -129,6 +129,8 @@ valid_ao_ref_for_dse (ao_ref *ref)
{
return (ao_ref_base (ref)
&& ref->max_size != -1
+ && ref->size != 0
+ && ref->max_size == ref->size
&& (ref->offset % BITS_PER_UNIT) == 0
&& (ref->size % BITS_PER_UNIT) == 0
&& (ref->size != -1));
@@ -221,7 +223,6 @@ compute_trims (ao_ref *ref, sbitmap live, int *trim_head, int *trim_tail)
the REF to compute the trims. */
/* Now identify how much, if any of the tail we can chop off. */
- *trim_tail = 0;
int last_orig = (ref->size / BITS_PER_UNIT) - 1;
int last_live = bitmap_last_set_bit (live);
*trim_tail = (last_orig - last_live) & ~0x1;
@@ -700,6 +701,16 @@ dse_dom_walker::dse_optimize_stmt (gimple_stmt_iterator *gsi)
case BUILT_IN_MEMMOVE:
case BUILT_IN_MEMSET:
{
+ /* Occasionally calls with an explicit length of zero
+ show up in the IL. It's pointless to do analysis
+ on them, they're trivially dead. */
+ tree size = gimple_call_arg (stmt, 2);
+ if (integer_zerop (size))
+ {
+ delete_dead_call (gsi);
+ return;
+ }
+
gimple *use_stmt;
enum dse_store_status store_status;
m_byte_tracking_enabled