From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1666) id D9CEA3858C32; Fri, 5 Apr 2024 09:13:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D9CEA3858C32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1712308418; bh=4qtEfnLQMyU1Prw90EF3M/d0hqM9QQSL5iiwaXdrYD4=; h=From:To:Subject:Date:From; b=I688InkEurXw+6f0dvbhv6r3KZl/yYidXQGi/Vaf9hsw0TMgtz+t/E0TFWc93lnO8 gLSg8Ej1ltYSpXZ5AAI02OqypGRnu3yKY7dhGQ6ehoS9N5Ynm3AkNLVy2+mM8eHUEv 1Cog4VUf+E2rgzuYabaRDId8fCoQzP7kLp59/e6Q= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Richard Biener To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-9803] middle-end/114599 - fix bitmap allocation for check_ifunc_callee_symtab_nodes X-Act-Checkin: gcc X-Git-Author: Richard Biener X-Git-Refname: refs/heads/master X-Git-Oldrev: effd947fcc2bbe0dfbc7d470eab4bc65bd9b46c8 X-Git-Newrev: 9ab8fdfeef5b1a47b358e08a98177b2fad65fed9 Message-Id: <20240405091338.D9CEA3858C32@sourceware.org> Date: Fri, 5 Apr 2024 09:13:38 +0000 (GMT) List-Id: https://gcc.gnu.org/g:9ab8fdfeef5b1a47b358e08a98177b2fad65fed9 commit r14-9803-g9ab8fdfeef5b1a47b358e08a98177b2fad65fed9 Author: Richard Biener Date: Fri Apr 5 10:16:41 2024 +0200 middle-end/114599 - fix bitmap allocation for check_ifunc_callee_symtab_nodes There's no default bitmap obstack during global CTORs, so allocate the bitmap locally. PR middle-end/114599 PR gcov-profile/114115 * symtab.cc (ifunc_ref_map): Do not use auto_bitmap. (is_caller_ifunc_resolver): Optimize bitmap_bit_p/bitmap_set_bit pair. (symtab_node::check_ifunc_callee_symtab_nodes): Properly allocate ifunc_ref_map here. Diff: --- gcc/symtab.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gcc/symtab.cc b/gcc/symtab.cc index 3256133891d..3b018ab3ea2 100644 --- a/gcc/symtab.cc +++ b/gcc/symtab.cc @@ -1383,7 +1383,7 @@ check_ifunc_resolver (cgraph_node *node, void *data) return false; } -static auto_bitmap ifunc_ref_map; +static bitmap ifunc_ref_map; /* Return true if any caller of NODE is an ifunc resolver. */ @@ -1404,9 +1404,8 @@ is_caller_ifunc_resolver (cgraph_node *node) /* Skip if it has been visited. */ unsigned int uid = e->caller->get_uid (); - if (bitmap_bit_p (ifunc_ref_map, uid)) + if (!bitmap_set_bit (ifunc_ref_map, uid)) continue; - bitmap_set_bit (ifunc_ref_map, uid); if (is_caller_ifunc_resolver (e->caller)) { @@ -1437,6 +1436,9 @@ symtab_node::check_ifunc_callee_symtab_nodes (void) { symtab_node *node; + bitmap_obstack_initialize (NULL); + ifunc_ref_map = BITMAP_ALLOC (NULL); + FOR_EACH_SYMBOL (node) { cgraph_node *cnode = dyn_cast (node); @@ -1455,7 +1457,8 @@ symtab_node::check_ifunc_callee_symtab_nodes (void) cnode->called_by_ifunc_resolver = true; } - bitmap_clear (ifunc_ref_map); + BITMAP_FREE (ifunc_ref_map); + bitmap_obstack_release (NULL); } /* Verify symbol table for internal consistency. */