2009-05-25 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 25 May 2009 13:35:10 +0000 (13:35 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 25 May 2009 13:35:10 +0000 (13:35 +0000)
* tree-ssa-alias.h (dump_points_to_solution): Declare.
* tree-inline.c (expand_call_inline): Reset the escaped and
callused solutions.
* tree-ssa-structalias.c (pass_build_ealias): New.
* tree-pass.h (pass_build_ealias): Declare.
* passes.c (init_optimization_passes): Add PTA during
early optimizations.
* tree-ssa-alias.c (dump_alias_info): Dump the ESCAPED
and CALLUSED solutions.
(dump_points_to_solution): New function, split out from ...
(dump_points_to_info_for): ... here.
* tree-parloops.c (parallelize_loops): Reset the escaped and
callused solutions.

* gcc.dg/tree-ssa/ssa-fre-14.c: Adjust.
* gcc.dg/tree-ssa/ssa-fre-15.c: Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@147848 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/passes.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-14.c
gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-15.c
gcc/tree-inline.c
gcc/tree-parloops.c
gcc/tree-pass.h
gcc/tree-ssa-alias.c
gcc/tree-ssa-alias.h
gcc/tree-ssa-structalias.c

index cbcd386..ef7e845 100644 (file)
@@ -1,3 +1,19 @@
+2009-05-25  Richard Guenther  <rguenther@suse.de>
+
+       * tree-ssa-alias.h (dump_points_to_solution): Declare.
+       * tree-inline.c (expand_call_inline): Reset the escaped and
+       callused solutions.
+       * tree-ssa-structalias.c (pass_build_ealias): New.
+       * tree-pass.h (pass_build_ealias): Declare.
+       * passes.c (init_optimization_passes): Add PTA during 
+       early optimizations.
+       * tree-ssa-alias.c (dump_alias_info): Dump the ESCAPED
+       and CALLUSED solutions.
+       (dump_points_to_solution): New function, split out from ...
+       (dump_points_to_info_for): ... here.
+       * tree-parloops.c (parallelize_loops): Reset the escaped and
+       callused solutions.
+
 2009-05-25  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>
 
        PR bootstrap/40027
index 28838b5..2408668 100644 (file)
@@ -554,7 +554,11 @@ init_optimization_passes (void)
          NEXT_PASS (pass_rename_ssa_copies);
          NEXT_PASS (pass_ccp);
          NEXT_PASS (pass_forwprop);
-         NEXT_PASS (pass_update_address_taken);
+         /* pass_build_ealias is a dummy pass that ensures that we
+            execute TODO_rebuild_alias at this point.  Re-building
+            alias information also rewrites no longer addressed
+            locals into SSA form if possible.  */
+         NEXT_PASS (pass_build_ealias);
          NEXT_PASS (pass_sra_early);
          NEXT_PASS (pass_copy_prop);
          NEXT_PASS (pass_merge_phi);
index 7a72310..097317c 100644 (file)
@@ -1,3 +1,8 @@
+2009-05-25  Richard Guenther  <rguenther@suse.de>
+
+       * gcc.dg/tree-ssa/ssa-fre-14.c: Adjust.
+       * gcc.dg/tree-ssa/ssa-fre-15.c: Likewise.
+
 2009-05-25  Ira Rosen  <irar@il.ibm.com>
 
        PR tree-optimization/40238
index 24b58ee..81b82fe 100644 (file)
@@ -8,6 +8,7 @@ struct Foo
   void *data;
   double size;
 };
+void bar(double *);
 void foo(double (*q)[4])
 {
   struct Foo tmp1;
@@ -23,6 +24,7 @@ void foo(double (*q)[4])
         this store to tmp1 here.  */
       tmp1.size -= 1.0;
     }
+  bar(a);
 }
 
 /* { dg-final { scan-tree-dump "Inserted .* &a" "fre" } } */
index a557f27..d24cd1e 100644 (file)
@@ -8,6 +8,7 @@ struct Foo
   void *data;
   double size;
 };
+void bar(double *);
 void foo(double (*q)[4])
 {
   struct Foo tmp1;
@@ -22,6 +23,7 @@ void foo(double (*q)[4])
         this store to tmp1 here.  */
       tmp1.size -= 1.0;
     }
+  bar(a);
 }
 
 /* { dg-final { scan-tree-dump "Replaced" "fre" } } */
index 1b53288..fd04f6f 100644 (file)
@@ -3451,6 +3451,13 @@ expand_call_inline (basic_block bb, gimple stmt, copy_body_data *id)
      duplicate our body before altering anything.  */
   copy_body (id, bb->count, bb->frequency, bb, return_block);
 
+  /* Reset the escaped and callused solutions.  */
+  if (cfun->gimple_df)
+    {
+      pt_solution_reset (&cfun->gimple_df->escaped);
+      pt_solution_reset (&cfun->gimple_df->callused);
+    }
+
   /* Clean up.  */
   pointer_map_destroy (id->decl_map);
   id->decl_map = st;
index 4e9b102..2ec2619 100644 (file)
@@ -1886,6 +1886,16 @@ parallelize_loops (void)
 
   free_stmt_vec_info_vec ();
   htab_delete (reduction_list);
+
+  /* Parallelization will cause new function calls to be inserted through
+     which local variables will escape.  Reset the points-to solutions
+     for ESCAPED and CALLUSED.  */
+  if (changed)
+    {
+      pt_solution_reset (&cfun->gimple_df->escaped);
+      pt_solution_reset (&cfun->gimple_df->callused);
+    }
+
   return changed;
 }
 
index abb4bd1..f300d0e 100644 (file)
@@ -350,6 +350,7 @@ extern struct gimple_opt_pass pass_ccp;
 extern struct gimple_opt_pass pass_phi_only_cprop;
 extern struct gimple_opt_pass pass_build_ssa;
 extern struct gimple_opt_pass pass_build_alias;
+extern struct gimple_opt_pass pass_build_ealias;
 extern struct gimple_opt_pass pass_dominator;
 extern struct gimple_opt_pass pass_dce;
 extern struct gimple_opt_pass pass_dce_loop;
index ef360ea..5be39f0 100644 (file)
@@ -330,7 +330,14 @@ dump_alias_info (FILE *file)
        dump_variable (file, var);
     }
 
-  fprintf (file, "\n\nFlow-insensitive points-to information for %s\n\n", funcname);
+  fprintf (file, "\nCall clobber information\n");
+
+  fprintf (file, "\nESCAPED");
+  dump_points_to_solution (file, &cfun->gimple_df->escaped);
+  fprintf (file, "\nCALLUSED");
+  dump_points_to_solution (file, &cfun->gimple_df->callused);
+
+  fprintf (file, "\n\nFlow-insensitive points-to information\n\n");
 
   for (i = 1; i < num_ssa_names; i++)
     {
@@ -380,37 +387,45 @@ get_ptr_info (tree t)
   return pi;
 }
 
-/* Dump points-to information for SSA_NAME PTR into FILE.  */
+/* Dump the points-to set *PT into FILE.  */
 
 void
-dump_points_to_info_for (FILE *file, tree ptr)
+dump_points_to_solution (FILE *file, struct pt_solution *pt)
 {
-  struct ptr_info_def *pi = SSA_NAME_PTR_INFO (ptr);
+  if (pt->anything)
+    fprintf (file, ", points-to anything");
 
-  print_generic_expr (file, ptr, dump_flags);
+  if (pt->nonlocal)
+    fprintf (file, ", points-to non-local");
 
-  if (pi)
+  if (pt->escaped)
+    fprintf (file, ", points-to escaped");
+
+  if (pt->null)
+    fprintf (file, ", points-to NULL");
+
+  if (pt->vars)
     {
-      if (pi->pt.anything)
-       fprintf (file, ", points-to anything");
+      fprintf (file, ", points-to vars: ");
+      dump_decl_set (file, pt->vars);
+      if (pt->vars_contains_global)
+       fprintf (file, " (includes global vars)");
+    }
+}
 
-      if (pi->pt.nonlocal)
-       fprintf (file, ", points-to non-local");
+/* Dump points-to information for SSA_NAME PTR into FILE.  */
 
-      if (pi->pt.escaped)
-       fprintf (file, ", points-to escaped");
+void
+dump_points_to_info_for (FILE *file, tree ptr)
+{
+  struct ptr_info_def *pi = SSA_NAME_PTR_INFO (ptr);
 
-      if (pi->pt.null)
-       fprintf (file, ", points-to NULL");
+  print_generic_expr (file, ptr, dump_flags);
 
-      if (pi->pt.vars)
-       {
-         fprintf (file, ", points-to vars: ");
-         dump_decl_set (file, pi->pt.vars);
-         if (pi->pt.vars_contains_global)
-           fprintf (file, " (includes global vars)");
-       }
-    }
+  if (pi)
+    dump_points_to_solution (file, &pi->pt);
+  else
+    fprintf (file, ", points-to anything");
 
   fprintf (file, "\n");
 }
index a7ffcaa..d4d736d 100644 (file)
@@ -90,6 +90,7 @@ extern unsigned int walk_aliased_vdefs (tree, tree,
 extern struct ptr_info_def *get_ptr_info (tree);
 extern void dump_alias_info (FILE *);
 extern void debug_alias_info (void);
+extern void dump_points_to_solution (FILE *, struct pt_solution *);
 extern void dump_points_to_info_for (FILE *, tree);
 extern void debug_points_to_info_for (tree);
 extern void dump_alias_stats (FILE *);
index aa94436..1fdbab4 100644 (file)
@@ -5436,6 +5436,28 @@ struct gimple_opt_pass pass_build_alias =
  }
 };
 
+/* A dummy pass to cause points-to information to be computed via
+   TODO_rebuild_alias.  */
+
+struct gimple_opt_pass pass_build_ealias =
+{
+ {
+  GIMPLE_PASS,
+  "ealias",                /* name */
+  gate_tree_pta,           /* gate */
+  NULL,                     /* execute */
+  NULL,                     /* sub */
+  NULL,                     /* next */
+  0,                        /* static_pass_number */
+  TV_NONE,                  /* tv_id */
+  PROP_cfg | PROP_ssa,      /* properties_required */
+  0,                       /* properties_provided */
+  0,                        /* properties_destroyed */
+  0,                        /* todo_flags_start */
+  TODO_rebuild_alias | TODO_dump_func  /* todo_flags_finish */
+ }
+};
+
 
 /* Return true if we should execute IPA PTA.  */
 static bool