]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Shrink points-to analysis dumps when not dumping with -details
authorRichard Biener <rguenther@suse.de>
Fri, 10 Mar 2023 11:23:09 +0000 (12:23 +0100)
committerRichard Biener <rguenther@suse.de>
Tue, 18 Apr 2023 14:44:32 +0000 (16:44 +0200)
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.

* 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.dg/ipa/ipa-pta-16.c: Use -details for dump.
* gcc.dg/tm/alias-1.c: Likewise.
* gcc.dg/tm/alias-2.c: Likewise.
* gcc.dg/torture/ipa-pta-1.c: Likewise.
* gcc.dg/torture/pr39074-2.c: Likewise.
* gcc.dg/torture/pr39074.c: Likewise.
* gcc.dg/torture/pta-callused-1.c: Likewise.
* gcc.dg/torture/pta-escape-1.c: Likewise.
* gcc.dg/torture/pta-ptrarith-1.c: Likewise.
* gcc.dg/torture/pta-ptrarith-2.c: Likewise.
* gcc.dg/torture/pta-ptrarith-3.c: Likewise.
* gcc.dg/torture/pta-structcopy-1.c: Likewise.
* gcc.dg/torture/ssa-pta-fn-1.c: Likewise.
* gcc.dg/tree-ssa/alias-19.c: Likewise.
* gcc.dg/tree-ssa/pta-callused.c: Likewise.
* gcc.dg/tree-ssa/pta-fp.c: Likewise.
* gcc.dg/tree-ssa/pta-ptrarith-1.c: Likewise.
* gcc.dg/tree-ssa/pta-ptrarith-2.c: Likewise.

19 files changed:
gcc/testsuite/gcc.dg/ipa/ipa-pta-16.c
gcc/testsuite/gcc.dg/tm/alias-1.c
gcc/testsuite/gcc.dg/tm/alias-2.c
gcc/testsuite/gcc.dg/torture/ipa-pta-1.c
gcc/testsuite/gcc.dg/torture/pr39074-2.c
gcc/testsuite/gcc.dg/torture/pr39074.c
gcc/testsuite/gcc.dg/torture/pta-callused-1.c
gcc/testsuite/gcc.dg/torture/pta-escape-1.c
gcc/testsuite/gcc.dg/torture/pta-ptrarith-1.c
gcc/testsuite/gcc.dg/torture/pta-ptrarith-2.c
gcc/testsuite/gcc.dg/torture/pta-ptrarith-3.c
gcc/testsuite/gcc.dg/torture/pta-structcopy-1.c
gcc/testsuite/gcc.dg/torture/ssa-pta-fn-1.c
gcc/testsuite/gcc.dg/tree-ssa/alias-19.c
gcc/testsuite/gcc.dg/tree-ssa/pta-callused.c
gcc/testsuite/gcc.dg/tree-ssa/pta-fp.c
gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-1.c
gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-2.c
gcc/tree-ssa-structalias.cc

index 83b9cd8e1e37a4ab9d2f48e096b0e3906fa6eb80..68fa1c940187c13b4f4e284ed9025af1fcdc1215 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do run } */
-/* { dg-options "-O2 -fno-tree-sra -fipa-pta -fdump-ipa-pta2" } */
+/* { dg-options "-O2 -fno-tree-sra -fipa-pta -fdump-ipa-pta2-details" } */
 
 struct X
 {
index 86b3d7ab0ef88c6f269fed1c94d22044943c8cf1..b90d142072d58f47515ff8bb3b650c3a6d59840f 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-fgnu-tm -fdump-tree-ealias -O" } */
+/* { dg-options "-fgnu-tm -fdump-tree-ealias-details -O" } */
 
 typedef __UINTPTR_TYPE__ ptrcast;
 
index dd3db94cbf7ff49f55f9097e1c8b3bc06a917c6f..19677412ee2e8986fcd3a37d7936417134ceacc5 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-fgnu-tm -fdump-tree-ealias -O" } */
+/* { dg-options "-fgnu-tm -fdump-tree-ealias-details -O" } */
 
 typedef __UINTPTR_TYPE__ ptrcast;
 
index 30156a3b06d6fe008287df8fa7a0c7e5e17f9b0c..fdac819ed7af36ebbc893d2783fca3919f7d8948 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile { target { nonpic || pie_enabled } } } */
-/* { dg-options "-fipa-pta -fdump-ipa-pta2 -fno-ipa-icf" } */
+/* { dg-options "-fipa-pta -fdump-ipa-pta2-details -fno-ipa-icf" } */
 /* { dg-skip-if "" { *-*-* } { "-O0" "-fno-fat-lto-objects" } { "" } } */
 
 struct X { char x; char y; };
index 7286a4f5b305a86d191adf1d06862557a6822835..16c10e88277d1d3279779550e509d07a873ab041 100644 (file)
@@ -1,6 +1,6 @@
 /* { dg-do run } */
 /* { dg-require-effective-target stdint_types } */
-/* { dg-options "-fdump-tree-alias" } */
+/* { dg-options "-fdump-tree-alias-details" } */
 /* { dg-skip-if "" { *-*-* } { "-O0" "-fno-fat-lto-objects" } { "" } } */
 
 #include <stdint.h>
index 40ecdb9c6fb6db3ea0bf1855b843b3ead2200e41..eec4873405d45c494152693c02b36c813e90599d 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do run } */
-/* { dg-options "-fdump-tree-alias" } */
+/* { dg-options "-fdump-tree-alias-details" } */
 /* { dg-skip-if "" { *-*-* } { "-O0" "-fno-fat-lto-objects" } { "" } } */
 
 typedef __INTPTR_TYPE__ intptr_t;
index 0ca6ac91119bfedefb3aacebf225075960495c28..36cf02feeae44b6b943b5790987fb75750277524 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do run } */
-/* { dg-options "-fdump-tree-alias" } */
+/* { dg-options "-fdump-tree-alias-details" } */
 /* { dg-skip-if "" { *-*-* } { "-O0" "-fno-fat-lto-objects" } { "" } } */
 
 volatile int i;
index 9172bedb880e2ceb6196dff69cbfbbd465f9b2cb..d7e9078eba7e15cae115bf0346729cf42f3deafc 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do run } */
-/* { dg-options "-fdump-tree-alias" } */
+/* { dg-options "-fdump-tree-alias-details" } */
 /* { dg-skip-if "" { *-*-* } { "-O0" "-fno-fat-lto-objects" } { "" } } */
 
 int *p;
index 85b68068b121cde20a5e2c40daad70d59d6c73c3..a1dcf4f2ebde775bdf346dd3bd117a898ea8c064 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do run } */
-/* { dg-options "-fdump-tree-alias" } */
+/* { dg-options "-fdump-tree-alias-details" } */
 /* { dg-skip-if "" { *-*-* } { "-O0" "-fno-fat-lto-objects" } { "" } } */
 
 struct Foo {
index 4f5556acc93c24f7a98c88a9b66acfb12eedb10d..7cda636a5a040223364f63f7e48b0c720f7470e9 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do run } */
-/* { dg-options "-fdump-tree-alias" } */
+/* { dg-options "-fdump-tree-alias-details" } */
 /* { dg-skip-if "" { *-*-* } { "-O0" "-fno-fat-lto-objects" } { "" } } */
 
 struct Foo {
index 70829375c0c1d395e80def0aab553b48ebbeef67..7a2b8db9aa2ee4249b9f47e88ab5338a70fb911b 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do run } */
-/* { dg-options "-fdump-tree-alias" } */
+/* { dg-options "-fdump-tree-alias-details" } */
 /* { dg-skip-if "" { *-*-* } { "-O0" "-fno-fat-lto-objects" } { "" } } */
 
 extern void abort (void);
index f9cf8920b6330e446bb6aaacb2c9d6b9f9f10f79..9c4d6801b96183500b002ab61c9d289a1ee0e175 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do run } */
-/* { dg-options "-fdump-tree-ealias -Wno-attributes" } */
+/* { dg-options "-fdump-tree-ealias-details -Wno-attributes" } */
 /* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 struct X
index de019a7ecaf962a79117de3ef959c3016b87b83b..3746320722f82178b90d00af340a9a05831f6a0e 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do run } */
-/* { dg-options "-fdump-tree-alias" } */
+/* { dg-options "-fdump-tree-alias-details" } */
 /* { dg-skip-if "" { *-*-* } { "-O0" "-fno-fat-lto-objects" } { "" } } */
 
 extern void abort (void);
index 330ec001705bbcdf187a321d0915849b8f34858e..219db9b22977d7f17a52da4b7109852d43f30346 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do run } */
-/* { dg-options "-O2 -fdump-tree-alias" } */
+/* { dg-options "-O2 -fdump-tree-alias-details" } */
 
 const static int a;
 
index b9a57d8d13513c17abfd5c28a4a872589d53d814..c7e96fb2cc39a4ac5a595f4f4704487ba5508264 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 --param max-fields-for-field-sensitive=2 -fdump-tree-alias" } */
+/* { dg-options "-O2 --param max-fields-for-field-sensitive=2 -fdump-tree-alias-details" } */
 
 struct Foo {
   int *p, *q;
index 1ff007e505d4d9e613c71735d8838185026b539d..59652c3488aa2673a8af59ffee4d6889fe822d41 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */ 
-/* { dg-options "-O2 -fdump-tree-alias" } */
+/* { dg-options "-O2 -fdump-tree-alias-details" } */
 extern double cos (double);
 extern double sin (double);
 double f(double a)
index b56d589d7b7cb0a35cb3e67fc1e9497a7a3a2c95..9e4c0feb38e75698332f8fbf567ecdd960ec2af7 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -fno-tree-forwprop -fno-tree-ccp -fdump-tree-ealias" } */
+/* { dg-options "-O2 -fno-tree-forwprop -fno-tree-ccp -fdump-tree-ealias-details" } */
 
 extern void abort (void);
 struct X {
index be06a75ed8dc4451a20ff0e03df19e1530329431..70b432f0f397921a2e1c0f04db6854e255c5f83b 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -fno-tree-forwprop -fno-tree-ccp -fdump-tree-ealias" } */
+/* { dg-options "-O2 -fno-tree-forwprop -fno-tree-ccp -fdump-tree-ealias-details" } */
 
 extern void abort (void);
 struct X {
index c3c5bce42dfe7464f0854a57087bd4ca20253370..fa3a2e4e1f9195901dde1a63c3711347c3ca0f32 100644 (file)
@@ -7137,33 +7137,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)
@@ -7544,7 +7544,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);
@@ -7617,7 +7617,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.  */
@@ -8039,7 +8042,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;
@@ -8051,7 +8055,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.  */
@@ -8312,7 +8316,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);
@@ -8351,7 +8355,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,
@@ -8392,7 +8396,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,
@@ -8449,7 +8453,7 @@ ipa_pta_execute (void)
            }
        }
 
-      if (dump_file)
+      if (dump_file && (dump_flags & TDF_DETAILS))
        {
          fprintf (dump_file, "\n");
          dump_constraints (dump_file, from);
@@ -8461,7 +8465,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