[committed] Fix another tree-ssa-dse.c thinko

Jeff Law law@redhat.com
Mon Oct 16 18:27:00 GMT 2017


Martin's checking turned up another bug in the same line of code that we
use to check if we're doing a real from a live location.

The computation of the end of the range to check did not account for the
offset of the write reference.  Ugh.

With this patch we get a clean bootstrap & regression test with Martin's
latest sbitmap checking patches on x86.

Installing on the trunk.

Jeff


-------------- next part --------------
commit c41999b60343c5db040eafb46fc1cf86b5584c14
Author: Jeff Law <law@torsion.usersys.redhat.com>
Date:   Mon Oct 16 13:40:29 2017 -0400

            * tree-ssa-dse.c (live_bytes_read): Fix thinko.

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ab0d1f6ac63..df26aeb2ada 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2017-10-16  Jeff Law  <law@redhat.com>
+
+	* tree-ssa-dse.c (live_bytes_read): Fix thinko.
+
 2017-10-16  Jan Hubicka  <hubicka@ucw.cz>
 
 	* x86-tune-costs.h (znver1_cost): Fix move cost tables.
diff --git a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c
index 9d6cb146436..c1a6475afe1 100644
--- a/gcc/tree-ssa-dse.c
+++ b/gcc/tree-ssa-dse.c
@@ -493,7 +493,7 @@ live_bytes_read (ao_ref use_ref, ao_ref *ref, sbitmap live)
 
       /* Now check if any of the remaining bits in use_ref are set in LIVE.  */
       unsigned int start = (use_ref.offset - ref->offset) / BITS_PER_UNIT;
-      unsigned int end  = ((use_ref.offset + use_ref.size) / BITS_PER_UNIT) - 1;
+      unsigned int end = start + (use_ref.size / BITS_PER_UNIT) - 1;
       return bitmap_bit_in_range_p (live, start, end);
     }
   return true;


More information about the Gcc-patches mailing list