This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFA] [PATCH 4/4] Ignore reads of "dead" memory locations in DSE
- From: Richard Sandiford <richard dot sandiford at linaro dot org>
- To: Jeff Law <law at redhat dot com>
- Cc: Richard Biener <richard dot guenther at gmail dot com>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 02 Oct 2017 17:36:40 +0100
- Subject: Re: [RFA] [PATCH 4/4] Ignore reads of "dead" memory locations in DSE
- Authentication-results: sourceware.org; auth=none
- References: <caf857de-0fdd-8a89-0f97-6764a8a9a6c1@redhat.com> <CAFiYyc2DMVcqSADbp-aymHo5TybD=jMY-g0FBAsBEBT+ONheCg@mail.gmail.com> <55bc5137-7a62-2e89-d678-addfe8e66079@redhat.com>
Jeff Law <law@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