[1/7] check_types_equal: short circuit check if identical pointers are used

Message ID 1454606973-31017-2-git-send-email-jeffm@suse.com
State New, archived
Headers

Commit Message

Jeff Mahoney Feb. 4, 2016, 5:29 p.m. UTC
  From: Jeff Mahoney <jeffm@suse.com>

If two types share identical pointers, we don't need to check typedefs
before comparing the result.
---
 gdb/gdbtypes.c | 3 +++
 1 file changed, 3 insertions(+)
  

Patch

diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index b9850cf..1b6f276 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -3218,6 +3218,9 @@  static int
 check_types_equal (struct type *type1, struct type *type2,
 		   VEC (type_equality_entry_d) **worklist)
 {
+  if (type1 == type2)
+    return 1;
+
   type1 = check_typedef (type1);
   type2 = check_typedef (type2);