From patchwork Thu Nov 23 13:47:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Huber X-Patchwork-Id: 168948 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp457252vqx; Thu, 23 Nov 2023 05:48:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IGDs46XxdCTvwQySEp6+js8C3gKW2m72bgqqwvz4rlcoYVP/RFZcCvQ2r6CHzLA5L84UT3E X-Received: by 2002:a0d:f6c2:0:b0:5c9:8366:33b2 with SMTP id g185-20020a0df6c2000000b005c9836633b2mr5602271ywf.44.1700747301675; Thu, 23 Nov 2023 05:48:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700747301; cv=pass; d=google.com; s=arc-20160816; b=hP2ktAyAeZ6hVoss6hGQhBe3B7PWM8c9cI0YtoOtsF7h0v5G9v0r2kUzKooHT2L6J7 852fgyCHs5piJnsuGvByvrejvWGafKF8b8SsA/GUcoaMBMbmdZIWZIo27M1b+8k3Pewn wi5gHp3+0YeT9j/8pvbJqL+kcqgssh7W2nCSgErxk3TZPli86EF3uzfb+p+07U7Sp7V2 eInHAJJNX34jyQEE6Btdur6b8w4RjiAQxk3zX8b/W5eb7cfJ0uc252VzUExhJxaClbnd cVP2q+E4q3HkziLJzPT2AmNLojkIk3BdrAX+QRCOV+NPsidv1y7DpLLS2ysFvFGnydT+ h5Lw== 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:cc:to:from:arc-filter :dmarc-filter:delivered-to; bh=JvjoSpudAW3/NioGSv5EpoMTG6+BFergtGz7Jyt0dSo=; fh=UnJaSs1LdmHl1brBz3CJXOVVEZ0KHynh+GYvTrOkcOg=; b=DEzpv432lUI72qM4l0p0jFtB4Gv4cF+NNVsHGZ4ORx/Ofioh4Utd6R//TQ/5SYUshl IeVy8wK0c8z+9AKabCPJ5kwUOfDQhEQWsqbPrwUXaToeZ5jm9/GzbFU04JYC8H7yEmeG 33gPDuKC2vKCNDgB3e1n6ZIn0p2t/UrvSalF22e+XlMukZ2sozbfrB6nZGjvFltN8MKg EZ+HK/Lkqw5QSxzbZhL7IHgMX3Q7e1Rri+f8UKKpjAGPiclWT1JuTzwzSBfoKgGZHwh6 RhnsgmjM/CwyLecJ3U9txcYNHjV77wKW+ijtr8aQ0sWB+UKrdCwQ5mKRRNT/+iUb0LDm nlZA== 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 ou16-20020a05620a621000b00778988d1648si1080898qkn.544.2023.11.23.05.48.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 05:48:21 -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 709113858D33 for ; Thu, 23 Nov 2023 13:48:21 +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 DE13E3858D33 for ; Thu, 23 Nov 2023 13:47:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DE13E3858D33 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 DE13E3858D33 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=1700747279; cv=none; b=FzXUgeFwK0W+r8SjZORJomkhSYl9J13jkkt0AqtatRhXgZPfKK8YTuVj3UBcEgNmxcCChg05q3Ns9V2/n6zU+LVT1m9M7E889hlVw/ScC81/F/v8WU8ge0mrisCAFtC1d61PcPcIyxZLEhGqJp0b//yx/lQfB6PnT+sAWxGf33M= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700747279; c=relaxed/simple; bh=popRNJtHMPLEL0jjC0xZCPxeI0aXlo897WmOzShFp18=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=RINfTQ4551yPzRrYrso9nSTsJek/dB0gkI6pEJ9FVOtZCNv1OthNDHcFqnc4X1P1GEiPnxzmRobcuxsW6A1DmX2vOiFTf0Tv9XEr8oCHuLAonMKlN+g2R+Zrhh7CCIjr3mtAcG+H42EMarMbixK8XJyWRWIovDakTzLU2HPR5Vc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from sslproxy01.your-server.de ([78.46.139.224]) by dedi548.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r6A3f-0006Lb-RN; Thu, 23 Nov 2023 14:47:56 +0100 Received: from [82.100.198.138] (helo=mail.embedded-brains.de) by sslproxy01.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r6A3f-000TD3-NW; Thu, 23 Nov 2023 14:47:55 +0100 Received: from localhost (localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id 55D6748015C; Thu, 23 Nov 2023 14:47:55 +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 yKx7QvNBNzL9; Thu, 23 Nov 2023 14:47:55 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id 07E99480193; Thu, 23 Nov 2023 14:47:55 +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 wbmX6nbEWCgb; Thu, 23 Nov 2023 14:47:54 +0100 (CET) Received: from zimbra.eb.localhost (unknown [10.10.171.18]) by mail.embedded-brains.de (Postfix) with ESMTPSA id C4F0F48015C; Thu, 23 Nov 2023 14:47:54 +0100 (CET) From: Sebastian Huber To: gcc-patches@gcc.gnu.org Cc: Richard Biener Subject: [PATCH] gcov: No atomic ops for -fprofile-update=single Date: Thu, 23 Nov 2023 14:47:51 +0100 Message-Id: <20231123134751.25302-1-sebastian.huber@embedded-brains.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 X-Authenticated-Sender: smtp-embedded@poldi-networks.de X-Virus-Scanned: Clear (ClamAV 0.103.10/27102/Thu Nov 23 09:42:42 2023) X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783362802359563667 X-GMAIL-MSGID: 1783362802359563667 gcc/ChangeLog: PR tree-optimization/112678 * tree-profile.cc (tree_profiling): Do not use atomic operations for -fprofile-update=single. --- gcc/tree-profile.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gcc/tree-profile.cc b/gcc/tree-profile.cc index 1ac0fdb3bc98..9c8fdb8b18f4 100644 --- a/gcc/tree-profile.cc +++ b/gcc/tree-profile.cc @@ -767,6 +767,7 @@ tree_profiling (void) = HAVE_sync_compare_and_swapsi || HAVE_atomic_compare_and_swapsi; bool have_atomic_8 = HAVE_sync_compare_and_swapdi || HAVE_atomic_compare_and_swapdi; + bool needs_split = gcov_type_size == 8 && !have_atomic_8 && have_atomic_4; if (!can_support_atomic) { if (gcov_type_size == 4) @@ -775,6 +776,9 @@ tree_profiling (void) can_support_atomic = have_atomic_8; } + if (flag_profile_update != PROFILE_UPDATE_SINGLE && needs_split) + counter_update = COUNTER_UPDATE_ATOMIC_PARTIAL; + if (flag_profile_update == PROFILE_UPDATE_ATOMIC && !can_support_atomic) { @@ -788,13 +792,11 @@ tree_profiling (void) if (flag_profile_update == PROFILE_UPDATE_ATOMIC) { - if (gcov_type_size == 8 && !have_atomic_8 && have_atomic_4) + if (needs_split) counter_update = COUNTER_UPDATE_ATOMIC_SPLIT; else counter_update = COUNTER_UPDATE_ATOMIC_BUILTIN; } - else if (gcov_type_size == 8 && have_atomic_4) - counter_update = COUNTER_UPDATE_ATOMIC_PARTIAL; /* This is a small-ipa pass that gets called only once, from cgraphunit.cc:ipa_passes(). */