public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Andrew Macleod <amacleod@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-4209] Ranger: More efficient zero/nonzero check.
Date: Wed,  6 Oct 2021 14:52:16 +0000 (GMT)	[thread overview]
Message-ID: <20211006145216.654BA3857C7B@sourceware.org> (raw)

https://gcc.gnu.org/g:4b8ca6c6177b2bd948c1cb2a116955b942751559

commit r12-4209-g4b8ca6c6177b2bd948c1cb2a116955b942751559
Author: Andrew MacLeod <amacleod@redhat.com>
Date:   Mon Sep 27 18:53:54 2021 -0400

    Ranger: More efficient zero/nonzero check.
    
    A recent change introduced a frequent check for zero and non-zero which has
    caused a lot of extra temporary trees to be created.  Make the check more
    efficent as it is always a pointer and thus unsigned.
    
            * gimple-range-cache.cc (non_null_ref::adjust_range): Check for
            zero and non-zero more efficently.

Diff:
---
 gcc/gimple-range-cache.cc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc/gimple-range-cache.cc b/gcc/gimple-range-cache.cc
index 61043d3f375..91dd5a5c087 100644
--- a/gcc/gimple-range-cache.cc
+++ b/gcc/gimple-range-cache.cc
@@ -98,9 +98,10 @@ non_null_ref::adjust_range (irange &r, tree name, basic_block bb,
     return false;
 
   // We only care about the null / non-null property of pointers.
-  if (!POINTER_TYPE_P (TREE_TYPE (name)) || r.zero_p () || r.nonzero_p ())
+  if (!POINTER_TYPE_P (TREE_TYPE (name)))
+    return false;
+  if (r.undefined_p () || r.lower_bound () != 0 || r.upper_bound () == 0)
     return false;
-
   // Check if pointers have any non-null dereferences.
   if (non_null_deref_p (name, bb, search_dom))
     {


                 reply	other threads:[~2021-10-06 14:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20211006145216.654BA3857C7B@sourceware.org \
    --to=amacleod@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /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).