diff mbox

[vectorizer] Fixes of the realignment improvements patch

Message ID OFF7B2C771.026112DE-ONC2257757.0029149A-C2257757.003AD67B@il.ibm.com
State New
Headers show

Commit Message

Ira Rosen July 5, 2010, 10:42 a.m. UTC
Hi,

This patch makes a couple of fixes of the realignment improvements patch:
it restores a check of irrelevant statements in scalar loop cost
calculation, and fixes a typo (an address was updated instead of a value).

With these two bugs fixed, the loop bound in
costmodel-fast-math-vect-pr29925.c for x86_64 and i386 needs to be
increased in order to vectorize the loop.

Bootstrapped and tested on x86_64-suse-linux.

Committed revision 161827.

Ira

ChangeLog:

      * tree-vect-loop.c (vect_get_single_scalar_iteraion_cost): Skip
      statements that are not vectorized.
      * tree-vect-stmts.c (vect_get_load_cost): Update the value stored
      in INSIDE_COST.

testsuite/ChangeLog:

      * gcc.dg/vect/costmodel/i386/costmodel-fast-math-vect-pr29925.c
      Increase loop bound and array size.
      * gcc.dg/vect/costmodel/x86_64/costmodel-fast-math-vect-pr29925.c:
      Likewise.


Index:
testsuite/gcc.dg/vect/costmodel/i386/costmodel-fast-math-vect-pr29925.c
===================================================================
--- testsuite/gcc.dg/vect/costmodel/i386/costmodel-fast-math-vect-pr29925.c
(revision 161819)
+++ testsuite/gcc.dg/vect/costmodel/i386/costmodel-fast-math-vect-pr29925.c
(working copy)
@@ -13,7 +13,7 @@ interp_pitch(float *exc, float *interp,
    for (i=0;i<len;i++)
    {
       float tmp = 0;
-      for (k=0;k<7;k++)
+      for (k=0;k<12;k++)
       {
          tmp += exc[i-pitch+k+maxj-6];
       }
@@ -23,7 +23,7 @@ interp_pitch(float *exc, float *interp,

 int main()
 {
-   float *exc = calloc(126,sizeof(float));
+   float *exc = calloc(136,sizeof(float));
    float *interp = calloc(80,sizeof(float));
    int pitch = -35;

Index:
testsuite/gcc.dg/vect/costmodel/x86_64/costmodel-fast-math-vect-pr29925.c
diff mbox

Patch

===================================================================
---
testsuite/gcc.dg/vect/costmodel/x86_64/costmodel-fast-math-vect-pr29925.c
(revision 161819)
+++
testsuite/gcc.dg/vect/costmodel/x86_64/costmodel-fast-math-vect-pr29925.c
(working copy)
@@ -13,7 +13,7 @@  interp_pitch(float *exc, float *interp,
    for (i=0;i<len;i++)
    {
       float tmp = 0;
-      for (k=0;k<7;k++)
+      for (k=0;k<12;k++)
       {
          tmp += exc[i-pitch+k+maxj-6];
       }
Index: tree-vect-loop.c
===================================================================
--- tree-vect-loop.c    (revision 161819)
+++ tree-vect-loop.c    (working copy)
@@ -2046,10 +2046,18 @@  vect_get_single_scalar_iteraion_cost (lo
       for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
         {
           gimple stmt = gsi_stmt (si);
+          stmt_vec_info stmt_info = vinfo_for_stmt (stmt);

           if (!is_gimple_assign (stmt) && !is_gimple_call (stmt))
             continue;

+          /* Skip stmts that are not vectorized inside the loop.  */
+          if (stmt_info
+              && !STMT_VINFO_RELEVANT_P (stmt_info)
+              && (!STMT_VINFO_LIVE_P (stmt_info)
+                  || STMT_VINFO_DEF_TYPE (stmt_info) !=
vect_reduction_def))
+            continue;
+
           if (STMT_VINFO_DATA_REF (vinfo_for_stmt (stmt)))
             {
               if (DR_IS_READ (STMT_VINFO_DATA_REF (vinfo_for_stmt
(stmt))))
Index: tree-vect-stmts.c
===================================================================
--- tree-vect-stmts.c   (revision 161819)
+++ tree-vect-stmts.c   (working copy)
@@ -826,7 +826,7 @@  vect_get_load_cost (struct data_referenc
     {
     case dr_aligned:
       {
-        inside_cost += ncopies * vect_get_stmt_cost (vector_load);
+        *inside_cost += ncopies * vect_get_stmt_cost (vector_load);

         if (vect_print_dump_info (REPORT_COST))
           fprintf (vect_dump, "vect_model_load_cost: aligned.");