Hi,

Consider testcase:
...
int __attribute__((noinline, noclone))
foo (int *__restrict__ a, int *__restrict__ b)
{
  *a = 1;
  *b = 2;
}

int __attribute__((noinline, noclone))
bar (int *a, int *b)
{
  foo (a, b);
}
...

Using this patch we have this diff in the pta dumpfile:
...
@@ -24,7 +24,7 @@
   Called by: bar/1 (1.00 per call)
   Calls:

-Generating constraints for global initializers
+Generating generic constraints

 ANYTHING = &ANYTHING
 ESCAPED = *ESCAPED
...

I'll commit to trunk if bootstrap and reg-test succeeds, unless there are objections.

Thanks,
- Tom
Cleanup fipa-pta constraint dumping

2015-10-29  Tom de Vries  <t...@codesourcery.com>

	* tree-ssa-structalias.c (ipa_pta_execute): Declare variable from as
	unsigned.  Add generic constraints dumping section.  Don't dump
	global initializers constraints dump section if empty.  Don't update
	if unused.
---
 gcc/tree-ssa-structalias.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index 4f7a788..3bef607 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -7283,7 +7283,7 @@ ipa_pta_execute (void)
 {
   struct cgraph_node *node;
   varpool_node *var;
-  int from;
+  unsigned int from = 0;
 
   in_ipa_mode = 1;
 
@@ -7295,6 +7295,15 @@ ipa_pta_execute (void)
       fprintf (dump_file, "\n");
     }
 
+  if (dump_file)
+    {
+      fprintf (dump_file, "Generating generic constraints\n\n");
+      dump_constraints (dump_file, from);
+      fprintf (dump_file, "\n");
+
+      from = constraints.length ();
+    }
+
   /* Build the constraints.  */
   FOR_EACH_DEFINED_FUNCTION (node)
     {
@@ -7323,14 +7332,15 @@ ipa_pta_execute (void)
       get_vi_for_tree (var->decl);
     }
 
-  if (dump_file)
+  if (dump_file
+      && from != constraints.length ())
     {
       fprintf (dump_file,
 	       "Generating constraints for global initializers\n\n");
-      dump_constraints (dump_file, 0);
+      dump_constraints (dump_file, from);
       fprintf (dump_file, "\n");
+      from = constraints.length ();
     }
-  from = constraints.length ();
 
   FOR_EACH_DEFINED_FUNCTION (node)
     {
@@ -7415,8 +7425,8 @@ ipa_pta_execute (void)
 	  fprintf (dump_file, "\n");
 	  dump_constraints (dump_file, from);
 	  fprintf (dump_file, "\n");
+	  from = constraints.length ();
 	}
-      from = constraints.length ();
     }
 
   /* From the constraints compute the points-to sets.  */
-- 
1.9.1

Reply via email to