------- Comment #1 from irar at il dot ibm dot com  2009-04-08 11:17 -------
A testcase for 4.5:

#define N 128

int out[N*4], out2[N], in[N*4];

void
foo ()
{
  int i, a0, a1, a2, a3;

  for (i = 0; i < N; i++)
    {
      a0 = in[i*4];
      a1 = in[i*4 + 1];
      a2 = in[i*4 + 2];
      a3 = in[i*4 + 3];

      out[i*4] = a0;
      out[i*4 + 1] = a1;
      out[i*4 + 2] = a2;
      out[i*4 + 3] = a3;

      out2[i] = a0;
    }
}

Fails with
internal compiler error: in vect_get_vec_def_for_operand, at
tree-vect-stmts.c:940
(on powerpc64-suse-linux with -O3 -maltivec)

The bug is in decision whether a statement must be "loop-vectorized" in a
addition to SLP. Here is a patch (for 4.4) that I am testing:

Index: tree-vect-transform.c
===================================================================
--- tree-vect-transform.c       (revision 145711)
+++ tree-vect-transform.c       (working copy)
@@ -8459,20 +8459,11 @@
                  if (vect_print_dump_info (REPORT_DETAILS))
                    fprintf (vect_dump, "=== scheduling SLP instances ===");

-                 is_store = vect_schedule_slp (loop_vinfo);
-
-                 /* IS_STORE is true if STMT is a store. Stores cannot be of
-                    hybrid SLP type. They are removed in
-                    vect_schedule_slp_instance and their vinfo is destroyed.
*/
-                 if (is_store)
-                   {
-                     gsi_next (&si);
-                     continue;
-                   }
-               }
+                 vect_schedule_slp (loop_vinfo);
+                }

              /* Hybrid SLP stmts must be vectorized in addition to SLP.  */
-             if (PURE_SLP_STMT (stmt_info))
+             if (!vinfo_for_stmt (stmt) || PURE_SLP_STMT (stmt_info))
                {
                  gsi_next (&si);
                  continue;


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39675

Reply via email to