]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Quicker relation check.
authorAndrew MacLeod <amacleod@redhat.com>
Wed, 8 Feb 2023 17:36:23 +0000 (12:36 -0500)
committerAndrew MacLeod <amacleod@redhat.com>
Wed, 26 Apr 2023 19:17:08 +0000 (15:17 -0400)
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
gcc/value-relation.h

index 30a02d3c9d36c84e1010682dc7b550aa5123dd6c..65cf7694d404151311f6c915731591d55b9a41cb 100644 (file)
@@ -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);
index 3177ecb1ad0b0e9d0d4337168796df2fcca3ce2c..be6e277421bf16663afae3050e8f7505d6de02c4 100644 (file)
@@ -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: