[Bug testsuite/103282] New test case gcc.dg/tree-ssa/modref-dse-5.c in r12-5292 fails

hubicka at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Nov 22 10:55:55 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103282

--- Comment #9 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
So the problem is that dse is giving up on determining if partial stores was
killed.  This is completely unnecesary: one can kill partial store by a full
store.

diff --git a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c
index 9531d892f76..c07782d680b 100644
--- a/gcc/tree-ssa-dse.c
+++ b/gcc/tree-ssa-dse.c
@@ -197,11 +197,11 @@ normalize_ref (ao_ref *copy, ao_ref *ref)
     }

   poly_int64 diff = copy->offset - ref->offset;
-  if (maybe_le (ref->size, diff))
+  if (maybe_le (ref->max_size, diff))
     return false;

   /* If COPY extends beyond REF, chop off its size appropriately.  */
-  poly_int64 limit = ref->size - diff;
+  poly_int64 limit = ref->max_size - diff;
   if (!ordered_p (limit, copy->size))
     return false;

@@ -266,8 +266,12 @@ static bool
 setup_live_bytes_from_ref (ao_ref *ref, sbitmap live_bytes)
 {
   HOST_WIDE_INT const_size;
-  if (valid_ao_ref_for_dse (ref)
-      && ref->size.is_constant (&const_size)
+  if (ao_ref_base (ref)
+      && known_size_p (ref->max_size)
+      && known_ge (ref->offset, 0)
+      && multiple_p (ref->offset, BITS_PER_UNIT)
+      && multiple_p (ref->max_size, BITS_PER_UNIT)
+      && ref->max_size.is_constant (&const_size)
       && (const_size / BITS_PER_UNIT
          <= param_dse_max_object_size))
     {


More information about the Gcc-bugs mailing list