OSDN Git Service

* gimple.c (type_pair_hash, type_pair_eq, lookup_type_pair):
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 9 May 2011 08:45:16 +0000 (08:45 +0000)
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 9 May 2011 08:45:16 +0000 (08:45 +0000)
Arrange type pairs to be UID ordered.
(gimple_lookup_type_leader): Make inline.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@173560 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/gimple.c

index d824cff..059909b 100644 (file)
@@ -1,3 +1,9 @@
+2011-05-08  Jan Hubicka  <jh@suse.cz>
+
+       * gimple.c (type_pair_hash, type_pair_eq, lookup_type_pair):
+       Arrange type pairs to be UID ordered.
+       (gimple_lookup_type_leader): Make inline.
+
 2011-05-09  Nick Clifton  <nickc@redhat.com>
 
        PR target/48897
index 0d28c1b..385c098 100644 (file)
@@ -3240,8 +3240,7 @@ type_pair_hash (const void *p)
   const struct type_pair_d *pair = (const struct type_pair_d *) p;
   hashval_t val1 = pair->uid1;
   hashval_t val2 = pair->uid2;
-  return (iterative_hash_hashval_t (val2, val1)
-         ^ iterative_hash_hashval_t (val1, val2));
+  return iterative_hash_hashval_t (val1, val2);
 }
 
 /* Compare two type pairs pointed-to by P1 and P2.  */
@@ -3251,8 +3250,7 @@ type_pair_eq (const void *p1, const void *p2)
 {
   const struct type_pair_d *pair1 = (const struct type_pair_d *) p1;
   const struct type_pair_d *pair2 = (const struct type_pair_d *) p2;
-  return ((pair1->uid1 == pair2->uid1 && pair1->uid2 == pair2->uid2)
-         || (pair1->uid1 == pair2->uid2 && pair1->uid2 == pair2->uid1));
+  return (pair1->uid1 == pair2->uid1 && pair1->uid2 == pair2->uid2);
 }
 
 /* Lookup the pair of types T1 and T2 in *VISITED_P.  Insert a new
@@ -3271,8 +3269,16 @@ lookup_type_pair (tree t1, tree t2, htab_t *visited_p, struct obstack *ob_p)
       gcc_obstack_init (ob_p);
     }
 
-  pair.uid1 = TYPE_UID (t1);
-  pair.uid2 = TYPE_UID (t2);
+  if (TYPE_UID (t1) < TYPE_UID (t2))
+    {
+      pair.uid1 = TYPE_UID (t1);
+      pair.uid2 = TYPE_UID (t2);
+    }
+  else
+    {
+      pair.uid1 = TYPE_UID (t2);
+      pair.uid2 = TYPE_UID (t1);
+    }
   slot = htab_find_slot (*visited_p, &pair, INSERT);
 
   if (*slot)
@@ -3280,8 +3286,8 @@ lookup_type_pair (tree t1, tree t2, htab_t *visited_p, struct obstack *ob_p)
   else
     {
       p = XOBNEW (ob_p, struct type_pair_d);
-      p->uid1 = TYPE_UID (t1);
-      p->uid2 = TYPE_UID (t2);
+      p->uid1 = pair.uid1;
+      p->uid2 = pair.uid2;
       p->same_p[0] = -2;
       p->same_p[1] = -2;
       *slot = (void *) p;
@@ -3324,7 +3330,7 @@ static GTY((deletable, length("GIMPLE_TYPE_LEADER_SIZE")))
 /* Lookup an existing leader for T and return it or NULL_TREE, if
    there is none in the cache.  */
 
-static tree
+static inline tree
 gimple_lookup_type_leader (tree t)
 {
   gimple_type_leader_entry *leader;