Jeff Law <l...@redhat.com> writes: > @@ -468,6 +468,36 @@ maybe_trim_partially_dead_store (ao_ref *ref, sbitmap > live, gimple *stmt) > } > } > > +/* Return TRUE if USE_REF reads bytes from LIVE where live is > + derived from REF, a write reference. > + > + While this routine may modify USE_REF, it's passed by value, not > + location. So callers do not see those modifications. */ > + > +static bool > +live_bytes_read (ao_ref use_ref, ao_ref *ref, sbitmap live) > +{ > + /* We have already verified that USE_REF and REF hit the same object. > + Now verify that there's actually an overlap between USE_REF and REF. */ > + if (ranges_overlap_p (use_ref.offset, use_ref.size, ref->offset, > ref->size)) > + { > + normalize_ref (&use_ref, ref); > + > + /* If USE_REF covers all of REF, then it will hit one or more > + live bytes. This avoids useless iteration over the bitmap > + below. */ > + if (use_ref.offset <= ref->offset > + && use_ref.offset + use_ref.size >= ref->offset + ref->size) > + return true; > + > + /* 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; > + return bitmap_bit_in_range_p (live, start, end); > + } > + return true; > +}
When rebasing the SVE changes on top of this, I wasn't sure why the function returned true rather than false when there's no overlap. Is that deliberate? It might be worth a comment if so. Thanks, Richard