Speedup common case of the type values being in the same order.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@78585
138bc75d-0d04-0410-961f-
82ee72b054a4
+2004-02-27 Andrew Pinski <apinski@apple.com>
+
+ * c-typeck.c (tagged_types_tu_compatible_p) <ENUMERAL_TYPE>:
+ Speedup common case of the type values being in the same order.
+
2004-02-27 Steve Ellcey <sje@cup.hp.com>
* config/ia64/ia64.h (no-inline-float-divide): New option.
{
case ENUMERAL_TYPE:
{
+
+ /* Speed up the case where the type values are in the same order. */
+ tree tv1 = TYPE_VALUES (t1);
+ tree tv2 = TYPE_VALUES (t2);
+
+ if (tv1 == tv2)
+ return 1;
+
+ for (;tv1 && tv2; tv1 = TREE_CHAIN (tv2), tv2 = TREE_CHAIN (tv2))
+ {
+ if (TREE_PURPOSE (tv1) != TREE_PURPOSE (tv1))
+ break;
+ if (simple_cst_equal (TREE_VALUE (tv1), TREE_VALUE (tv2)) != 1)
+ return 0;
+ }
+
+ if (tv1 == NULL_TREE && tv2 == NULL_TREE)
+ return 1;
+ if (tv1 == NULL_TREE || tv2 == NULL_TREE)
+ return 0;
+
if (list_length (TYPE_VALUES (t1)) != list_length (TYPE_VALUES (t2)))
return 0;