From patchwork Sun Apr 14 19:57:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 88467 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2F1D33858D34 for ; Sun, 14 Apr 2024 19:58:16 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by sourceware.org (Postfix) with ESMTPS id 6D14E3858D34 for ; Sun, 14 Apr 2024 19:57:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6D14E3858D34 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6D14E3858D34 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::431 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713124665; cv=none; b=KefOviRkBFyt0HjyznGGxiiGXqfPjlXykftxFbS+wtoal+9hO500/pml4Q4Ge+weNGUEfbN8LX6FiuWYd6uffqz6SJTWLLKCSaFVcTC8UUujx1a9PCSQGs2z51mFHNl6v+5HNbUjZJriD17EnKTFDW0ptzWHtkPqWyX1xDXN2fw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713124665; c=relaxed/simple; bh=OrEMIGPqcmgNq1+MgDvhWy0IQL6rrfuS72OLEt9/PFY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Iyfqme2r/Rh7VHAS/9E+2GJCyK5wLUQGml3wT6rgCVjAYDQLKYP/G2WFZgRqESMTyprqhchqAw8ZZPM9qH7iRsCw39YAxjqd+IzN5/LjfXvbsAlA2UBIChyTEHpWsX54Mu0BmR56fzUZ5SxpEgAKXqAnI8onK8m2nqHFQOE6ZAE= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-6eff2be3b33so157394b3a.2 for ; Sun, 14 Apr 2024 12:57:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713124662; x=1713729462; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=uVoWq2RaCbSMpZjRDw2DxSX0n+BZmJUGV7UuS+esQfw=; b=fhRX5iCJF125SRTzK7yMf1wjYHfw/8Ch72iANvLE8DHwq4qliw+PPg0w2La9Hr348U T8hJLtPtz/7zaADWJQv2/gbIiZY+TqMfUZGJPbHyqpOH5Fa5rlznQCT8aP8Bmb6IhNw9 98JYmzRiXzpZuejHA3lxGGsOMBUgjyLTWId+ORbUoQhABXBb/V7fq2b61DBFckKG0pDq 3fzVBESzZ74Mrm1Xp0qS0cR8whfa/RzMN07eKn2SIrAJ8rN/TYPPK/2w67uqM8DlrDIg i4Xvjj+/Gl6RgRs9fVT+czvpoyZ8QyuwsejjdqLLh1UoLshpbJ1KO3gPwvHVWvEBy1VA o5gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713124662; x=1713729462; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=uVoWq2RaCbSMpZjRDw2DxSX0n+BZmJUGV7UuS+esQfw=; b=Bx7y4IlgJzwD11S7pY5BbiniHq8zBy6Ei1pC5SrqzpUuy8QPPeFc+M2CaiULg90FaF ambKZ6mB8JjjK9QTTzGRPFTuy/VxKujBxaNTPQn7bveLHPzmRIdPZmGv5PNnVivMKQ4p Qbv7zAXRZSppDJTvfy1kAiyHH4eIIYQp2FWBjw0iy48jfvsUmvsTJ86qFCI3TBP1fO2Q DLuf49z38Op7D1WM4g0lP7EZPm0zD6E812sEhVNH9v45RilXm+sHPNN1WZ2C9cvIxqQN 0yw+TXf2EPdmDY8+65rNM+aLX+2Vgm5nV0nJxdIDSvyX5sQANDLbEIvHspPwNAk+yL2T WN6Q== X-Gm-Message-State: AOJu0YzxesLhBZhifbCzDWlKmWHHozaKSZIcpeXw3v3DovPdVSWp2Dy6 hCbXSPN7hNsPC6MIa3qrvn+qYoBrXOQzeQM4L3RzOOSKhddDewBiHw8tTw== X-Google-Smtp-Source: AGHT+IF52AaZtMvy4GucerhmH4uPWtGamv7X1P7sN8CYd0WyRBrzqOiIpBpaSheXBvwPIwlCM0GiaA== X-Received: by 2002:a05:6a00:3d01:b0:6ea:c156:f8dd with SMTP id lo1-20020a056a003d0100b006eac156f8ddmr7866977pfb.11.1713124661883; Sun, 14 Apr 2024 12:57:41 -0700 (PDT) Received: from gnu-cfl-3.localdomain ([172.56.168.158]) by smtp.gmail.com with ESMTPSA id gx13-20020a056a001e0d00b006ecf25d0b8dsm5935472pfb.184.2024.04.14.12.57.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Apr 2024 12:57:41 -0700 (PDT) Received: from gnu-cfl-3.. (localhost [IPv6:::1]) by gnu-cfl-3.localdomain (Postfix) with ESMTP id 2174274032A; Sun, 14 Apr 2024 12:57:40 -0700 (PDT) From: "H.J. Lu" To: gcc-patches@gcc.gnu.org Cc: hubicka@ucw.cz, rguenther@suse.de Subject: [Backport 1/2] tree-profile: Disable indirect call profiling for IFUNC resolvers Date: Sun, 14 Apr 2024 12:57:39 -0700 Message-ID: <20240414195740.237329-1-hjl.tools@gmail.com> X-Mailer: git-send-email 2.44.0 MIME-Version: 1.0 X-Spam-Status: No, score=-3022.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org We can't profile indirect calls to IFUNC resolvers nor their callees as it requires TLS which hasn't been set up yet when the dynamic linker is resolving IFUNC symbols. Add an IFUNC resolver caller marker to cgraph_node and set it if the function is called by an IFUNC resolver. Disable indirect call profiling for IFUNC resolvers and their callees. Tested with profiledbootstrap on Fedora 39/x86-64. gcc/ChangeLog: PR tree-optimization/114115 * cgraph.h (symtab_node): Add check_ifunc_callee_symtab_nodes. (cgraph_node): Add called_by_ifunc_resolver. * cgraphunit.cc (symbol_table::compile): Call symtab_node::check_ifunc_callee_symtab_nodes. * symtab.cc (check_ifunc_resolver): New. (ifunc_ref_map): Likewise. (is_caller_ifunc_resolver): Likewise. (symtab_node::check_ifunc_callee_symtab_nodes): Likewise. * tree-profile.cc (gimple_gen_ic_func_profiler): Disable indirect call profiling for IFUNC resolvers and their callees. gcc/testsuite/ChangeLog: PR tree-optimization/114115 * gcc.dg/pr114115.c: New test. (cherry picked from commit cab32bacaea268ec062b1fb4fc662d90c9d1cfce) --- gcc/cgraph.h | 6 +++ gcc/cgraphunit.cc | 2 + gcc/symtab.cc | 89 +++++++++++++++++++++++++++++++++ gcc/testsuite/gcc.dg/pr114115.c | 24 +++++++++ gcc/tree-profile.cc | 8 ++- 5 files changed, 128 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/pr114115.c diff --git a/gcc/cgraph.h b/gcc/cgraph.h index c1a3691b6f5..430c87d8bb7 100644 --- a/gcc/cgraph.h +++ b/gcc/cgraph.h @@ -479,6 +479,9 @@ public: Return NULL if there's no such node. */ static symtab_node *get_for_asmname (const_tree asmname); + /* Check symbol table for callees of IFUNC resolvers. */ + static void check_ifunc_callee_symtab_nodes (void); + /* Verify symbol table for internal consistency. */ static DEBUG_FUNCTION void verify_symtab_nodes (void); @@ -896,6 +899,7 @@ struct GTY((tag ("SYMTAB_FUNCTION"))) cgraph_node : public symtab_node redefined_extern_inline (false), tm_may_enter_irr (false), ipcp_clone (false), declare_variant_alt (false), calls_declare_variant_alt (false), gc_candidate (false), + called_by_ifunc_resolver (false), m_uid (uid), m_summary_id (-1) {} @@ -1491,6 +1495,8 @@ struct GTY((tag ("SYMTAB_FUNCTION"))) cgraph_node : public symtab_node is set for local SIMD clones when they are created and cleared if the vectorizer uses them. */ unsigned gc_candidate : 1; + /* Set if the function is called by an IFUNC resolver. */ + unsigned called_by_ifunc_resolver : 1; private: /* Unique id of the node. */ diff --git a/gcc/cgraphunit.cc b/gcc/cgraphunit.cc index bccd2f2abb5..40dcceccca5 100644 --- a/gcc/cgraphunit.cc +++ b/gcc/cgraphunit.cc @@ -2313,6 +2313,8 @@ symbol_table::compile (void) symtab_node::checking_verify_symtab_nodes (); + symtab_node::check_ifunc_callee_symtab_nodes (); + timevar_push (TV_CGRAPHOPT); if (pre_ipa_mem_report) dump_memory_report ("Memory consumption before IPA"); diff --git a/gcc/symtab.cc b/gcc/symtab.cc index 0470509a98d..df09def81e9 100644 --- a/gcc/symtab.cc +++ b/gcc/symtab.cc @@ -1369,6 +1369,95 @@ symtab_node::verify (void) timevar_pop (TV_CGRAPH_VERIFY); } +/* Return true and set *DATA to true if NODE is an ifunc resolver. */ + +static bool +check_ifunc_resolver (cgraph_node *node, void *data) +{ + if (node->ifunc_resolver) + { + bool *is_ifunc_resolver = (bool *) data; + *is_ifunc_resolver = true; + return true; + } + return false; +} + +static auto_bitmap ifunc_ref_map; + +/* Return true if any caller of NODE is an ifunc resolver. */ + +static bool +is_caller_ifunc_resolver (cgraph_node *node) +{ + bool is_ifunc_resolver = false; + + for (cgraph_edge *e = node->callers; e; e = e->next_caller) + { + /* Return true if caller is known to be an IFUNC resolver. */ + if (e->caller->called_by_ifunc_resolver) + return true; + + /* Check for recursive call. */ + if (e->caller == node) + continue; + + /* Skip if it has been visited. */ + unsigned int uid = e->caller->get_uid (); + if (bitmap_bit_p (ifunc_ref_map, uid)) + continue; + bitmap_set_bit (ifunc_ref_map, uid); + + if (is_caller_ifunc_resolver (e->caller)) + { + /* Return true if caller is an IFUNC resolver. */ + e->caller->called_by_ifunc_resolver = true; + return true; + } + + /* Check if caller's alias is an IFUNC resolver. */ + e->caller->call_for_symbol_and_aliases (check_ifunc_resolver, + &is_ifunc_resolver, + true); + if (is_ifunc_resolver) + { + /* Return true if caller's alias is an IFUNC resolver. */ + e->caller->called_by_ifunc_resolver = true; + return true; + } + } + + return false; +} + +/* Check symbol table for callees of IFUNC resolvers. */ + +void +symtab_node::check_ifunc_callee_symtab_nodes (void) +{ + symtab_node *node; + + FOR_EACH_SYMBOL (node) + { + cgraph_node *cnode = dyn_cast (node); + if (!cnode) + continue; + + unsigned int uid = cnode->get_uid (); + if (bitmap_bit_p (ifunc_ref_map, uid)) + continue; + bitmap_set_bit (ifunc_ref_map, uid); + + bool is_ifunc_resolver = false; + cnode->call_for_symbol_and_aliases (check_ifunc_resolver, + &is_ifunc_resolver, true); + if (is_ifunc_resolver || is_caller_ifunc_resolver (cnode)) + cnode->called_by_ifunc_resolver = true; + } + + bitmap_clear (ifunc_ref_map); +} + /* Verify symbol table for internal consistency. */ DEBUG_FUNCTION void diff --git a/gcc/testsuite/gcc.dg/pr114115.c b/gcc/testsuite/gcc.dg/pr114115.c new file mode 100644 index 00000000000..2629f591877 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr114115.c @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-options "-O0 -fprofile-generate -fdump-tree-optimized" } */ +/* { dg-require-profiling "-fprofile-generate" } */ +/* { dg-require-ifunc "" } */ + +void *foo_ifunc2() __attribute__((ifunc("foo_resolver"))); + +void bar(void) +{ +} + +static int f3() +{ + bar (); + return 5; +} + +void (*foo_resolver(void))(void) +{ + f3(); + return bar; +} + +/* { dg-final { scan-tree-dump-not "__gcov_indirect_call_profiler_v" "optimized" } } */ diff --git a/gcc/tree-profile.cc b/gcc/tree-profile.cc index da300d5f9e8..b5de0fb914f 100644 --- a/gcc/tree-profile.cc +++ b/gcc/tree-profile.cc @@ -418,7 +418,13 @@ gimple_gen_ic_func_profiler (void) gcall *stmt1; tree tree_uid, cur_func, void0; - if (c_node->only_called_directly_p ()) + /* Disable indirect call profiling for an IFUNC resolver and its + callees since it requires TLS which hasn't been set up yet when + the dynamic linker is resolving IFUNC symbols. See + https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114115 + */ + if (c_node->only_called_directly_p () + || c_node->called_by_ifunc_resolver) return; gimple_init_gcov_profiler (); From patchwork Sun Apr 14 19:57:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 88468 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EA2DA3846403 for ; Sun, 14 Apr 2024 19:58:19 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by sourceware.org (Postfix) with ESMTPS id 736873858C62 for ; Sun, 14 Apr 2024 19:57:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 736873858C62 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 736873858C62 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::630 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713124671; cv=none; b=tcYXlCCED8v2hiUBa8Sl4XPEkqpA51zv61SD/jbr0UMJQN4Vo6iWUi3j1+TJ7sqhTd7hAxEP56JRuNs4c3wvjVB56VHdW37MbgXWInRyn3ELWu+flE6eM4OPnf/JOFhAoYdR1lfUZJo9ILKaNVSdz1LwpKNaxhSGsxZXTX2uyPM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713124671; c=relaxed/simple; bh=h8pjQoMimEyDtIOl7qYxRQmlaBMrQ2w6U5O6UoEbN8o=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Mck7s6jwjCNiRYGDbZR/0oI+y8p5AICvJ57pRokpMtYgvLtZ0EfFpPXcS3DU3t/rH8nq97fbjro/swOlFGAO7ZNCt/j2dt//JV+sBuuaA13vQsSRCuzEi75zOW4iA+PN27+o5auL/dOgxtCcz7mPXtfXtTKFFYkJ8HQQhhtG5r8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1e3c9300c65so19837805ad.0 for ; Sun, 14 Apr 2024 12:57:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713124668; x=1713729468; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Bg93hWRI2YlxHjtpQyI5ebhNwsZG9gdZXUJr+LbxD1k=; b=lep2aVJ9jvi5oKACweA9ZDXPPiym8H6uXu52tzMd/pikRWrLJizXMCQYlG9svsEXIG pgwtxtP+hukxA9F5DQXL+IaZ6tRiMNatuRcgzRaKiIRKx901tC+RE6fIFO59e1HoMcxQ u7fG1Qs0POF4u7Vw6aIhHoZdUaQCxW+bbyu4/PXV41XdP+C/qhO8xxH4AgxnLEjPW9Uw 5P3r1fpqzIYvRp0WdIzbHpIMtvtq4UtyHBWGqV/GIA7gTkw+SzdiSXsGFs+UX9QYaV1f 0hJlebpu5FQUktQBXGknNbSYEWEqyXtTKdp0zjZ7xDjddAxbMhEzhfQUSEhZbHrb72/c BdtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713124668; x=1713729468; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Bg93hWRI2YlxHjtpQyI5ebhNwsZG9gdZXUJr+LbxD1k=; b=LD4SJsm/2a2/Ya879vhTOZNEkA82GMdigqJ7fy7FJXS3ksIHkTC6aLmWyS+pMgZoWl t76QOvf0njMOdVjECsmBP3FaQB99yvDd5+vk11ANuV0tKtDgVJfF0XfnbK/7pBYUVDBO CfjYr9DeGybkZnXp+iB1o9pPQYRLhJ6/lnxcQR9LDZa5+vB03KpK/S1TXzp62ocx8S1E C90B1Z85HNceYyL01sR+VUX6Bb+1dhsKlInfdPfyupGUHvv3PbIsbdogxgfBqmYZCHNN td/nlK3MBBsbYw/mxcLheei1cWJySeJZv51mMKyJm8xMD+ydHYcaUg8X9JuVwiL/tOiA nRlg== X-Gm-Message-State: AOJu0YwJAOmGC5tsOJwZIrrMfMcyZHPsGWZKYAIW5/2fxTAsBxxBCO+x 4dtuZO2G08wnhGl/UWLcHclbOXeP+4HCoIlhyQ4Ogaauijc282twU/RxMA== X-Google-Smtp-Source: AGHT+IHZ1fieoecSxL4/Wko/S9RsBIHm5JKDbjaLeaMSBAwe/mQo4Rhgs6U6wEtQBh8rkd79UmR+Ew== X-Received: by 2002:a17:902:7289:b0:1e4:45b8:7b6 with SMTP id d9-20020a170902728900b001e445b807b6mr6378783pll.48.1713124668045; Sun, 14 Apr 2024 12:57:48 -0700 (PDT) Received: from gnu-cfl-3.localdomain ([172.56.168.158]) by smtp.gmail.com with ESMTPSA id w23-20020a1709026f1700b001e5c6c399d7sm1080818plk.180.2024.04.14.12.57.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Apr 2024 12:57:47 -0700 (PDT) Received: from gnu-cfl-3.. (localhost [IPv6:::1]) by gnu-cfl-3.localdomain (Postfix) with ESMTP id 3AE7474032A; Sun, 14 Apr 2024 12:57:46 -0700 (PDT) From: "H.J. Lu" To: gcc-patches@gcc.gnu.org Cc: hubicka@ucw.cz, rguenther@suse.de Subject: [Backport 2/2] middle-end/114599 - fix bitmap allocation for check_ifunc_callee_symtab_nodes Date: Sun, 14 Apr 2024 12:57:40 -0700 Message-ID: <20240414195740.237329-2-hjl.tools@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240414195740.237329-1-hjl.tools@gmail.com> References: <20240414195740.237329-1-hjl.tools@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-3022.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org From: Richard Biener 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. (cherry picked from commit 9ab8fdfeef5b1a47b358e08a98177b2fad65fed9) --- gcc/symtab.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gcc/symtab.cc b/gcc/symtab.cc index df09def81e9..10ec6d03842 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. */