Daily bump.
[gcc.git] / gcc / tree-loop-linear.c
index 0333304612928aec7cb64f79d95e3a4138f63892..da790dc842f9a311a7d4dc969a302b2fa501c2f6 100644 (file)
@@ -16,15 +16,14 @@ for more details.
 
 You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING.  If not, write to the Free
-Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-02111-1307, USA.  */
+Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301, USA.  */
 
 
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
-#include "errors.h"
 #include "ggc.h"
 #include "tree.h"
 #include "target.h"
@@ -99,7 +98,7 @@ gather_interchange_stats (varray_type dependence_relations,
                          unsigned int *nb_deps_not_carried_by_loop, 
                          unsigned int *access_strides)
 {
-  unsigned int i;
+  unsigned int i, j;
 
   *dependence_steps = 0;
   *nb_deps_not_carried_by_loop = 0;
@@ -107,7 +106,6 @@ gather_interchange_stats (varray_type dependence_relations,
 
   for (i = 0; i < VARRAY_ACTIVE_SIZE (dependence_relations); i++)
     {
-      int dist;
       struct data_dependence_relation *ddr = 
        (struct data_dependence_relation *) 
        VARRAY_GENERIC_PTR (dependence_relations, i);
@@ -115,21 +113,24 @@ gather_interchange_stats (varray_type dependence_relations,
       /* If we don't know anything about this dependence, or the distance
         vector is NULL, or there is no dependence, then there is no reuse of
         data.  */
-
-      if (DDR_DIST_VECT (ddr) == NULL
-         || DDR_ARE_DEPENDENT (ddr) == chrec_dont_know
-         || DDR_ARE_DEPENDENT (ddr) == chrec_known)
+      if (DDR_ARE_DEPENDENT (ddr) == chrec_dont_know
+         || DDR_ARE_DEPENDENT (ddr) == chrec_known
+         || DDR_NUM_DIST_VECTS (ddr) == 0)
        continue;
-      
 
-      
-      dist = DDR_DIST_VECT (ddr)[loop->depth - first_loop->depth];
-      if (dist == 0)
-       (*nb_deps_not_carried_by_loop) += 1;
-      else if (dist < 0)
-       (*dependence_steps) += -dist;
-      else
-       (*dependence_steps) += dist;
+      for (j = 0; j < DDR_NUM_DIST_VECTS (ddr); j++)
+       {
+         int dist = DDR_DIST_VECT (ddr, j)[loop->depth - first_loop->depth];
+
+         if (dist == 0)
+           (*nb_deps_not_carried_by_loop) += 1;
+
+         else if (dist < 0)
+           (*dependence_steps) += -dist;
+
+         else
+           (*dependence_steps) += dist;
+       }
     }
 
   /* Compute the access strides.  */
@@ -243,8 +244,9 @@ void
 linear_transform_loops (struct loops *loops)
 {
   unsigned int i;
+  VEC(tree,heap) *oldivs = NULL;
+  VEC(tree,heap) *invariants = NULL;
   
-  compute_immediate_uses (TDFA_USE_OPS | TDFA_USE_VOPS, NULL);
   for (i = 1; i < loops->num; i++)
     {
       unsigned int depth = 0;
@@ -252,8 +254,6 @@ linear_transform_loops (struct loops *loops)
       varray_type dependence_relations;
       struct loop *loop_nest = loops->parray[i];
       struct loop *temp;
-      VEC (tree) *oldivs = NULL;
-      VEC (tree) *invariants = NULL;
       lambda_loopnest before, after;
       lambda_trans_matrix trans;
       bool problem = false;
@@ -272,8 +272,10 @@ linear_transform_loops (struct loops *loops)
                 ...
                }
            } */
-      if (!loop_nest->inner)
+      if (!loop_nest || !loop_nest->inner)
        continue;
+      VEC_truncate (tree, oldivs, 0);
+      VEC_truncate (tree, invariants, 0);
       depth = 1;
       for (temp = loop_nest->inner; temp; temp = temp->inner)
        {
@@ -295,7 +297,7 @@ linear_transform_loops (struct loops *loops)
                               "dependence_relations");
       
   
-      compute_data_dependences_for_loop (depth, loop_nest,
+      compute_data_dependences_for_loop (loop_nest, true,
                                         &datarefs, &dependence_relations);
       if (dump_file && (dump_flags & TDF_DETAILS))
        {
@@ -307,16 +309,7 @@ linear_transform_loops (struct loops *loops)
                VARRAY_GENERIC_PTR (dependence_relations, j);
 
              if (DDR_ARE_DEPENDENT (ddr) == NULL_TREE)
-               {
-                 fprintf (dump_file, "DISTANCE_V (");
-                 print_lambda_vector (dump_file, DDR_DIST_VECT (ddr), 
-                                      DDR_SIZE_VECT (ddr));
-                 fprintf (dump_file, ")\n");
-                 fprintf (dump_file, "DIRECTION_V (");
-                 print_lambda_vector (dump_file, DDR_DIR_VECT (ddr), 
-                                      DDR_SIZE_VECT (ddr));
-                 fprintf (dump_file, ")\n");
-               }
+               dump_data_dependence_relation (dump_file, ddr);
            }
          fprintf (dump_file, "\n\n");
        }
@@ -366,16 +359,11 @@ linear_transform_loops (struct loops *loops)
                                       after, trans);
       if (dump_file)
        fprintf (dump_file, "Successfully transformed loop.\n");
-      oldivs = NULL;
-      invariants = NULL;
       free_dependence_relations (dependence_relations);
       free_data_refs (datarefs);
     }
-  free_df ();
+  VEC_free (tree, heap, oldivs);
+  VEC_free (tree, heap, invariants);
   scev_reset ();
-  rewrite_into_ssa (false);
-  rewrite_into_loop_closed_ssa ();
-#ifdef ENABLE_CHECKING
-  verify_loop_closed_ssa ();
-#endif
+  rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa_full_phi);
 }