[PATCH][RFC] Improve get_qualified_type linear list walk

Michael Matz matz@suse.de
Tue Apr 16 16:14:00 GMT 2019


Hi,

On Tue, 16 Apr 2019, Richard Biener wrote:

> Comments?

I was quickly testing also with some early-outs but didn't get conclusive 
performance results (but really only superficial testing) so I'm not 
proposing it, like so:

diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 7045284..33f56f9 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -1508,6 +1508,10 @@ same_type_ignoring_top_level_qualifiers_p (tree 
   if (type1 == error_mark_node || type2 == error_mark_node)
     return false;
 
+  if (type1 == type2)
+    return true;
+  if (TYPE_MAIN_VARIANT (type1) != TYPE_MAIN_VARIANT (type2))
+    return false;
   type1 = cp_build_qualified_type (type1, TYPE_UNQUALIFIED);
   type2 = cp_build_qualified_type (type2, TYPE_UNQUALIFIED);


Ciao,
Michael.



More information about the Gcc-patches mailing list