]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2008-10-15 Sebastian Pop <sebastian.pop@amd.com>
authorspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 15 Oct 2008 16:13:33 +0000 (16:13 +0000)
committerspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 15 Oct 2008 16:13:33 +0000 (16:13 +0000)
PR tree-optimization/37686
* testsuite/gcc.dg/tree-ssa/pr37686.c: New.
* tree-loop-linear.c (linear_transform_loops): Build a
loop nest vector.  Pass it to lambda_compute_access_matrices.
* tree-data-ref.h (struct access_matrix): Store the loop nest
relative to which it encodes the information.
(AM_LOOP_NEST_NUM): Renamed AM_LOOP_NEST.
(am_vector_index_for_loop): Reimplemented: iterate over the
loop nest for finding the loop index in the access matrix.
(lambda_compute_access_matrices): Update declaration.
* lambda-code.c (build_access_matrix): Pass the loop nest and
record it.
(lambda_compute_access_matrices): Same.

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

gcc/ChangeLog
gcc/lambda-code.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/pr37686.c [new file with mode: 0644]
gcc/tree-data-ref.h
gcc/tree-loop-linear.c

index 96fef8512635160ebb1cb4d91ebf8cfa81fb32fa..1ac849fed6f1d5be6216741abafc5f1afec576cd 100644 (file)
@@ -1,3 +1,18 @@
+2008-10-15  Sebastian Pop  <sebastian.pop@amd.com>
+
+       PR tree-optimization/37686
+       * tree-loop-linear.c (linear_transform_loops): Build a
+       loop nest vector.  Pass it to lambda_compute_access_matrices.
+       * tree-data-ref.h (struct access_matrix): Store the loop nest
+       relative to which it encodes the information.
+       (AM_LOOP_NEST_NUM): Renamed AM_LOOP_NEST.
+       (am_vector_index_for_loop): Reimplemented: iterate over the
+       loop nest for finding the loop index in the access matrix.
+       (lambda_compute_access_matrices): Update declaration.
+       * lambda-code.c (build_access_matrix): Pass the loop nest and
+       record it.
+       (lambda_compute_access_matrices): Same.
+
 2008-10-15  Andreas Krebbel  <krebbel1@de.ibm.com>
 
        * config/s390/s390.h: (TARGET_DFP): This requires TARGET_HARD_FLOAT.
index 2fdd898f0644d415b1e929c706dda93eb2590a38..1bf9ddfbf9b9456cf1d98fc58f675a0445a89d50 100644 (file)
@@ -2786,17 +2786,15 @@ av_for_af (tree access_fun, lambda_vector cy, struct access_matrix *am)
 
 static bool
 build_access_matrix (data_reference_p data_reference,
-                    VEC (tree, heap) *parameters, int loop_nest_num)
+                    VEC (tree, heap) *parameters, VEC (loop_p, heap) *nest)
 {
   struct access_matrix *am = GGC_NEW (struct access_matrix);
   unsigned i, ndim = DR_NUM_DIMENSIONS (data_reference);
-  struct loop *loop = gimple_bb (DR_STMT (data_reference))->loop_father;
-  struct loop *loop_nest = get_loop (loop_nest_num);
-  unsigned nivs = loop_depth (loop) - loop_depth (loop_nest) + 1;
+  unsigned nivs = VEC_length (loop_p, nest);
   unsigned lambda_nb_columns;
   lambda_vector_vec_p matrix;
 
-  AM_LOOP_NEST_NUM (am) = loop_nest_num;
+  AM_LOOP_NEST (am) = nest;
   AM_NB_INDUCTION_VARS (am) = nivs;
   AM_PARAMETERS (am) = parameters;
 
@@ -2824,13 +2822,13 @@ build_access_matrix (data_reference_p data_reference,
 bool
 lambda_compute_access_matrices (VEC (data_reference_p, heap) *datarefs,
                                VEC (tree, heap) *parameters,
-                               int loop_nest_num)
+                               VEC (loop_p, heap) *nest)
 {
   data_reference_p dataref;
   unsigned ix;
 
   for (ix = 0; VEC_iterate (data_reference_p, datarefs, ix, dataref); ix++)
-    if (!build_access_matrix (dataref, parameters, loop_nest_num))
+    if (!build_access_matrix (dataref, parameters, nest))
       return false;
 
   return true;
index 731785cb5a9af9ad8cf3b362d38dd81df396f20c..328a51412b0462b10a53a04bdae42abbba4a1d6c 100644 (file)
@@ -1,3 +1,8 @@
+2008-10-15  Sebastian Pop  <sebastian.pop@amd.com>
+
+       PR tree-optimization/37686
+       * testsuite/gcc.dg/tree-ssa/pr37686.c: New.
+
 2008-10-15  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/36881
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr37686.c b/gcc/testsuite/gcc.dg/tree-ssa/pr37686.c
new file mode 100644 (file)
index 0000000..a5094bf
--- /dev/null
@@ -0,0 +1,48 @@
+/* { dg-do compile { target powerpc*-*-* } } */
+/* { dg-options "-O3 -ftree-loop-linear" } */
+
+unsigned char inUse[256];
+unsigned char len[6][258];
+int code[6][258];
+unsigned int crc32Table[256] = { };
+  unsigned int getGlobalCRC (void) { }
+  int bsLive;
+void bsW (int n, unsigned int v) {
+ while (bsLive >= 8) {}
+ }
+ void hbAssignCodes (int * code,         unsigned char * length, int minLen,
+int maxLen, int alphaSize) {
+   int n, vec, i;
+   for (n = minLen;n <= maxLen;n++)
+       for (i = 0; i < alphaSize;i++)
+      code[i] = vec;
+   }
+  void sendMTFValues (void) {
+   int v, t, i, j, gs, ge, totc, bt, bc, iter;
+   int nSelectors, alphaSize, minLen, maxLen, selCtr;
+   int nGroups, nBytes;
+ {
+    while (1)
+  {
+  break;
+  }
+       hbAssignCodes (&code[t][0], &len[t][0], minLen, maxLen, alphaSize);
+     unsigned char inUse16[16];
+     for (i = 0;i < 16;i++)
+ if (inUse16[i])
+  {
+      for (j = 0;j < 16;j++)
+   if (inUse[i * 16 + j])    { }
+    }
+   }
+   for (i = 0; i < nSelectors;i++)     { }
+   for (t = 0; t < nGroups;t++)
+ {
+       int curr = len[t][0];
+       for (i = 0; i < alphaSize;i++)
+          while (curr < len[t][i])     { }
+     }
+   while (1)
+       for (i = gs; i <= ge;i++)  { }
+ }
+
index ee514c5ee922a7ea18a1149aa7e9a9ae25c6d634..bd36d237e7ef37fff8d5625a53a2a45e80495387 100644 (file)
@@ -128,13 +128,13 @@ typedef struct scop *scop_p;
 */
 struct access_matrix
 {
-  int loop_nest_num;
+  VEC (loop_p, heap) *loop_nest;
   int nb_induction_vars;
   VEC (tree, heap) *parameters;
   VEC (lambda_vector, heap) *matrix;
 };
 
-#define AM_LOOP_NEST_NUM(M) (M)->loop_nest_num
+#define AM_LOOP_NEST(M) (M)->loop_nest
 #define AM_NB_INDUCTION_VARS(M) (M)->nb_induction_vars
 #define AM_PARAMETERS(M) (M)->parameters
 #define AM_MATRIX(M) (M)->matrix
@@ -149,8 +149,14 @@ struct access_matrix
 static inline int
 am_vector_index_for_loop (struct access_matrix *access_matrix, int loop_num)
 {
-  gcc_assert (loop_num >= AM_LOOP_NEST_NUM (access_matrix));
-  return loop_num - AM_LOOP_NEST_NUM (access_matrix);
+  int i;
+  loop_p l;
+
+  for (i = 0; VEC_iterate (loop_p, AM_LOOP_NEST (access_matrix), i, l); i++)
+    if (l->num == loop_num)
+      return i;
+
+  gcc_unreachable();
 }
 
 int access_matrix_get_index_for_parameter (tree, struct access_matrix *);
@@ -581,7 +587,7 @@ bool lambda_transform_legal_p (lambda_trans_matrix, int,
 void lambda_collect_parameters (VEC (data_reference_p, heap) *,
                                VEC (tree, heap) **);
 bool lambda_compute_access_matrices (VEC (data_reference_p, heap) *,
-                                    VEC (tree, heap) *, int);
+                                    VEC (tree, heap) *, VEC (loop_p, heap) *);
 
 /* In tree-data-ref.c  */
 void split_constant_offset (tree , tree *, tree *);
index a97433bf90940ca43ab2ba18828bd1e17efdd360..8b57e2acf10931732b1ce7154a6e39e18bf7a752 100644 (file)
@@ -333,11 +333,16 @@ linear_transform_loops (void)
       lambda_loopnest before, after;
       lambda_trans_matrix trans;
       struct obstack lambda_obstack;
+      struct loop *loop;
+      VEC(loop_p,heap) *nest = VEC_alloc (loop_p, heap, 3);
 
       depth = perfect_loop_nest_depth (loop_nest);
       if (depth == 0)
        continue;
 
+      for (loop = loop_nest; loop; loop = loop->inner)
+       VEC_safe_push (loop_p, heap, nest, loop);
+
       gcc_obstack_init (&lambda_obstack);
       VEC_truncate (tree, oldivs, 0);
       VEC_truncate (tree, invariants, 0);
@@ -350,8 +355,7 @@ linear_transform_loops (void)
        goto free_and_continue;
       
       lambda_collect_parameters (datarefs, &lambda_parameters);
-      if (!lambda_compute_access_matrices (datarefs, lambda_parameters,
-                                          loop_nest->num))
+      if (!lambda_compute_access_matrices (datarefs, lambda_parameters, nest))
        goto free_and_continue;
 
       if (dump_file && (dump_flags & TDF_DETAILS))
@@ -410,6 +414,7 @@ linear_transform_loops (void)
       obstack_free (&lambda_obstack, NULL);
       free_dependence_relations (dependence_relations);
       free_data_refs (datarefs);
+      VEC_free (loop_p, heap, nest);
     }
 
   for (i = 0; VEC_iterate (gimple, remove_ivs, i, oldiv_stmt); i++)