From patchwork Tue Jun 4 12:26:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?J=C3=B8rgen_Kvalsvik?= X-Patchwork-Id: 1943281 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=kolabnow.com header.i=@kolabnow.com header.a=rsa-sha256 header.s=dkim20240523 header.b=dyYLZb+t; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Vtqby6z5rz20PW for ; Tue, 4 Jun 2024 22:27:26 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 469B63836D9B for ; Tue, 4 Jun 2024 12:27:25 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx.kolabnow.com (mx.kolabnow.com [212.103.80.155]) by sourceware.org (Postfix) with ESMTPS id EC49D3839A37 for ; Tue, 4 Jun 2024 12:26:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EC49D3839A37 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=lambda.is Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=lambda.is ARC-Filter: OpenARC Filter v1.0.0 sourceware.org EC49D3839A37 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=212.103.80.155 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717503994; cv=none; b=c2JxWeGPaiLaSXqnsL+G2iVAOMDEAB4gmH5D6WznR0OziIQ1seQzqgQ0CwzqFUKqxLWTg0AkkAJTMW1Fv3N9vdsv6XkzzTAZOnadEsuodKWvBJMbdDWmmhcIUOpuU0g8luMcdJC65B35deVLU9Af5LwyusRnT93ATzYZeholcE4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717503994; c=relaxed/simple; bh=xadhsgnktQ2GNrjVRTQUrbxzsR3n/SYODaIGQONNXlU=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=wK3X+9t+EmXwZ0rZgQAnlJnez2kc4RGZ6J/tjBjX2FTOusJ3QuBswF6uLQ0U+8IqrbbXGQmiOZDmm2MYC6IJDak0Or4ysiCBYJMVdgssaCSY/uk0fIIwWZ0FAkRcULxiHFtTq2KPhu3ziQFyQNURj/SKj3YalQfeQrprpmPlpm0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from localhost (unknown [127.0.0.1]) by mx.kolabnow.com (Postfix) with ESMTP id BC2702095C1A; Tue, 4 Jun 2024 14:26:30 +0200 (CEST) Authentication-Results: ext-mx-out011.mykolab.com (amavis); dkim=pass reason="pass (just generated, assumed good)" header.d=kolabnow.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kolabnow.com; h= content-transfer-encoding:mime-version:message-id:date:date :subject:subject:from:from:received:received:received; s= dkim20240523; t=1717503988; x=1719318389; bh=Yyr/eWxXa6ykEuWs7o1 96vUuP+cUqENap8WgXjgFoxc=; b=dyYLZb+to5n2YVpFHTtkenmLZbdYWDGxQ6Q YNrtJI5w1Ti++1v7volc/KXwR1g6MIcPmwqhGUbAgjjZWg/C4ezpFjaFI8UqIQxi KKvDaxV3BpGF3PSbNkLryCrEqLfUVM0lYUckxaguMda7G9FspAAr8lpAyFfCdENI bkBmNArzN4UUZe4ZJL5m+Qj/z2zzPH3Ydkfe30d1KQ+P1iJ3cGBUbxB+cNYCIqZM atqDVftG5R8WpHFYr4Ksrhn2rqglLNdK7tGdJBpDGkxnT8+nDDtoQqqnURNYKxnm GXhYXRjj/meJiTLvi5D54EYSsarJ/A6Gl2+o2CmPAc1sU60qiyQ== X-Virus-Scanned: amavis at mykolab.com X-Spam-Score: -1 X-Spam-Level: X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 Received: from mx.kolabnow.com ([127.0.0.1]) by localhost (ext-mx-out011.mykolab.com [127.0.0.1]) (amavis, port 10024) with ESMTP id 2gAng-k3tqTt; Tue, 4 Jun 2024 14:26:28 +0200 (CEST) Received: from int-mx009.mykolab.com (unknown [10.9.13.9]) by mx.kolabnow.com (Postfix) with ESMTPS id AE54320C73F9; Tue, 4 Jun 2024 14:26:27 +0200 (CEST) Received: from ext-subm010.mykolab.com (unknown [10.9.6.10]) by int-mx009.mykolab.com (Postfix) with ESMTPS id 1D4F4219C44A; Tue, 4 Jun 2024 14:26:27 +0200 (CEST) From: =?utf-8?q?J=C3=B8rgen_Kvalsvik?= To: gcc-patches@gcc.gnu.org Cc: hubicka@ucw.cz, =?utf-8?q?J=C3=B8rgen_Kvalsvik?= Subject: [PATCH] Record edge true/false value for gcov Date: Tue, 4 Jun 2024 14:26:02 +0200 Message-Id: <20240604122602.1516309-1-j@lambda.is> MIME-Version: 1.0 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+incoming=patchwork.ozlabs.org@gcc.gnu.org Make gcov aware which edges are the true/false to more accurately reconstruct the CFG. There are plenty of bits left in arc_info and it opens up for richer reporting. gcc/ChangeLog: * gcov-io.h (GCOV_ARC_TRUE): New. (GCOV_ARC_FALSE): New. * gcov.cc (struct arc_info): Add true_value, false_value. (read_graph_file): Read true_value, false_value. --- gcc/gcov-io.h | 2 ++ gcc/gcov.cc | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/gcc/gcov-io.h b/gcc/gcov-io.h index 20f805598f0..5dc467c92b1 100644 --- a/gcc/gcov-io.h +++ b/gcc/gcov-io.h @@ -337,6 +337,8 @@ GCOV_COUNTERS #define GCOV_ARC_ON_TREE (1 << 0) #define GCOV_ARC_FAKE (1 << 1) #define GCOV_ARC_FALLTHROUGH (1 << 2) +#define GCOV_ARC_TRUE (1 << 3) +#define GCOV_ARC_FALSE (1 << 4) /* Object & program summary record. */ diff --git a/gcc/gcov.cc b/gcc/gcov.cc index 0d4ef14e6c9..b800c9bc939 100644 --- a/gcc/gcov.cc +++ b/gcc/gcov.cc @@ -117,6 +117,12 @@ struct arc_info /* Loop making arc. */ unsigned int cycle : 1; + /* Is a true arc. */ + unsigned int true_value : 1; + + /* Is a false arc. */ + unsigned int false_value : 1; + /* Links to next arc on src and dst lists. */ struct arc_info *succ_next; struct arc_info *pred_next; @@ -2010,6 +2016,8 @@ read_graph_file (void) arc->on_tree = !!(flags & GCOV_ARC_ON_TREE); arc->fake = !!(flags & GCOV_ARC_FAKE); arc->fall_through = !!(flags & GCOV_ARC_FALLTHROUGH); + arc->true_value = !!(flags & GCOV_ARC_TRUE); + arc->false_value = !!(flags & GCOV_ARC_FALSE); arc->succ_next = src_blk->succ; src_blk->succ = arc;