summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>2008-10-15 16:13:33 +0000
committerspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>2008-10-15 16:13:33 +0000
commit2e54c85da51bec4d019f0d04f391314939247df7 (patch)
tree2a696ea15c824e9308e4456e69b42c210b4e281b
parentbc55e08243291d5cd3f306ae2e452fec00eb722a (diff)
downloadgcc-2e54c85da51bec4d019f0d04f391314939247df7.tar.gz
2008-10-15 Sebastian Pop <sebastian.pop@amd.com>
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
-rw-r--r--gcc/ChangeLog15
-rw-r--r--gcc/lambda-code.c12
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr37686.c48
-rw-r--r--gcc/tree-data-ref.h16
-rw-r--r--gcc/tree-loop-linear.c9
6 files changed, 91 insertions, 14 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 96fef851263..1ac849fed6f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/lambda-code.c b/gcc/lambda-code.c
index 2fdd898f064..1bf9ddfbf9b 100644
--- a/gcc/lambda-code.c
+++ b/gcc/lambda-code.c
@@ -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;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 731785cb5a9..328a51412b0 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 00000000000..a5094bf9754
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr37686.c
@@ -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++) { }
+ }
+
diff --git a/gcc/tree-data-ref.h b/gcc/tree-data-ref.h
index ee514c5ee92..bd36d237e7e 100644
--- a/gcc/tree-data-ref.h
+++ b/gcc/tree-data-ref.h
@@ -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 *);
diff --git a/gcc/tree-loop-linear.c b/gcc/tree-loop-linear.c
index a97433bf909..8b57e2acf10 100644
--- a/gcc/tree-loop-linear.c
+++ b/gcc/tree-loop-linear.c
@@ -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++)