Message ID | 20231114220825.22074-1-sebastian.huber@embedded-brains.de |
---|---|
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:a59:b0:164:83eb:24d7 with SMTP id 25csp2232877rwb; Tue, 14 Nov 2023 14:09:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IH6KsT9rwFrFgQcwpDap+RoVKDxu3gWCwG9VgBWM/irNtc9wehUj5n17C3QpI7qYiNae2e0 X-Received: by 2002:a0c:d6c9:0:b0:66f:b58d:6f0a with SMTP id l9-20020a0cd6c9000000b0066fb58d6f0amr3392270qvi.9.1699999750233; Tue, 14 Nov 2023 14:09:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1699999750; cv=pass; d=google.com; s=arc-20160816; b=mDEIXJ/+OLxt1Zm15YUEfG4w64ZNhC51hFhw+UodeUnODNj3/VG9Mi1K73scsypOFD 04d92czitX/83ZV7oxRhUMIA/t69is5SyKy8ZFJBSIn+HcMHJRhuvamTo8AuA4IDMErU uano7DfYQgJ72ewf+IvIj//Bed22I7NgxyNbFqjHPyW39EsNqLh/xb5FTg3pCl4RnSZm X8UoKRjiX2pGGz0usrbpWQseegtJ6V1NKhInjuUNKIV9dvp4CaSsoCyKL1YOVo023OHO JNHQPj8ERy3o5L/PT6h743OZi2q9WkFAxAfBu2rKT6GGE9thvXpqTSQuJRdEJyCOheJw 5rcQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:arc-filter :dmarc-filter:delivered-to; bh=M0sqaN96b0Nvtspe0ypVdbKyh2MMKXyQJKJiUyMJdGA=; fh=hPrbWPhweUx4V0GV9uXJqbyAzg2ABmTz7kczrAQqMmM=; b=Eo52CJKHsyBvAf1nYhIfKGfClCFY3EroVer/paqFdjPBfckxiMtKmhKNLmF4HQ0sGN wHgNtJxuotv3R3pLTeqdHaPS/p1oIKRzTgA5nXWfKQtNDg/iODKdf88voXlxr17uiSKh li2oEBQCz75fK7a9bLMPgZQGN5R61b69TIiYTIEMIO3lt4K7dao4pqBESWLgSpDvzdVE kVGKqzmyJ/j/hdve4Yyl3xayg9Q3Sme86lLUftC6kOqfqVVs0sk/TYHE1lpaShRiVJUR X91jXqTkRY9G2YLBHaJRJOqg1jOZmk4WBNz2gTfyBlqjMScYLdd887Hcieg1RAk2Efhq dRiQ== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id v13-20020a0cc60d000000b0066cffc19388si7154923qvi.321.2023.11.14.14.09.10 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Nov 2023 14:09:10 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 23C0C3858438 for <ouuuleilei@gmail.com>; Tue, 14 Nov 2023 22:09:05 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from dedi548.your-server.de (dedi548.your-server.de [85.10.215.148]) by sourceware.org (Postfix) with ESMTPS id D1DFA3858D20 for <gcc-patches@gcc.gnu.org>; Tue, 14 Nov 2023 22:08:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D1DFA3858D20 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embedded-brains.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embedded-brains.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D1DFA3858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=85.10.215.148 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699999718; cv=none; b=u6Mm88yZJ7zzWZm2RmIEkEQZ2obIQ3f7QczxXqx3JkSsZdU77KlcNJq2JNjyBdmhTEm6ytEPTdm/AXgk383ZAOlq7NY3bnA/z71efxt6zWa7jLaFQYaitfSrDZdr7ePZKywz0TA6UpXj+GtQD6v5AhE6g1QgmoR2t5myPc7y5OY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699999718; c=relaxed/simple; bh=tASwwxHQtS033G2jQpAYK4bSiisvd5Xjhfthltcd4eo=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=qdAsQSJKeMTnP+hxwdLDsA7CwJB6yOcZU2QcMll8zPK0wAGpCFBFPxEb8kgs7QU4MfujcFwUmJQfwbNPHXxDxa/YdYnFKqdoFZYYBynCRy9k55wuRPxXf/EayzW0z6Ha2x5CZbj/IKZC67MzwA08Qw38WlvGJm8nkVJfNDgnNec= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from sslproxy05.your-server.de ([78.46.172.2]) by dedi548.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from <sebastian.huber@embedded-brains.de>) id 1r31aE-0000Sr-1n for gcc-patches@gcc.gnu.org; Tue, 14 Nov 2023 23:08:34 +0100 Received: from [82.100.198.138] (helo=mail.embedded-brains.de) by sslproxy05.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <sebastian.huber@embedded-brains.de>) id 1r31aD-000QJw-UO for gcc-patches@gcc.gnu.org; Tue, 14 Nov 2023 23:08:33 +0100 Received: from localhost (localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id 480B64801A4 for <gcc-patches@gcc.gnu.org>; Tue, 14 Nov 2023 23:08:33 +0100 (CET) Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavis, port 10032) with ESMTP id 8M2Fk9YbyzBy for <gcc-patches@gcc.gnu.org>; Tue, 14 Nov 2023 23:08:30 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id D10284801D2 for <gcc-patches@gcc.gnu.org>; Tue, 14 Nov 2023 23:08:29 +0100 (CET) X-Virus-Scanned: amavis at zimbra.eb.localhost Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavis, port 10026) with ESMTP id Ap1ugicm1CpW for <gcc-patches@gcc.gnu.org>; Tue, 14 Nov 2023 23:08:29 +0100 (CET) Received: from zimbra.eb.localhost (unknown [10.10.171.18]) by mail.embedded-brains.de (Postfix) with ESMTPSA id 802A648018B for <gcc-patches@gcc.gnu.org>; Tue, 14 Nov 2023 23:08:29 +0100 (CET) From: Sebastian Huber <sebastian.huber@embedded-brains.de> To: gcc-patches@gcc.gnu.org Subject: [PATCH 0/4] gcov: Improve -fprofile-update=atomic Date: Tue, 14 Nov 2023 23:08:21 +0100 Message-Id: <20231114220825.22074-1-sebastian.huber@embedded-brains.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Authenticated-Sender: smtp-embedded@poldi-networks.de X-Virus-Scanned: Clear (ClamAV 0.103.10/27093/Tue Nov 14 09:38:37 2023) X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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 <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782578938236638313 X-GMAIL-MSGID: 1782578938236638313 |
Series |
gcov: Improve -fprofile-update=atomic
|
|
Message
Sebastian Huber
Nov. 14, 2023, 10:08 p.m. UTC
Sebastian Huber (4): gcov: Remove TARGET_GCOV_TYPE_SIZE target hook Add TARGET_HAVE_LIBATOMIC gcov: Add gen_counter_update() gcov: Improve -fprofile-update=atomic gcc/c-family/c-cppbuiltin.cc | 4 +- gcc/config/rtems.h | 2 + gcc/config/sparc/rtemself.h | 2 - gcc/config/sparc/sparc.cc | 11 -- gcc/coverage.cc | 2 +- gcc/doc/invoke.texi | 19 ++- gcc/doc/tm.texi | 16 +-- gcc/doc/tm.texi.in | 4 +- gcc/target.def | 20 ++- gcc/targhooks.cc | 7 -- gcc/targhooks.h | 2 - gcc/tree-profile.cc | 232 +++++++++++++++++++++++------------ libgcc/libgcov.h | 16 +-- 13 files changed, 197 insertions(+), 140 deletions(-)
Comments
On Wed, Nov 15, 2023 at 06:51:10AM +0100, Sebastian Huber wrote:
> sorry, in the patch I should use targetm.have_atomic instead of TARGET_HAVE_LIBATOMIC.
I've noticed the r14-5579 commit introduced some formatting issues,
this patch fixes what I saw.
In particular, operators don't go at the end of line but at the start of
next one.
Committed to trunk as obvious.
2023-11-21 Jakub Jelinek <jakub@redhat.com>
gcc/
* tree-profile.cc (gen_counter_update, tree_profiling): Formatting
fixes.
libgcc/
* libgcov.h (GCOV_SUPPORTS_ATOMIC): Formatting fixes.
--- gcc/tree-profile.cc.jj 2023-11-21 09:31:36.349387476 +0100
+++ gcc/tree-profile.cc 2023-11-21 10:45:26.035499140 +0100
@@ -304,8 +304,8 @@ gen_counter_update (gimple_stmt_iterator
tree one = build_int_cst (type, 1);
tree relaxed = build_int_cst (integer_type_node, MEMMODEL_RELAXED);
- if (counter_update == COUNTER_UPDATE_ATOMIC_BUILTIN ||
- (result && counter_update == COUNTER_UPDATE_ATOMIC_SPLIT))
+ if (counter_update == COUNTER_UPDATE_ATOMIC_BUILTIN
+ || (result && counter_update == COUNTER_UPDATE_ATOMIC_SPLIT))
{
/* __atomic_fetch_add (&counter, 1, MEMMODEL_RELAXED); */
tree f = builtin_decl_explicit (TYPE_PRECISION (type) > 32
@@ -314,8 +314,8 @@ gen_counter_update (gimple_stmt_iterator
gcall *call = gimple_build_call (f, 3, addr, one, relaxed);
gen_assign_counter_update (gsi, call, f, result, name);
}
- else if (!result && (counter_update == COUNTER_UPDATE_ATOMIC_SPLIT ||
- counter_update == COUNTER_UPDATE_ATOMIC_PARTIAL))
+ else if (!result && (counter_update == COUNTER_UPDATE_ATOMIC_SPLIT
+ || counter_update == COUNTER_UPDATE_ATOMIC_PARTIAL))
{
/* low = __atomic_add_fetch_4 (addr, 1, MEMMODEL_RELAXED);
high_inc = low == 0 ? 1 : 0;
@@ -780,8 +780,8 @@ tree_profiling (void)
flag_profile_update = PROFILE_UPDATE_SINGLE;
}
else if (flag_profile_update == PROFILE_UPDATE_PREFER_ATOMIC)
- flag_profile_update = can_support_atomic
- ? PROFILE_UPDATE_ATOMIC : PROFILE_UPDATE_SINGLE;
+ flag_profile_update
+ = can_support_atomic ? PROFILE_UPDATE_ATOMIC : PROFILE_UPDATE_SINGLE;
if (flag_profile_update == PROFILE_UPDATE_ATOMIC)
{
@@ -791,7 +791,7 @@ tree_profiling (void)
counter_update = COUNTER_UPDATE_ATOMIC_BUILTIN;
}
else if (gcov_type_size == 8 && have_atomic_4)
- counter_update = COUNTER_UPDATE_ATOMIC_PARTIAL;
+ counter_update = COUNTER_UPDATE_ATOMIC_PARTIAL;
/* This is a small-ipa pass that gets called only once, from
cgraphunit.cc:ipa_passes(). */
--- libgcc/libgcov.h.jj 2023-11-20 09:50:08.434204617 +0100
+++ libgcc/libgcov.h 2023-11-21 10:47:50.320481543 +0100
@@ -96,9 +96,9 @@ typedef unsigned gcov_type_unsigned __at
#endif
/* Detect whether target can support atomic update of profilers. */
-#if (__SIZEOF_LONG_LONG__ == 4 && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) || \
- (__SIZEOF_LONG_LONG__ == 8 && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8) || \
- defined (__LIBGCC_HAVE_LIBATOMIC)
+#if (__SIZEOF_LONG_LONG__ == 4 && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) \
+ || (__SIZEOF_LONG_LONG__ == 8 && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8) \
+ || defined (__LIBGCC_HAVE_LIBATOMIC)
#define GCOV_SUPPORTS_ATOMIC 1
#else
#define GCOV_SUPPORTS_ATOMIC 0
Jakub