]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Pass to dr_analyze_indices the analysis loop for subscripts.
authorspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 25 Jan 2011 06:48:32 +0000 (06:48 +0000)
committerspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 25 Jan 2011 06:48:32 +0000 (06:48 +0000)
2011-01-25  Sebastian Pop  <sebastian.pop@amd.com>

* graphite-scop-detection.c (stmt_has_simple_data_refs_p): Update
call to graphite_find_data_references_in_stmt.
* graphite-sese-to-poly.c (outermost_loop_in_sese_1): New.
(try_generate_gimple_bb): Call outermost_loop_in_sese_1.  Update
call to graphite_find_data_references_in_stmt.
(analyze_drs_in_stmts): Same.
* tree-data-ref.c (dr_analyze_indices): Pass in parameter the loop
in which the scalar analysis of indices is performed.
(create_data_ref): Same.  Update call to dr_analyze_indices.
(find_data_references_in_stmt): Update call to create_data_ref.
(graphite_find_data_references_in_stmt): Same.
* tree-data-ref.h (graphite_find_data_references_in_stmt): Update
declaration.
(create_data_ref): Same.
* tree-ssa-loop-prefetch.c (determine_loop_nest_reuse): Update
call to create_data_ref.

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

gcc/ChangeLog
gcc/ChangeLog.graphite
gcc/graphite-scop-detection.c
gcc/graphite-sese-to-poly.c
gcc/tree-data-ref.c
gcc/tree-data-ref.h
gcc/tree-ssa-loop-prefetch.c

index 755cb45f9d309904a607f8d133dc9538d07c1bfb..ef46f7343699a379362434629e42181c24016656 100644 (file)
@@ -1,3 +1,22 @@
+2011-01-25  Sebastian Pop  <sebastian.pop@amd.com>
+
+       * graphite-scop-detection.c (stmt_has_simple_data_refs_p): Update
+       call to graphite_find_data_references_in_stmt.
+       * graphite-sese-to-poly.c (outermost_loop_in_sese_1): New.
+       (try_generate_gimple_bb): Call outermost_loop_in_sese_1.  Update
+       call to graphite_find_data_references_in_stmt.
+       (analyze_drs_in_stmts): Same.
+       * tree-data-ref.c (dr_analyze_indices): Pass in parameter the loop
+       in which the scalar analysis of indices is performed.
+       (create_data_ref): Same.  Update call to dr_analyze_indices.
+       (find_data_references_in_stmt): Update call to create_data_ref.
+       (graphite_find_data_references_in_stmt): Same.
+       * tree-data-ref.h (graphite_find_data_references_in_stmt): Update
+       declaration.
+       (create_data_ref): Same.
+       * tree-ssa-loop-prefetch.c (determine_loop_nest_reuse): Update
+       call to create_data_ref.
+
 2011-01-25  Sebastian Pop  <sebastian.pop@amd.com>
 
        * graphite-sese-to-poly.c (build_poly_scop): Move
index c61136894ce44884b56ae24bc46ede123ff49893..12524d4b9c1e5da785e2f1d3706a7516a9509d19 100644 (file)
@@ -1,3 +1,22 @@
+2011-01-19  Sebastian Pop  <sebastian.pop@amd.com>
+
+       * graphite-scop-detection.c (stmt_has_simple_data_refs_p): Update
+       call to graphite_find_data_references_in_stmt.
+       * graphite-sese-to-poly.c (outermost_loop_in_sese_1): New.
+       (try_generate_gimple_bb): Call outermost_loop_in_sese_1.  Update
+       call to graphite_find_data_references_in_stmt.
+       (analyze_drs_in_stmts): Same.
+       * tree-data-ref.c (dr_analyze_indices): Pass in parameter the loop
+       in which the scalar analysis of indices is performed.
+       (create_data_ref): Same.  Update call to dr_analyze_indices.
+       (find_data_references_in_stmt): Update call to create_data_ref.
+       (graphite_find_data_references_in_stmt): Same.
+       * tree-data-ref.h (graphite_find_data_references_in_stmt): Update
+       declaration.
+       (create_data_ref): Same.
+       * tree-ssa-loop-prefetch.c (determine_loop_nest_reuse): Update
+       call to create_data_ref.
+
 2011-01-19  Sebastian Pop  <sebastian.pop@amd.com>
 
        * graphite-sese-to-poly.c (build_poly_scop): Move
index 693dfeba2b809665ba32661adf30b37cafecbfab..45c6c75ccea1fa02a8497574c2f15aad762b2096 100644 (file)
@@ -263,7 +263,9 @@ stmt_has_simple_data_refs_p (loop_p outermost_loop, gimple stmt)
   bool res = true;
   VEC (data_reference_p, heap) *drs = VEC_alloc (data_reference_p, heap, 5);
 
-  graphite_find_data_references_in_stmt (outermost_loop, stmt, &drs);
+  graphite_find_data_references_in_stmt (outermost_loop,
+                                        loop_containing_stmt (stmt),
+                                        stmt, &drs);
 
   FOR_EACH_VEC_ELT (data_reference_p, drs, j, dr)
     for (i = 0; i < DR_NUM_DIMENSIONS (dr); i++)
index 3f419c8bc5f7c754527f6651a93337a25a0d891f..88536fe84af5d836465880224532f75d785ef9ad 100644 (file)
@@ -241,6 +241,32 @@ free_scops (VEC (scop_p, heap) *scops)
   VEC_free (scop_p, heap, scops);
 }
 
+/* Same as outermost_loop_in_sese, returns the outermost loop
+   containing BB in REGION, but makes sure that the returned loop
+   belongs to the REGION, and so this returns the first loop in the
+   REGION when the loop containing BB does not belong to REGION.  */
+
+static loop_p
+outermost_loop_in_sese_1 (sese region, basic_block bb)
+{
+  loop_p nest = outermost_loop_in_sese (region, bb);
+
+  if (loop_in_sese_p (nest, region))
+    return nest;
+
+  /* When the basic block BB does not belong to a loop in the region,
+     return the first loop in the region.  */
+  nest = nest->inner;
+  while (nest)
+    if (loop_in_sese_p (nest, region))
+      break;
+    else
+      nest = nest->next;
+
+  gcc_assert (nest);
+  return nest;
+}
+
 /* Generates a polyhedral black box only if the bb contains interesting
    information.  */
 
@@ -248,14 +274,23 @@ static gimple_bb_p
 try_generate_gimple_bb (scop_p scop, basic_block bb)
 {
   VEC (data_reference_p, heap) *drs = VEC_alloc (data_reference_p, heap, 5);
-  loop_p nest = outermost_loop_in_sese (SCOP_REGION (scop), bb);
+  sese region = SCOP_REGION (scop);
+  loop_p nest = outermost_loop_in_sese_1 (region, bb);
   gimple_stmt_iterator gsi;
 
   for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
     {
       gimple stmt = gsi_stmt (gsi);
-      if (!is_gimple_debug (stmt))
-       graphite_find_data_references_in_stmt (nest, stmt, &drs);
+      loop_p loop;
+
+      if (is_gimple_debug (stmt))
+       continue;
+
+      loop = loop_containing_stmt (stmt);
+      if (!loop_in_sese_p (loop, region))
+       loop = nest;
+
+      graphite_find_data_references_in_stmt (nest, loop, stmt, &drs);
     }
 
   return new_gimple_bb (bb, drs);
@@ -2019,17 +2054,28 @@ analyze_drs_in_stmts (scop_p scop, basic_block bb, VEC (gimple, heap) *stmts)
   gimple_bb_p gbb;
   gimple stmt;
   int i;
+  sese region = SCOP_REGION (scop);
 
-  if (!bb_in_sese_p (bb, SCOP_REGION (scop)))
+  if (!bb_in_sese_p (bb, region))
     return;
 
-  nest = outermost_loop_in_sese (SCOP_REGION (scop), bb);
+  nest = outermost_loop_in_sese_1 (region, bb);
   gbb = gbb_from_bb (bb);
 
   FOR_EACH_VEC_ELT (gimple, stmts, i, stmt)
-    if (!is_gimple_debug (stmt))
-      graphite_find_data_references_in_stmt (nest, stmt,
+    {
+      loop_p loop;
+
+      if (is_gimple_debug (stmt))
+       continue;
+
+      loop = loop_containing_stmt (stmt);
+      if (!loop_in_sese_p (loop, region))
+       loop = nest;
+
+      graphite_find_data_references_in_stmt (nest, loop, stmt,
                                             &GBB_DATA_REFS (gbb));
+    }
 }
 
 /* Insert STMT at the end of the STMTS sequence and then insert the
index ccc00914343c998840a6fc808722d92299289759..5aecbff7fcb8271651c4320792226a8e842920e2 100644 (file)
@@ -820,13 +820,11 @@ dr_analyze_innermost (struct data_reference *dr)
 }
 
 /* Determines the base object and the list of indices of memory reference
-   DR, analyzed in loop nest NEST.  */
+   DR, analyzed in LOOP and instantiated in loop nest NEST.  */
 
 static void
-dr_analyze_indices (struct data_reference *dr, struct loop *nest)
+dr_analyze_indices (struct data_reference *dr, loop_p nest, loop_p loop)
 {
-  gimple stmt = DR_STMT (dr);
-  struct loop *loop = loop_containing_stmt (stmt);
   VEC (tree, heap) *access_fns = NULL;
   tree ref = unshare_expr (DR_REF (dr)), aref = ref, op;
   tree base, off, access_fn = NULL_TREE;
@@ -935,11 +933,13 @@ free_data_ref (data_reference_p dr)
 
 /* Analyzes memory reference MEMREF accessed in STMT.  The reference
    is read if IS_READ is true, write otherwise.  Returns the
-   data_reference description of MEMREF.  NEST is the outermost loop of the
-   loop nest in that the reference should be analyzed.  */
+   data_reference description of MEMREF.  NEST is the outermost loop
+   in which the reference should be instantiated, LOOP is the loop in
+   which the data reference should be analyzed.  */
 
 struct data_reference *
-create_data_ref (struct loop *nest, tree memref, gimple stmt, bool is_read)
+create_data_ref (loop_p nest, loop_p loop, tree memref, gimple stmt,
+                bool is_read)
 {
   struct data_reference *dr;
 
@@ -956,7 +956,7 @@ create_data_ref (struct loop *nest, tree memref, gimple stmt, bool is_read)
   DR_IS_READ (dr) = is_read;
 
   dr_analyze_innermost (dr);
-  dr_analyze_indices (dr, nest);
+  dr_analyze_indices (dr, nest, loop);
   dr_analyze_alias (dr);
 
   if (dump_file && (dump_flags & TDF_DETAILS))
@@ -4079,7 +4079,8 @@ find_data_references_in_stmt (struct loop *nest, gimple stmt,
 
   FOR_EACH_VEC_ELT (data_ref_loc, references, i, ref)
     {
-      dr = create_data_ref (nest, *ref->pos, stmt, ref->is_read);
+      dr = create_data_ref (nest, loop_containing_stmt (stmt),
+                           *ref->pos, stmt, ref->is_read);
       gcc_assert (dr != NULL);
 
       /* FIXME -- data dependence analysis does not work correctly for objects
@@ -4100,12 +4101,14 @@ find_data_references_in_stmt (struct loop *nest, gimple stmt,
   return ret;
 }
 
-/* Stores the data references in STMT to DATAREFS.  If there is an unanalyzable
-   reference, returns false, otherwise returns true.  NEST is the outermost
-   loop of the loop nest in which the references should be analyzed.  */
+/* Stores the data references in STMT to DATAREFS.  If there is an
+   unanalyzable reference, returns false, otherwise returns true.
+   NEST is the outermost loop of the loop nest in which the references
+   should be instantiated, LOOP is the loop in which the references
+   should be analyzed.  */
 
 bool
-graphite_find_data_references_in_stmt (struct loop *nest, gimple stmt,
+graphite_find_data_references_in_stmt (loop_p nest, loop_p loop, gimple stmt,
                                       VEC (data_reference_p, heap) **datarefs)
 {
   unsigned i;
@@ -4122,7 +4125,7 @@ graphite_find_data_references_in_stmt (struct loop *nest, gimple stmt,
 
   FOR_EACH_VEC_ELT (data_ref_loc, references, i, ref)
     {
-      dr = create_data_ref (nest, *ref->pos, stmt, ref->is_read);
+      dr = create_data_ref (nest, loop, *ref->pos, stmt, ref->is_read);
       gcc_assert (dr != NULL);
       VEC_safe_push (data_reference_p, heap, *datarefs, dr);
     }
index bcf8c02c4d045c25179f67ec2a6f88d59dadfcbd..2e7e0e52814e8c2510512dd7d1a510ad343679ec 100644 (file)
@@ -407,9 +407,9 @@ extern void free_data_ref (data_reference_p);
 extern void free_data_refs (VEC (data_reference_p, heap) *);
 extern bool find_data_references_in_stmt (struct loop *, gimple,
                                          VEC (data_reference_p, heap) **);
-extern bool graphite_find_data_references_in_stmt (struct loop *, gimple,
+extern bool graphite_find_data_references_in_stmt (loop_p, loop_p, gimple,
                                                   VEC (data_reference_p, heap) **);
-struct data_reference *create_data_ref (struct loop *, tree, gimple, bool);
+struct data_reference *create_data_ref (loop_p, loop_p, tree, gimple, bool);
 extern bool find_loop_nest (struct loop *, VEC (loop_p, heap) **);
 extern void compute_all_dependences (VEC (data_reference_p, heap) *,
                                     VEC (ddr_p, heap) **, VEC (loop_p, heap) *,
index 59c65d3aa2e0c2b79ee9dd60deff66d5b5d05577..d920ec6eb073436b6a6a5f303d608e60b906be2c 100644 (file)
@@ -1562,7 +1562,8 @@ determine_loop_nest_reuse (struct loop *loop, struct mem_ref_group *refs,
   for (gr = refs; gr; gr = gr->next)
     for (ref = gr->refs; ref; ref = ref->next)
       {
-       dr = create_data_ref (nest, ref->mem, ref->stmt, !ref->write_p);
+       dr = create_data_ref (nest, loop_containing_stmt (ref->stmt),
+                             ref->mem, ref->stmt, !ref->write_p);
 
        if (dr)
          {