From 606711a1671cc63713b893c4557df967a5a6ac20 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Thu, 7 Mar 2019 16:33:52 +0100 Subject: [PATCH] Significantly speed up verifiers for a cgraph_node with many clones. 2019-03-07 Martin Liska * 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 | 7 +++++++ gcc/cgraph.c | 14 +++++++------- gcc/symtab.c | 39 +++++++++++++++++++++++---------------- 3 files changed, 37 insertions(+), 23 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 507c8e14524..e62b5e58fab 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-03-07 Martin Liska + + * 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 PR c++/80916 - spurious "static but not defined" warning. diff --git a/gcc/cgraph.c b/gcc/cgraph.c index de82316d4b1..dfe1833ed1d 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -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) diff --git a/gcc/symtab.c b/gcc/symtab.c index c9fa16b353b..16a21359f8d 100644 --- a/gcc/symtab.c +++ b/gcc/symtab.c @@ -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 (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 (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 -- 2.30.2