public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <richard.sandiford@linaro.org>
To: Jeff Law <law@redhat.com>
Cc: Richard Biener <richard.guenther@gmail.com>,
	 gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [RFA] [PATCH 4/4] Ignore reads of "dead" memory locations in DSE
Date: Mon, 02 Oct 2017 16:36:00 -0000	[thread overview]
Message-ID: <87fub1wlpj.fsf@linaro.org> (raw)
In-Reply-To: <55bc5137-7a62-2e89-d678-addfe8e66079@redhat.com> (Jeff Law's	message of "Wed, 6 Sep 2017 16:18:59 -0600")

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

  reply	other threads:[~2017-10-02 16:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-22 11:00 Jeff Law
2017-01-04 13:50 ` Richard Biener
2017-09-06 22:19   ` Jeff Law
2017-10-02 16:36     ` Richard Sandiford [this message]
2017-10-05 19:40     ` Christophe Lyon
2017-10-09 11:12       ` Christophe Lyon
  -- strict thread matches above, loose matches on Subject: below --
2016-12-16  2:16 Jeff Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fub1wlpj.fsf@linaro.org \
    --to=richard.sandiford@linaro.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=law@redhat.com \
    --cc=richard.guenther@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).