From patchwork Fri Mar 10 11:26:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 67364 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp813946wrd; Fri, 10 Mar 2023 03:27:34 -0800 (PST) X-Google-Smtp-Source: AK7set9tMiVtJLwHclSOt2BRPZ7zkqgT0KrY36SWtujuSa6zbgouUFtDcHNUFmkJ/ce/5cY7+yjZ X-Received: by 2002:a17:906:c7c5:b0:8b1:20f4:44a3 with SMTP id dc5-20020a170906c7c500b008b120f444a3mr21876240ejb.7.1678447654441; Fri, 10 Mar 2023 03:27:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678447654; cv=none; d=google.com; s=arc-20160816; b=U/L/fGp33y3wo9ZymfKlwsU5sMNS+VesfcxAxGLS4pl+Ub96WT4UuqL8AVkcEBz8gG YWXjj/6owWpTk8Rxc3dG0xG1XTaCbD2IPGmPV1jPYGVu+rt6ikMo8BO9GlPz4R0zdF4C t+7dD9hqAI3GQy/QLCdg90h5SzqKaSdSMKH4ALlCcX7MtXQPifhw2vFp3zm/1bmzNXRE 0QLDk9SZ2FGBqKYuc9m7DTkGlXmR3+rQTp63hU3lOXR4gUIHcT7N98WhZQgM32PZ7u0k cQmDpj4wX9uLKnWmoEpumtkI0UHwM/koHXaHIj0XNdDT9FJKNkQ2DZaGQxtkHZuk7p4Z L+Jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:message-id :mime-version:subject:to:date:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=bLQPcFkqzQvA/SIbyZoOg2dL+ZEkyC+LuvwlQ3ED0qI=; b=mXWIHs7F2RYByjaQIl0RMb4Nm3uIq706RbIKfZMKJPRp+OYLbS0ALexD0gd8B4EqLg nv5QOLjHFl5ODGqUhLfHd880nF1PsoTMLgwZRrBiiwZrOmjK4KOYm3JCuz7/8spdE0G3 pM59XZiN78RGPcubBIilQKo571dq+A85ieJOoJ/ev0wSSfe7OgcUSkYE9pJ5H6T0GAWz jCdqEginRRjSV9KjKTUwNM9H0XEGJFSPrVu2U6O9X9/0D9VvgBiO9MOkKq/SdRmNy67D GnP+YtoiMoDdb05mCRr2aV2h9cbJl4FXksdIKTYBp53wvft81IT/OIsg3QUfnoCcFkZt wrbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=YVwCp6NA; 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 h4-20020a170906398400b008be2daad93dsi1749671eje.839.2023.03.10.03.27.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Mar 2023 03:27:34 -0800 (PST) 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=YVwCp6NA; 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 40C3F3858422 for ; Fri, 10 Mar 2023 11:27:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 40C3F3858422 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678447653; bh=bLQPcFkqzQvA/SIbyZoOg2dL+ZEkyC+LuvwlQ3ED0qI=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=YVwCp6NA2TVrldscWup+1hbvl/k+8zX7cQE3GJcGsdrOZ/UMzHf7J19uXZoFyzhg3 PalaVOTYNmBNAJV2+4xNqG5y9lOB12jjl6y/RLrsZYRN9+nfKMZuO04SvjCM4NqoLg LWdOLJOxj9zesXvP4pyM1piHdIJiY9k42/Urb8tM= 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 [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id E329C3858D1E for ; Fri, 10 Mar 2023 11:26:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E329C3858D1E 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-out2.suse.de (Postfix) with ESMTPS id DDF2A2064D for ; Fri, 10 Mar 2023 11:26:47 +0000 (UTC) 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 CC9E4134F7 for ; Fri, 10 Mar 2023 11:26:47 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id ERP7MPcTC2SXegAAMHmgww (envelope-from ) for ; Fri, 10 Mar 2023 11:26:47 +0000 Date: Fri, 10 Mar 2023 12:26:47 +0100 (CET) To: gcc-patches@gcc.gnu.org Subject: [PATCH] Shrink points-to analysis dumps when not dumping with -details MIME-Version: 1.0 Message-Id: <20230310112647.CC9E4134F7@imap2.suse-dmz.suse.de> X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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 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" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759979928152725927?= X-GMAIL-MSGID: =?utf-8?q?1759979928152725927?= The following allows to get PTA stats with -stats without blowing up your filesystem by guarding constraint and solution dumping with TDF_DETAILS and the SSA points-to info with TDF_DETAILS or TDF_ALIAS. Queued for stage1. * tree-ssa-structalias.cc (dump_sa_stats): Split out from... (dump_sa_points_to_info): ... this function. (compute_points_to_sets): Guard large dumps with TDF_DETAILS, and call dump_sa_stats guarded with TDF_STATS. (ipa_pta_execute): Likewise. (compute_may_aliases): Guard dump_alias_info with TDF_DETAILS|TDF_ALIAS. --- gcc/tree-ssa-structalias.cc | 63 ++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 28 deletions(-) diff --git a/gcc/tree-ssa-structalias.cc b/gcc/tree-ssa-structalias.cc index 07e0fd6827a..fd7450b9477 100644 --- a/gcc/tree-ssa-structalias.cc +++ b/gcc/tree-ssa-structalias.cc @@ -7130,33 +7130,33 @@ pt_solutions_intersect (struct pt_solution *pt1, struct pt_solution *pt2) return res; } +/* Dump stats information to OUTFILE. */ + +static void +dump_sa_stats (FILE *outfile) +{ + fprintf (outfile, "Points-to Stats:\n"); + fprintf (outfile, "Total vars: %d\n", stats.total_vars); + fprintf (outfile, "Non-pointer vars: %d\n", + stats.nonpointer_vars); + fprintf (outfile, "Statically unified vars: %d\n", + stats.unified_vars_static); + fprintf (outfile, "Dynamically unified vars: %d\n", + stats.unified_vars_dynamic); + fprintf (outfile, "Iterations: %d\n", stats.iterations); + fprintf (outfile, "Number of edges: %d\n", stats.num_edges); + fprintf (outfile, "Number of implicit edges: %d\n", + stats.num_implicit_edges); +} /* Dump points-to information to OUTFILE. */ static void dump_sa_points_to_info (FILE *outfile) { - unsigned int i; - fprintf (outfile, "\nPoints-to sets\n\n"); - if (dump_flags & TDF_STATS) - { - fprintf (outfile, "Stats:\n"); - fprintf (outfile, "Total vars: %d\n", stats.total_vars); - fprintf (outfile, "Non-pointer vars: %d\n", - stats.nonpointer_vars); - fprintf (outfile, "Statically unified vars: %d\n", - stats.unified_vars_static); - fprintf (outfile, "Dynamically unified vars: %d\n", - stats.unified_vars_dynamic); - fprintf (outfile, "Iterations: %d\n", stats.iterations); - fprintf (outfile, "Number of edges: %d\n", stats.num_edges); - fprintf (outfile, "Number of implicit edges: %d\n", - stats.num_implicit_edges); - } - - for (i = 1; i < varmap.length (); i++) + for (unsigned i = 1; i < varmap.length (); i++) { varinfo_t vi = get_varinfo (i); if (!vi->may_have_pointers) @@ -7537,7 +7537,7 @@ compute_points_to_sets (void) } } - if (dump_file) + if (dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, "Points-to analysis\n\nConstraints:\n\n"); dump_constraints (dump_file, 0); @@ -7610,7 +7610,10 @@ compute_points_to_sets (void) BITMAP_FREE (new_delta); } - if (dump_file) + if (dump_file && (dump_flags & TDF_STATS)) + dump_sa_stats (dump_file); + + if (dump_file && (dump_flags & TDF_DETAILS)) dump_sa_points_to_info (dump_file); /* Compute the points-to set for ESCAPED used for call-clobber analysis. */ @@ -8032,7 +8035,8 @@ compute_may_aliases (void) "because IPA points-to information is available.\n\n"); /* But still dump what we have remaining it. */ - dump_alias_info (dump_file); + if (dump_flags & (TDF_DETAILS|TDF_ALIAS)) + dump_alias_info (dump_file); } return 0; @@ -8044,7 +8048,7 @@ compute_may_aliases (void) compute_points_to_sets (); /* Debugging dumps. */ - if (dump_file) + if (dump_file && (dump_flags & (TDF_DETAILS|TDF_ALIAS))) dump_alias_info (dump_file); /* Compute restrict-based memory disambiguations. */ @@ -8305,7 +8309,7 @@ ipa_pta_execute (void) fprintf (dump_file, "\n"); } - if (dump_file) + if (dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, "Generating generic constraints\n\n"); dump_constraints (dump_file, from); @@ -8344,7 +8348,7 @@ ipa_pta_execute (void) vi = create_function_info_for (node->decl, alias_get_name (node->decl), false, nonlocal_p); - if (dump_file + if (dump_file && (dump_flags & TDF_DETAILS) && from != constraints.length ()) { fprintf (dump_file, @@ -8385,7 +8389,7 @@ ipa_pta_execute (void) vi->is_ipa_escape_point = true; } - if (dump_file + if (dump_file && (dump_flags & TDF_DETAILS) && from != constraints.length ()) { fprintf (dump_file, @@ -8442,7 +8446,7 @@ ipa_pta_execute (void) } } - if (dump_file) + if (dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, "\n"); dump_constraints (dump_file, from); @@ -8454,7 +8458,10 @@ ipa_pta_execute (void) /* From the constraints compute the points-to sets. */ solve_constraints (); - if (dump_file) + if (dump_file && (dump_flags & TDF_STATS)) + dump_sa_stats (dump_file); + + if (dump_file && (dump_flags & TDF_DETAILS)) dump_sa_points_to_info (dump_file); /* Now post-process solutions to handle locals from different