From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1921) id 6137F3857B98; Thu, 23 Nov 2023 14:55:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6137F3857B98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1700751331; bh=sFwXD8x403CrjHCcGaKV563syDcEkdN/9sohb1SasPI=; h=From:To:Subject:Date:From; b=ur9FcFmKTVSPSlUE2cRn4u7kOmnwNd0fPyrYc15sEyp2LsCJbqd7CT1CDvJyKuxrG 1EdPC3fRp4EXHJMpluYyVj5j1lOIci73We7yx6igfyBXBVma/altiKyi0R8BA43Yi0 U9Yg17ApXY8BQDlqe+2742iBfd+4WQGYHcIaQKDQ= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Sebastian Huber To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-5783] gcov: No atomic ops for -fprofile-update=single X-Act-Checkin: gcc X-Git-Author: Sebastian Huber X-Git-Refname: refs/heads/master X-Git-Oldrev: 466b100e5fee808d77598e0f294654deec281150 X-Git-Newrev: 8674d70ce37ca3249a641fb418c6849d4f95f348 Message-Id: <20231123145531.6137F3857B98@sourceware.org> Date: Thu, 23 Nov 2023 14:55:31 +0000 (GMT) List-Id: https://gcc.gnu.org/g:8674d70ce37ca3249a641fb418c6849d4f95f348 commit r14-5783-g8674d70ce37ca3249a641fb418c6849d4f95f348 Author: Sebastian Huber Date: Thu Nov 23 14:45:50 2023 +0100 gcov: No atomic ops for -fprofile-update=single gcc/ChangeLog: PR tree-optimization/112678 * tree-profile.cc (tree_profiling): Do not use atomic operations for -fprofile-update=single. Diff: --- 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 1ac0fdb3bc9..9c8fdb8b18f 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(). */