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.
Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed to trunk. * 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. --- gcc/testsuite/gcc.dg/ipa/ipa-pta-16.c | 2 +- gcc/testsuite/gcc.dg/tm/alias-1.c | 2 +- gcc/testsuite/gcc.dg/tm/alias-2.c | 2 +- gcc/testsuite/gcc.dg/torture/ipa-pta-1.c | 2 +- gcc/testsuite/gcc.dg/torture/pr39074-2.c | 2 +- gcc/testsuite/gcc.dg/torture/pr39074.c | 2 +- gcc/testsuite/gcc.dg/torture/pta-callused-1.c | 2 +- gcc/testsuite/gcc.dg/torture/pta-escape-1.c | 2 +- gcc/testsuite/gcc.dg/torture/pta-ptrarith-1.c | 2 +- gcc/testsuite/gcc.dg/torture/pta-ptrarith-2.c | 2 +- gcc/testsuite/gcc.dg/torture/pta-ptrarith-3.c | 2 +- .../gcc.dg/torture/pta-structcopy-1.c | 2 +- gcc/testsuite/gcc.dg/torture/ssa-pta-fn-1.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/alias-19.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/pta-callused.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/pta-fp.c | 2 +- .../gcc.dg/tree-ssa/pta-ptrarith-1.c | 2 +- .../gcc.dg/tree-ssa/pta-ptrarith-2.c | 2 +- gcc/tree-ssa-structalias.cc | 63 ++++++++++--------- 19 files changed, 53 insertions(+), 46 deletions(-) diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-pta-16.c b/gcc/testsuite/gcc.dg/ipa/ipa-pta-16.c index 83b9cd8e1e3..68fa1c94018 100644 --- a/gcc/testsuite/gcc.dg/ipa/ipa-pta-16.c +++ b/gcc/testsuite/gcc.dg/ipa/ipa-pta-16.c @@ -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 { diff --git a/gcc/testsuite/gcc.dg/tm/alias-1.c b/gcc/testsuite/gcc.dg/tm/alias-1.c index 86b3d7ab0ef..b90d142072d 100644 --- a/gcc/testsuite/gcc.dg/tm/alias-1.c +++ b/gcc/testsuite/gcc.dg/tm/alias-1.c @@ -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; diff --git a/gcc/testsuite/gcc.dg/tm/alias-2.c b/gcc/testsuite/gcc.dg/tm/alias-2.c index dd3db94cbf7..19677412ee2 100644 --- a/gcc/testsuite/gcc.dg/tm/alias-2.c +++ b/gcc/testsuite/gcc.dg/tm/alias-2.c @@ -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; diff --git a/gcc/testsuite/gcc.dg/torture/ipa-pta-1.c b/gcc/testsuite/gcc.dg/torture/ipa-pta-1.c index 30156a3b06d..fdac819ed7a 100644 --- a/gcc/testsuite/gcc.dg/torture/ipa-pta-1.c +++ b/gcc/testsuite/gcc.dg/torture/ipa-pta-1.c @@ -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; }; diff --git a/gcc/testsuite/gcc.dg/torture/pr39074-2.c b/gcc/testsuite/gcc.dg/torture/pr39074-2.c index 7286a4f5b30..16c10e88277 100644 --- a/gcc/testsuite/gcc.dg/torture/pr39074-2.c +++ b/gcc/testsuite/gcc.dg/torture/pr39074-2.c @@ -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> diff --git a/gcc/testsuite/gcc.dg/torture/pr39074.c b/gcc/testsuite/gcc.dg/torture/pr39074.c index 40ecdb9c6fb..eec4873405d 100644 --- a/gcc/testsuite/gcc.dg/torture/pr39074.c +++ b/gcc/testsuite/gcc.dg/torture/pr39074.c @@ -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; diff --git a/gcc/testsuite/gcc.dg/torture/pta-callused-1.c b/gcc/testsuite/gcc.dg/torture/pta-callused-1.c index 0ca6ac91119..36cf02feeae 100644 --- a/gcc/testsuite/gcc.dg/torture/pta-callused-1.c +++ b/gcc/testsuite/gcc.dg/torture/pta-callused-1.c @@ -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; diff --git a/gcc/testsuite/gcc.dg/torture/pta-escape-1.c b/gcc/testsuite/gcc.dg/torture/pta-escape-1.c index 9172bedb880..d7e9078eba7 100644 --- a/gcc/testsuite/gcc.dg/torture/pta-escape-1.c +++ b/gcc/testsuite/gcc.dg/torture/pta-escape-1.c @@ -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; diff --git a/gcc/testsuite/gcc.dg/torture/pta-ptrarith-1.c b/gcc/testsuite/gcc.dg/torture/pta-ptrarith-1.c index 85b68068b12..a1dcf4f2ebd 100644 --- a/gcc/testsuite/gcc.dg/torture/pta-ptrarith-1.c +++ b/gcc/testsuite/gcc.dg/torture/pta-ptrarith-1.c @@ -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 { diff --git a/gcc/testsuite/gcc.dg/torture/pta-ptrarith-2.c b/gcc/testsuite/gcc.dg/torture/pta-ptrarith-2.c index 4f5556acc93..7cda636a5a0 100644 --- a/gcc/testsuite/gcc.dg/torture/pta-ptrarith-2.c +++ b/gcc/testsuite/gcc.dg/torture/pta-ptrarith-2.c @@ -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 { diff --git a/gcc/testsuite/gcc.dg/torture/pta-ptrarith-3.c b/gcc/testsuite/gcc.dg/torture/pta-ptrarith-3.c index 70829375c0c..7a2b8db9aa2 100644 --- a/gcc/testsuite/gcc.dg/torture/pta-ptrarith-3.c +++ b/gcc/testsuite/gcc.dg/torture/pta-ptrarith-3.c @@ -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); diff --git a/gcc/testsuite/gcc.dg/torture/pta-structcopy-1.c b/gcc/testsuite/gcc.dg/torture/pta-structcopy-1.c index f9cf8920b63..9c4d6801b96 100644 --- a/gcc/testsuite/gcc.dg/torture/pta-structcopy-1.c +++ b/gcc/testsuite/gcc.dg/torture/pta-structcopy-1.c @@ -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 diff --git a/gcc/testsuite/gcc.dg/torture/ssa-pta-fn-1.c b/gcc/testsuite/gcc.dg/torture/ssa-pta-fn-1.c index de019a7ecaf..3746320722f 100644 --- a/gcc/testsuite/gcc.dg/torture/ssa-pta-fn-1.c +++ b/gcc/testsuite/gcc.dg/torture/ssa-pta-fn-1.c @@ -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); diff --git a/gcc/testsuite/gcc.dg/tree-ssa/alias-19.c b/gcc/testsuite/gcc.dg/tree-ssa/alias-19.c index 330ec001705..219db9b2297 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/alias-19.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/alias-19.c @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-options "-O2 -fdump-tree-alias" } */ +/* { dg-options "-O2 -fdump-tree-alias-details" } */ const static int a; diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pta-callused.c b/gcc/testsuite/gcc.dg/tree-ssa/pta-callused.c index b9a57d8d135..c7e96fb2cc3 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pta-callused.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pta-callused.c @@ -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; diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pta-fp.c b/gcc/testsuite/gcc.dg/tree-ssa/pta-fp.c index 1ff007e505d..59652c3488a 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pta-fp.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pta-fp.c @@ -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) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-1.c index b56d589d7b7..9e4c0feb38e 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-1.c @@ -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 { diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-2.c b/gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-2.c index be06a75ed8d..70b432f0f39 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-2.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-2.c @@ -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 { diff --git a/gcc/tree-ssa-structalias.cc b/gcc/tree-ssa-structalias.cc index c3c5bce42df..fa3a2e4e1f9 100644 --- a/gcc/tree-ssa-structalias.cc +++ b/gcc/tree-ssa-structalias.cc @@ -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 -- 2.35.3