Significantly speed up verifiers for a cgraph_node with many clones.
authorMartin Liska <mliska@suse.cz>
Thu, 7 Mar 2019 15:33:52 +0000 (16:33 +0100)
committerMartin Liska <marxin@gcc.gnu.org>
Thu, 7 Mar 2019 15:33:52 +0000 (15:33 +0000)
2019-03-07  Martin Liska  <mliska@suse.cz>

* cgraph.c (cgraph_node::verify_node): Verify with a neighbour
which is equivalent to searching for this in clones chain.
* symtab.c (symtab_node::verify_base): Similarly compare ASM
names with a neighbour and special case first node in a chain.

From-SVN: r269461

gcc/ChangeLog
gcc/cgraph.c
gcc/symtab.c

index 507c8e1452430f7899de292b2c5a5f753a9a99fe..e62b5e58fab0792ae0394ab366c5cfa23737e092 100644 (file)
@@ -1,3 +1,10 @@
+2019-03-07  Martin Liska  <mliska@suse.cz>
+
+       * cgraph.c (cgraph_node::verify_node): Verify with a neighbour
+       which is equivalent to searching for this in clones chain.
+       * symtab.c (symtab_node::verify_base): Similarly compare ASM
+       names with a neighbour and special case first node in a chain.
+
 2019-01-25  Jason Merrill  <jason@redhat.com>
 
        PR c++/80916 - spurious "static but not defined" warning.
index de82316d4b1957e713763c32f4eb8d099bac67e9..dfe1833ed1dd29962462f9edfc3799d52f7d85df 100644 (file)
@@ -3240,14 +3240,14 @@ cgraph_node::verify_node (void)
 
   if (clone_of)
     {
-      cgraph_node *n;
-      for (n = clone_of->clones; n; n = n->next_sibling_clone)
-       if (n == this)
-         break;
-      if (!n)
+      cgraph_node *first_clone = clone_of->clones;
+      if (first_clone != this)
        {
-         error ("cgraph_node has wrong clone_of");
-         error_found = true;
+         if (prev_sibling_clone->clone_of != clone_of)
+           {
+             error ("cgraph_node has wrong clone_of");
+             error_found = true;
+           }
        }
     }
   if (clones)
index c9fa16b353bc973ae8b88bf558f401a6f0278cad..16a21359f8dd8719405e58aaa2444b87bb066d52 100644 (file)
@@ -1040,23 +1040,30 @@ symtab_node::verify_base (void)
   if (symtab->assembler_name_hash)
     {
       hashed_node = symtab_node::get_for_asmname (DECL_ASSEMBLER_NAME (decl));
-      if (hashed_node && hashed_node->previous_sharing_asm_name)
+      if (hashed_node)
        {
-          error ("assembler name hash list corrupted");
-          error_found = true;
-       }
-      while (hashed_node)
-       {
-         if (hashed_node == this)
-           break;
-         hashed_node = hashed_node->next_sharing_asm_name;
-       }
-      if (!hashed_node
-         && !(is_a <varpool_node *> (this)
-              && DECL_HARD_REGISTER (decl)))
-       {
-          error ("node not found in symtab assembler name hash");
-          error_found = true;
+         if (hashed_node->previous_sharing_asm_name)
+           {
+             error ("assembler name hash list corrupted");
+             error_found = true;
+           }
+         else if (previous_sharing_asm_name == NULL)
+           {
+             if (hashed_node != this)
+               {
+                 error ("assembler name hash list corrupted");
+                 error_found = true;
+               }
+           }
+         else if (!(is_a <varpool_node *> (this) && DECL_HARD_REGISTER (decl)))
+           {
+             if (!asmname_hasher::equal (previous_sharing_asm_name,
+                                         DECL_ASSEMBLER_NAME (decl)))
+               {
+                 error ("node not found in symtab assembler name hash");
+                 error_found = true;
+               }
+           }
        }
     }
   if (previous_sharing_asm_name