From patchwork Wed May 31 11:26:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 101369 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2803899vqr; Wed, 31 May 2023 04:27:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6/HSxOdOv4YA+s4Ey1avYob1wJnwGcWies6c5tTuzVZngF5A/L3u2ARYFusg+nF0BDt5/U X-Received: by 2002:a17:907:8a22:b0:970:132f:698f with SMTP id sc34-20020a1709078a2200b00970132f698fmr5734011ejc.2.1685532428364; Wed, 31 May 2023 04:27:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685532428; cv=none; d=google.com; s=arc-20160816; b=Tt0mGNU0XUZ1RkgpwGaGjlXt+jnav12HqnfVhjBHKvYk2cT60svbnoo8y5SSGrWHIg NOJwoxUiuXg2Sq86YzCK2hLK8KIc2gzz/oQWNIKAaI+cGKDVuASK2XWpOIWehQZ7VxBJ 1rDr+kIOTcWsIPbvYCMI+bXmlWgIfAh9FJyVxOBRmCdsDiGkR3YRRtb4rT7apYNj9fI9 MTByM5ncixKY4sHZF2HCYdb6z488rctoqebYIcrbbpMbsHX8/kz3delfHENlj7YQhSYK U5uVMdX7U53OFKR2jiqGb2jF9WdP1eEqw5F8oBG1zQmncx0OKwP/f2d96iqpl956URiI 1UnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:sender:errors-to:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :mime-version:user-agent:subject:to:date:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=ZyXp+7fjkqVwlWW8ZuSBEHOX1cwXoN7h6eJfWpzl+vA=; b=Sllg6YXn7k7xmdE+XeHUDYvT/jTtf9tHfiGAnGDjkHlSYfIbZXiikLMfU2vOd92vGg o4Up4IaaiNFTGnrGF4sHPao5kbwDj37C7BL1ExhGBBr4CLalGxDjDDrEZVRxRb76zBcR 8yuKFXNHMQYzfGx5WJI2sC9xonD9ia43YVNEtSkJ/bDuvBbKmUl46EpksscIYz+xNk8T 2ityipnS+AyGHw1qOmf+/p59vT894PM1l+pHs5pOdX3C+SXmB8kpVu93tWSzj+FeZztY Mt/hXDmqsodK2xpqD++GaHdOqIZV1qX55IBWOh4E7FGUgWyOPLAlYu8XMlNR39tnZF7g BYpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=x1qMB2Ej; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id fx21-20020a170906b75500b0094fa25e860fsi2640204ejb.384.2023.05.31.04.27.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 May 2023 04:27:08 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=x1qMB2Ej; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DBA663857014 for ; Wed, 31 May 2023 11:26:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DBA663857014 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685532418; bh=ZyXp+7fjkqVwlWW8ZuSBEHOX1cwXoN7h6eJfWpzl+vA=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=x1qMB2EjEEBJoCFYQI7h0UjTy5bEWPpCZJ6P0TX8KDjCB/m/LQtm4q+6n21X58Usi phMZQz2OqjeEyHV6nGTPmGnDlb2uRy1KYUNRYFVGNseYZaXP3vJWEal2v4m5OPnYvi lPUNHFDQUaoYfVOQVm5vL7xZylRQ0KIZa2TvPu6Q= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id C439F3858D20 for ; Wed, 31 May 2023 11:26:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C439F3858D20 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id E72CC1F8C0 for ; Wed, 31 May 2023 11:26:13 +0000 (UTC) Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id DC5422C141 for ; Wed, 31 May 2023 11:26:13 +0000 (UTC) Date: Wed, 31 May 2023 11:26:13 +0000 (UTC) To: gcc-patches@gcc.gnu.org Subject: [PATCH] IPA PTA stats enhancement and non-details dump slimming User-Agent: Alpine 2.22 (LSU 394 2020-01-19) MIME-Version: 1.0 X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, MISSING_MID, 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Richard Biener via Gcc-patches From: Richard Biener Reply-To: Richard Biener Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" Message-Id: <20230531112658.DBA663857014@sourceware.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767408851859558238?= X-GMAIL-MSGID: =?utf-8?q?1767408851859558238?= The following keeps track of the number of edges we avoid to create because they redundandly feed ESCAPED. It also avoids printing a header for -details when not using -details. Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. * tree-ssa-structalias.cc (constraint_stats::num_avoided_edges): New. (add_graph_edge): Count redundant edges we avoid to create. (dump_sa_stats): Dump them. (ipa_pta_execute): Do not dump generating constraints when we are not dumping them. --- gcc/tree-ssa-structalias.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gcc/tree-ssa-structalias.cc b/gcc/tree-ssa-structalias.cc index 546dab5035e..9ded34c1dd1 100644 --- a/gcc/tree-ssa-structalias.cc +++ b/gcc/tree-ssa-structalias.cc @@ -237,6 +237,7 @@ static struct constraint_stats unsigned int iterations; unsigned int num_edges; unsigned int num_implicit_edges; + unsigned int num_avoided_edges; unsigned int points_to_sets_created; } stats; @@ -1213,7 +1214,10 @@ add_graph_edge (constraint_graph_t graph, unsigned int to, if (to < FIRST_REF_NODE && bitmap_bit_p (graph->succs[from], find (escaped_id)) && bitmap_bit_p (get_varinfo (find (to))->solution, escaped_id)) - return false; + { + stats.num_avoided_edges++; + return false; + } if (bitmap_set_bit (graph->succs[from], to)) { @@ -7164,6 +7168,8 @@ dump_sa_stats (FILE *outfile) fprintf (outfile, "Number of edges: %d\n", stats.num_edges); fprintf (outfile, "Number of implicit edges: %d\n", stats.num_implicit_edges); + fprintf (outfile, "Number of avoided edges: %d\n", + stats.num_avoided_edges); } /* Dump points-to information to OUTFILE. */ @@ -8427,7 +8433,7 @@ ipa_pta_execute (void) || node->clone_of) continue; - if (dump_file) + if (dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, "Generating constraints for %s", node->dump_name ());