Limit non-constant step prefetching only to the innermost loops.
authorChangpeng Fang <changpeng.fang@amd.com>
Wed, 9 Jun 2010 22:56:08 +0000 (22:56 +0000)
committerSebastian Pop <spop@gcc.gnu.org>
Wed, 9 Jun 2010 22:56:08 +0000 (22:56 +0000)
2010-06-09  Changpeng Fang  <changpeng.fang@amd.com>

* tree-ssa-loop-prefetch.c (gather_memory_references_ref):
Do not the gather memory reference in the outer loop if the step
is not a constant.

From-SVN: r160515

gcc/ChangeLog
gcc/tree-ssa-loop-prefetch.c

index 960d11c879508b8fc4b45ee2fa92de0ae12c6a90..2059c936c17ca4d2f1607728fbb0fab9f2697672 100644 (file)
@@ -1,3 +1,9 @@
+2010-06-09  Changpeng Fang  <changpeng.fang@amd.com>
+
+       * tree-ssa-loop-prefetch.c (gather_memory_references_ref):
+       Do not the gather memory reference in the outer loop if the step
+       is not a constant.
+
 2010-06-09  Changpeng Fang  <changpeng.fang@amd.com>
 
         * tree-ssa-loop-prefetch.c (PREFETCH_MOD_TO_UNROLL_FACTOR_RATIO) :
index 705ee81b9c80abac40a528dae840e143d6f92247..8097124bc7ffa2740e3b452ff58fa18ed91f1494 100644 (file)
@@ -513,6 +513,10 @@ gather_memory_references_ref (struct loop *loop, struct mem_ref_group **refs,
   if (step == NULL_TREE)
     return false;
 
+  /* Limit non-constant step prefetching only to the innermost loops.  */
+  if (!cst_and_fits_in_hwi (step) && loop->inner != NULL)
+    return false;
+
   /* Now we know that REF = &BASE + STEP * iter + DELTA, where DELTA and STEP
      are integer constants.  */
   agrp = find_or_create_group (refs, base, step);