[patch] Fix the vectorization part of PR tree-optimization/32377

Ira Rosen IRAR@il.ibm.com
Wed Sep 12 09:12:00 GMT 2007


With Sebastian's patch
http://gcc.gnu.org/ml/gcc-patches/2007-07/msg00330.html we are now able to
distinguish between positive and negative dependence distance.

In this loop the distance is 1 (positive) and the loop is not vectorizable:

  for (i = 0; i < N; i++){
    ia[i+1] = ia[i] * 4;
  }

Here the dependence distance is negative (-1) and the loop is vectorizable:

  for (i = 0; i < N; i++){
    ia[i] = ia[i+1] * 4;
  }

This patch takes the value of DDR_REVERSED_P into account to decide whether
the distance is negative or positive.

This patch still doesn't make the loop in the PR to get vectorized due to
another problem:
the analysis now fails with "affine-affine test failed: missing iteration
counts". (See PR 32377 for more details).

Testcases are attached.
Bootstrapped with vectorization enabled and regtested on x86_64-linux.
O.K. for mainline?

Thanks,
Ira

ChangeLog entry:

      * tree-vect-analyze.c (vect_analyze_data_ref_dependence): Distinguish
      between positive and negative dependence distance using
DDR_REVERSED_P.

Index: tree-vect-analyze.c
===================================================================
--- tree-vect-analyze.c (revision 128412)
+++ tree-vect-analyze.c (working copy)
@@ -1211,12 +1211,15 @@ vect_analyze_data_ref_dependence (struct
           continue;
        }

-      if (abs (dist) >= vectorization_factor)
+      if (abs (dist) >= vectorization_factor
+          || (dist > 0 && DDR_REVERSED_P (ddr)))
        {
-         /* Dependence distance does not create dependence, as far as
vectorization
-            is concerned, in this case.  */
+         /* Dependence distance does not create dependence, as far as
+            vectorization is concerned, in this case. If DDR_REVERSED_P
the
+            order of the data-refs in DDR was reversed (to make distance
+            vector positive), and the actual distance is negative.  */
          if (vect_print_dump_info (REPORT_DR_DETAILS))
-           fprintf (vect_dump, "dependence distance >= VF.");
+           fprintf (vect_dump, "dependence distance >= VF or negative.");
          continue;
        }

(See attached file: tests-pr32377.txt)

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: tests-pr32377.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070912/c85c417a/attachment.txt>


More information about the Gcc-patches mailing list