From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by sourceware.org (Postfix) with ESMTPS id B03F8383FB90 for ; Thu, 13 Oct 2022 11:39:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B03F8383FB90 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-x635.google.com with SMTP id y14so3248134ejd.9 for ; Thu, 13 Oct 2022 04:39:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=n1pvN3oIk37gR1b0oKIIpV9t0CdBhBFnGeOD9td/Kpc=; b=S7l/PzABK80RlyKNbwZxGPGGHRw8BZBQYSPs6kMu+7r27K9Y2sENFkg3x/C4fP87Jr UhDv2ts9Aa/W1ZWv2OgxzWNfe3zGXZWWRrZCax6NaPdhr/ace2HvGLzmkriNAqhhK/ka /+XLn6uJGL6g6sb19HW9eL52/zjLYDy5GzdVayk3V9yHVcLPlTuMsZCjKeOTAmaYDYSR hHIdB+1v1lT06+iYd6hGyrBaU/rXQuaX0WQF54clprlgJObNYBQPTKJWB9gZQwPlnbg+ pmr/HpGPZKRjlFZruiClFzG3wjSkOB5hQujjNjUvCzij0BPD6uroDvzDD0y1vFEt0I0v n4xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=n1pvN3oIk37gR1b0oKIIpV9t0CdBhBFnGeOD9td/Kpc=; b=RIytPZPmxC+zeXg4DMpeu84CXyWoTS/FwjKaQosUm1gPvCmDLEH52q41GWyADrN3Vc GUXhk+5KsJzx+zaH3s04Ek4iGmCJPqi4zb4L4gNv7zl1GYkBKG8y4P/jdp0YC4Pi9oqF Xc49xw4ew4fnNols29bCrKYLQy5XSbRYWKFAzUk5eez9tFk3X6mWn0fvvPbrvs6LrUN3 2TbTSS46NXv86tkZhXEmeOecHEUvucw7fGZkxS7quDoNDNfIYDWNyAk36FUq8rsVjxDh N05Mu3qwMcAocspYHmgctTI+jyvwfQ6D0ZFx6PBIWhvUzUrxgKyZocR4yVRcv6OooGQP inGw== X-Gm-Message-State: ACrzQf3gzlOMkS8mBKFCdLVreXFgmkBzkQOfmzCeI1TFJKZrcEAMesPC 6dqHYgtb0Fjb6QkHDfGDHmtPA+NM52l+s3eufMU= X-Google-Smtp-Source: AMsMyM6c/wLcMb/pbNGgK+AiDMfWTw336iHHY2mqhcUrSN7woCDpgRMmtNkbqDV4LXP4eWbkDdDuHGXqySwGl64mviU= X-Received: by 2002:a17:907:971c:b0:78e:63f:c766 with SMTP id jg28-20020a170907971c00b0078e063fc766mr3243091ejc.330.1665661188161; Thu, 13 Oct 2022 04:39:48 -0700 (PDT) MIME-Version: 1.0 References: <20221011124303.99673-1-jorgen.kvalsvik@woven-planet.global> In-Reply-To: <20221011124303.99673-1-jorgen.kvalsvik@woven-planet.global> From: Richard Biener Date: Thu, 13 Oct 2022 13:39:36 +0200 Message-ID: Subject: Re: [PATCH 1/2] gcov: test switch/break line counts To: =?UTF-8?Q?J=C3=B8rgen_Kvalsvik?= Cc: gcc-patches@gcc.gnu.org, mliska@suse.cz Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.1 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 List-Id: On Tue, Oct 11, 2022 at 2:43 PM J=C3=B8rgen Kvalsvik 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. > > 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) > - !=3D LOCATION_FILE (gimple_location (last)) > - || (LOCATION_LINE (e->goto_locus) > - !=3D LOCATION_LINE (gimple_location (last))= ))) > - { > - basic_block new_bb =3D split_edge (e); > - edge ne =3D single_succ_edge (new_bb); > - ne->goto_locus =3D e->goto_locus; > - } > + > if ((e->flags & (EDGE_ABNORMAL | EDGE_ABNORMAL_CALL)) > && e->dest !=3D EXIT_BLOCK_PTR_FOR_FN (cfun)) > need_exit_edge =3D 1; > > Assuming the .gcov files from make chec-gcc RUNTESTFLAGS=3Dgcov.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: OK. Thanks, Richard. > > * 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/gc= ov/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 =3D do_something (2); /* count(1) */ > - break; > + break; /* count(1) */ > case 2: > result =3D do_something (1024); > break; > - case 3: > + case 3: /* count(3) */ > case 4: > /* branch(67) */ > if (j =3D=3D 2) /* count(3) */ > /* branch(end) */ > return do_something (4); /* count(1) */ > result =3D do_something (8); /* count(2) */ > - break; > + break; /* count(2) */ > default: > result =3D do_something (32); /* count(1) */ > switch_m++; /* count(1) */ > diff --git a/gcc/testsuite/gcc.misc-tests/gcov-4.c b/gcc/testsuite/gcc.mi= sc-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 =3D do_something (2); /* count(1) */ > - break; > + break; /* count(1) */ > case 2: > result =3D do_something (1024); > break; > @@ -230,7 +230,7 @@ test_switch (int i, int j) > if (j =3D=3D 2) /* count(3) */ > return do_something (4); /* count(1) */ > result =3D do_something (8); /* count(2) */ > - break; > + break; /* count(2) */ > default: > result =3D do_something (32); /* count(1) */ > switch_m++; /* count(1) */ > -- > 2.34.0 >