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: 1923518 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=lep2aVJ9; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VHh1h3s8lz1yYP for ; Mon, 15 Apr 2024 05:58:14 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2EACD3846403 for ; Sun, 14 Apr 2024 19:58:11 +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+incoming=patchwork.ozlabs.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. */