From: Andrew MacLeod <amacleod@redhat.com>
To: gcc-patches <gcc-patches@gcc.gnu.org>
Cc: "hernandez, aldy" <aldyh@redhat.com>
Subject: [COMMITTED 2/5] Quicker relation check.
Date: Wed, 26 Apr 2023 15:26:21 -0400 [thread overview]
Message-ID: <28bd16f7-f334-3245-c444-65a23e98d020@redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 224 bytes --]
If either of the SSA names in a comparison do not have any equivalences
or relations, we can short-circuit the check slightly and be a bit faster.
Bootstrapped on x86_64-pc-linux-gnu with no regressions. Pushed.
Andrew
[-- Attachment #2: 0002-Quicker-relation-check.patch --]
[-- Type: text/x-patch, Size: 1709 bytes --]
From ee03aca78fb5739f4cd76cb30332f8aff2c5243a Mon Sep 17 00:00:00 2001
From: Andrew MacLeod <amacleod@redhat.com>
Date: Wed, 8 Feb 2023 12:36:23 -0500
Subject: [PATCH 2/5] Quicker relation check.
If either of the SSA names in a comparison do not have any equivalences
or relations, we can short-circuit the check slightly.
* value-relation.cc (dom_oracle::query_relation): Check early for lack
of any relation.
* value-relation.h (equiv_oracle::has_equiv_p): New.
---
gcc/value-relation.cc | 6 ++++++
gcc/value-relation.h | 1 +
2 files changed, 7 insertions(+)
diff --git a/gcc/value-relation.cc b/gcc/value-relation.cc
index 30a02d3c9d3..65cf7694d40 100644
--- a/gcc/value-relation.cc
+++ b/gcc/value-relation.cc
@@ -1374,6 +1374,12 @@ dom_oracle::query_relation (basic_block bb, tree ssa1, tree ssa2)
if (v1 == v2)
return VREL_EQ;
+ // If v1 or v2 do not have any relations or equivalences, a partial
+ // equivalence is the only possibility.
+ if ((!bitmap_bit_p (m_relation_set, v1) && !has_equiv_p (v1))
+ || (!bitmap_bit_p (m_relation_set, v2) && !has_equiv_p (v2)))
+ return partial_equiv (ssa1, ssa2);
+
// Check for equivalence first. They must be in each equivalency set.
const_bitmap equiv1 = equiv_set (ssa1, bb);
const_bitmap equiv2 = equiv_set (ssa2, bb);
diff --git a/gcc/value-relation.h b/gcc/value-relation.h
index 3177ecb1ad0..be6e277421b 100644
--- a/gcc/value-relation.h
+++ b/gcc/value-relation.h
@@ -170,6 +170,7 @@ public:
void dump (FILE *f) const override;
protected:
+ inline bool has_equiv_p (unsigned v) { return bitmap_bit_p (m_equiv_set, v); }
bitmap_obstack m_bitmaps;
struct obstack m_chain_obstack;
private:
--
2.39.2
reply other threads:[~2023-04-26 19:26 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=28bd16f7-f334-3245-c444-65a23e98d020@redhat.com \
--to=amacleod@redhat.com \
--cc=aldyh@redhat.com \
--cc=gcc-patches@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).