From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id 0B83F385828D for ; Wed, 5 Oct 2022 12:27:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0B83F385828D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=suse.cz Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 11D4D2189F; Wed, 5 Oct 2022 12:27:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1664972825; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hn4YNAH29jMEMkEZL0A9mgcfw4WbkJwbymtnZ2x1Qz4=; b=rY+jaWKT3pO0UgM/0F0jbuhDmBJH4d0R5WsH6+tCMF96NDqmbjuoxEgkYMDQzc/sNymLuC gEuovRUSfsYT5gmiZp3HOMrM1F+K/nvz5M4T/FNesOA8b8Lx3pdmKSaab1dHd0/CTDzAyJ aNLQtQFX934SAazQ8EgooWK+jbISUM0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1664972825; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hn4YNAH29jMEMkEZL0A9mgcfw4WbkJwbymtnZ2x1Qz4=; b=jkx/XsIcTyeCLUmPfUNFatup/oPVpW3NavM9ey+38tCy7ivLjI5Q1rla5FOnphMxM6UL9M puW/sk5X4GnttvAw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id F24E813ABD; Wed, 5 Oct 2022 12:27:04 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id qtw1Ohh4PWOLagAAMHmgww (envelope-from ); Wed, 05 Oct 2022 12:27:04 +0000 Message-ID: <817380d6-6c6c-ff60-5743-7336201cd83e@suse.cz> Date: Wed, 5 Oct 2022 14:27:04 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Subject: Re: [PATCH 1/2] gcov: test switch/break line counts Content-Language: en-US To: =?UTF-8?Q?J=c3=b8rgen_Kvalsvik?= , gcc-patches@gcc.gnu.org References: <20221005120403.68935-1-jorgen.kvalsvik@woven-planet.global> <20221005120403.68935-2-jorgen.kvalsvik@woven-planet.global> From: =?UTF-8?Q?Martin_Li=c5=a1ka?= In-Reply-To: <20221005120403.68935-2-jorgen.kvalsvik@woven-planet.global> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_SOFTFAIL,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 List-Id: On 10/5/22 14:04, Jørgen Kvalsvik via Gcc-patches wrote: > The coverage support will under some conditions decide to split edges to > accurately report coverage. By running the test suite with/without this > edge splitting a small diff shows up, addressed by this patch, which > should catch future regressions. Thanks for the patch, it's OK (please apply it). Martin > > Removing the edge splitting: > > diff --git a/gcc/profile.cc b/gcc/profile.cc > --- a/gcc/profile.cc > +++ b/gcc/profile.cc > @@ -1244,19 +1244,7 @@ branch_prob (bool thunk) > Don't do that when the locuses match, so > if (blah) goto something; > is not computed twice. */ > - if (last > - && gimple_has_location (last) > - && !RESERVED_LOCATION_P (e->goto_locus) > - && !single_succ_p (bb) > - && (LOCATION_FILE (e->goto_locus) > - != LOCATION_FILE (gimple_location (last)) > - || (LOCATION_LINE (e->goto_locus) > - != LOCATION_LINE (gimple_location (last))))) > - { > - basic_block new_bb = split_edge (e); > - edge ne = single_succ_edge (new_bb); > - ne->goto_locus = e->goto_locus; > - } > + > if ((e->flags & (EDGE_ABNORMAL | EDGE_ABNORMAL_CALL)) > && e->dest != EXIT_BLOCK_PTR_FOR_FN (cfun)) > need_exit_edge = 1; > > Assuming the .gcov files from make chec-gcc RUNTESTFLAGS=gcov.exp are > kept: > > $ diff -r no-split-edge with-split-edge | grep -C 2 -E "^[<>]\s\s" > diff -r sans-split-edge/gcc/gcov-4.c.gcov with-split-edge/gcc/gcov-4.c.gcov > 228c228 > < -: 224: break; > --- > > 1: 224: break; > 231c231 > < -: 227: break; > --- > > #####: 227: break; > 237c237 > < -: 233: break; > --- > > 2: 233: break; > > gcc/testsuite/ChangeLog: > > * g++.dg/gcov/gcov-1.C: Add line count check. > * gcc.misc-tests/gcov-4.c: Likewise. > --- > gcc/testsuite/g++.dg/gcov/gcov-1.C | 8 ++++---- > gcc/testsuite/gcc.misc-tests/gcov-4.c | 4 ++-- > 2 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/gcc/testsuite/g++.dg/gcov/gcov-1.C b/gcc/testsuite/g++.dg/gcov/gcov-1.C > index 9018b9a3a73..ee383b480a8 100644 > --- a/gcc/testsuite/g++.dg/gcov/gcov-1.C > +++ b/gcc/testsuite/g++.dg/gcov/gcov-1.C > @@ -257,20 +257,20 @@ test_switch (int i, int j) > switch (i) /* count(5) */ > /* branch(end) */ > { > - case 1: > + case 1: /* count(1) */ > result = do_something (2); /* count(1) */ > - break; > + break; /* count(1) */ > case 2: > result = do_something (1024); > break; > - case 3: > + case 3: /* count(3) */ > case 4: > /* branch(67) */ > if (j == 2) /* count(3) */ > /* branch(end) */ > return do_something (4); /* count(1) */ > result = do_something (8); /* count(2) */ > - break; > + break; /* count(2) */ > default: > result = do_something (32); /* count(1) */ > switch_m++; /* count(1) */ > diff --git a/gcc/testsuite/gcc.misc-tests/gcov-4.c b/gcc/testsuite/gcc.misc-tests/gcov-4.c > index 9d8ab1c1097..498d299b66b 100644 > --- a/gcc/testsuite/gcc.misc-tests/gcov-4.c > +++ b/gcc/testsuite/gcc.misc-tests/gcov-4.c > @@ -221,7 +221,7 @@ test_switch (int i, int j) > { > case 1: > result = do_something (2); /* count(1) */ > - break; > + break; /* count(1) */ > case 2: > result = do_something (1024); > break; > @@ -230,7 +230,7 @@ test_switch (int i, int j) > if (j == 2) /* count(3) */ > return do_something (4); /* count(1) */ > result = do_something (8); /* count(2) */ > - break; > + break; /* count(2) */ > default: > result = do_something (32); /* count(1) */ > switch_m++; /* count(1) */