Prune SCEV
authorMarek Polacek <polacek@redhat.com>
Wed, 24 Apr 2013 14:04:44 +0000 (14:04 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Wed, 24 Apr 2013 14:04:44 +0000 (14:04 +0000)
From-SVN: r198233

gcc/ChangeLog
gcc/tree-scalar-evolution.c
gcc/tree-scalar-evolution.h

index 8a153c9f761ea8d781be2cba6e463a74b55953dc..2a6d864b5f850e7bbaea5f18989de2e282f883bc 100644 (file)
@@ -1,3 +1,12 @@
+2013-04-24  Marek Polacek  <polacek@redhat.com>
+
+       * tree-scalar-evolution.h (analyze_scalar_evolution): Remove.
+       * tree-scalar-evolution.c (get_exit_conditions_rec): Likewise.
+       (select_loops_exit_conditions): Likewise.
+       (number_of_iterations_for_all_loops): Likewise.
+       (analyze_scalar_evolution_for_all_loop_phi_nodes): Likewise.
+       (scev_analysis): Likewise.
+
 2013-04-02  Catherine Moore  <clm@codesourcery.com>
            Chao-ying Fu <fu@mips.com>
 
index 5c9ee519d7358ddb4b7ddbb4f70c9e6160088158..a76d9aee46a941a122e3fbb108199da10625c275 100644 (file)
@@ -868,39 +868,6 @@ get_loop_exit_condition (const struct loop *loop)
   return res;
 }
 
-/* Recursively determine and enqueue the exit conditions for a loop.  */
-
-static void
-get_exit_conditions_rec (struct loop *loop,
-                        vec<gimple> *exit_conditions)
-{
-  if (!loop)
-    return;
-
-  /* Recurse on the inner loops, then on the next (sibling) loops.  */
-  get_exit_conditions_rec (loop->inner, exit_conditions);
-  get_exit_conditions_rec (loop->next, exit_conditions);
-
-  if (single_exit (loop))
-    {
-      gimple loop_condition = get_loop_exit_condition (loop);
-
-      if (loop_condition)
-       exit_conditions->safe_push (loop_condition);
-    }
-}
-
-/* Select the candidate loop nests for the analysis.  This function
-   initializes the EXIT_CONDITIONS array.  */
-
-static void
-select_loops_exit_conditions (vec<gimple> *exit_conditions)
-{
-  struct loop *function_body = current_loops->tree_root;
-
-  get_exit_conditions_rec (function_body->inner, exit_conditions);
-}
-
 \f
 /* Depth first search algorithm.  */
 
@@ -2882,41 +2849,6 @@ number_of_exit_cond_executions (struct loop *loop)
   return ret;
 }
 
-/* One of the drivers for testing the scalar evolutions analysis.
-   This function computes the number of iterations for all the loops
-   from the EXIT_CONDITIONS array.  */
-
-static void
-number_of_iterations_for_all_loops (vec<gimple> *exit_conditions)
-{
-  unsigned int i;
-  unsigned nb_chrec_dont_know_loops = 0;
-  unsigned nb_static_loops = 0;
-  gimple cond;
-
-  FOR_EACH_VEC_ELT (*exit_conditions, i, cond)
-    {
-      tree res = number_of_latch_executions (loop_containing_stmt (cond));
-      if (chrec_contains_undetermined (res))
-       nb_chrec_dont_know_loops++;
-      else
-       nb_static_loops++;
-    }
-
-  if (dump_file)
-    {
-      fprintf (dump_file, "\n(\n");
-      fprintf (dump_file, "-----------------------------------------\n");
-      fprintf (dump_file, "%d\tnb_chrec_dont_know_loops\n", nb_chrec_dont_know_loops);
-      fprintf (dump_file, "%d\tnb_static_loops\n", nb_static_loops);
-      fprintf (dump_file, "%d\tnb_total_loops\n", number_of_loops ());
-      fprintf (dump_file, "-----------------------------------------\n");
-      fprintf (dump_file, ")\n\n");
-
-      print_loops (dump_file, 3);
-    }
-}
-
 \f
 
 /* Counters for the stats.  */
@@ -3028,54 +2960,6 @@ gather_chrec_stats (tree chrec, struct chrec_stats *stats)
     fprintf (dump_file, ")\n");
 }
 
-/* One of the drivers for testing the scalar evolutions analysis.
-   This function analyzes the scalar evolution of all the scalars
-   defined as loop phi nodes in one of the loops from the
-   EXIT_CONDITIONS array.
-
-   TODO Optimization: A loop is in canonical form if it contains only
-   a single scalar loop phi node.  All the other scalars that have an
-   evolution in the loop are rewritten in function of this single
-   index.  This allows the parallelization of the loop.  */
-
-static void
-analyze_scalar_evolution_for_all_loop_phi_nodes (vec<gimple> *exit_conditions)
-{
-  unsigned int i;
-  struct chrec_stats stats;
-  gimple cond, phi;
-  gimple_stmt_iterator psi;
-
-  reset_chrecs_counters (&stats);
-
-  FOR_EACH_VEC_ELT (*exit_conditions, i, cond)
-    {
-      struct loop *loop;
-      basic_block bb;
-      tree chrec;
-
-      loop = loop_containing_stmt (cond);
-      bb = loop->header;
-
-      for (psi = gsi_start_phis (bb); !gsi_end_p (psi); gsi_next (&psi))
-       {
-         phi = gsi_stmt (psi);
-         if (!virtual_operand_p (PHI_RESULT (phi)))
-           {
-             chrec = instantiate_parameters
-                       (loop,
-                        analyze_scalar_evolution (loop, PHI_RESULT (phi)));
-
-             if (dump_file && (dump_flags & TDF_STATS))
-               gather_chrec_stats (chrec, &stats);
-           }
-       }
-    }
-
-  if (dump_file && (dump_flags & TDF_STATS))
-    dump_chrecs_stats (dump_file, &stats);
-}
-
 /* Callback for htab_traverse, gathers information on chrecs in the
    hashtable.  */
 
@@ -3254,23 +3138,6 @@ simple_iv (struct loop *wrto_loop, struct loop *use_loop, tree op,
   return true;
 }
 
-/* Runs the analysis of scalar evolutions.  */
-
-void
-scev_analysis (void)
-{
-  vec<gimple> exit_conditions;
-
-  exit_conditions.create (37);
-  select_loops_exit_conditions (&exit_conditions);
-
-  if (dump_file && (dump_flags & TDF_STATS))
-    analyze_scalar_evolution_for_all_loop_phi_nodes (&exit_conditions);
-
-  number_of_iterations_for_all_loops (&exit_conditions);
-  exit_conditions.release ();
-}
-
 /* Finalize the scalar evolution analysis.  */
 
 void
index 1c0812b906641f090cf42408f3f29b1d5eaada22..7e7f6f23833b566ce8e189d2378c6e5beca25066 100644 (file)
@@ -34,7 +34,6 @@ extern tree analyze_scalar_evolution (struct loop *, tree);
 extern tree instantiate_scev (basic_block, struct loop *, tree);
 extern tree resolve_mixers (struct loop *, tree);
 extern void gather_stats_on_scev_database (void);
-extern void scev_analysis (void);
 extern unsigned int scev_const_prop (void);
 extern bool expression_expensive_p (tree);
 extern bool simple_iv (struct loop *, struct loop *, tree, affine_iv *, bool);