This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] fix PR/32224 - fix ICE in vectorizer due to missing check


As Andrew Pinsky noticed, this patch by me:
http://gcc.gnu.org/ml/gcc-patches/2007-01/msg00004.html skips stmts that
are not a GIMPLE_MODIFY_STMT, and lets the analysis continue, instead of
failing vectorization. This causes an ICE later on when the stmt is an asm
stmt.

Bootstrapped with vectorization enabled on i386-linux, and tested on the
vectorizer testcases.
Committed as obvious.

Thanks to Andrew Pinsky for the problem analysis.

dorit

        PR tree-optimization/32224
        * tree-vect-analyze.c (vect_determine_vectorization_factor): Fail
        vectorization upon a non GIMPLE_MODIFY_STMT.

        PR tree-optimization/32224
        * gcc.dg/vect/pr32224.c: New test.

Index: testsuite/gcc.dg/vect/pr32224.c
===================================================================
*** testsuite/gcc.dg/vect/pr32224.c     (revision 0)
--- testsuite/gcc.dg/vect/pr32224.c     (revision 0)
***************
*** 0 ****
--- 1,17 ----
+ /* { dg-do compile } */
+ typedef unsigned long int *mp_ptr;
+ typedef const unsigned long int *mp_srcptr;
+ gmpz_export (void *data)
+ {
+   mp_srcptr zp;
+   int count, i;
+   mp_ptr __dst = ((mp_ptr) data);
+   mp_srcptr __src = (zp);
+
+   for (i = 0; i < count; i++)
+   {
+     __asm__ ("bswap %q0": "=r" (*__dst):"0" (*(__src)));
+     __src++;
+   }
+ }
+ /* { dg-final { cleanup-tree-dump "vect" } } */
Index: tree-vect-analyze.c
===================================================================
*** tree-vect-analyze.c (revision 125526)
--- tree-vect-analyze.c (working copy)
*************** vect_determine_vectorization_factor (loo
*** 173,181 ****
              print_generic_expr (vect_dump, stmt, TDF_SLIM);
            }

-         if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
-           continue;
-
          gcc_assert (stmt_info);

          /* skip stmts which do not need to be vectorized.  */
--- 173,178 ----
*************** vect_determine_vectorization_factor (loo
*** 187,192 ****
--- 184,199 ----
              continue;
            }

+         if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
+           {
+             if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
+               {
+                 fprintf (vect_dump, "not vectorized: irregular stmt.");
+                 print_generic_expr (vect_dump, stmt, TDF_SLIM);
+               }
+             return false;
+           }
+
          if (!GIMPLE_STMT_P (stmt)
              && VECTOR_MODE_P (TYPE_MODE (TREE_TYPE (stmt))))
            {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]