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 tree-optimization/43901


Hi,

This patch replaces an assert that vector type exists during the analysis
with failure to vectorize, preventing the ICE in the PR.

Bootstrapped and tested on x86_64-suse-linux. I checked that there the
failure on ia64 does not occur anymore with a cross compiler.

Committed revision 159095.

Ira


ChangeLog:

      PR tree-optimization/43901
      * tree-vect-stmts.c (vectorizable_call): Assert that vector
      type is not NULL if it's transformation phase, and return
      FALSE if it's analysis.
      (vectorizable_conversion, vectorizable_operation,
      vectorizable_type_demotion, vectorizable_type_promotion):
      Likewise.


Index: tree-vect-stmts.c
===================================================================
--- tree-vect-stmts.c   (revision 159094)
+++ tree-vect-stmts.c   (working copy)
@@ -1304,6 +1304,18 @@ vectorizable_call (gimple stmt, gimple_s
      the same size as the output vector type.  */
   if (!vectype_in)
     vectype_in = get_same_sized_vectype (rhs_type, vectype_out);
+  if (vec_stmt)
+    gcc_assert (vectype_in);
+  if (!vectype_in)
+    {
+      if (vect_print_dump_info (REPORT_DETAILS))
+        {
+          fprintf (vect_dump, "no vectype for scalar type ");
+          print_generic_expr (vect_dump, rhs_type, TDF_SLIM);
+        }
+
+      return false;
+    }

   /* FORNOW */
   nunits_in = TYPE_VECTOR_SUBPARTS (vectype_in);
@@ -1606,6 +1618,18 @@ vectorizable_conversion (gimple stmt, gi
      the same size as the output vector type.  */
   if (!vectype_in)
     vectype_in = get_same_sized_vectype (rhs_type, vectype_out);
+  if (vec_stmt)
+    gcc_assert (vectype_in);
+  if (!vectype_in)
+    {
+      if (vect_print_dump_info (REPORT_DETAILS))
+        {
+          fprintf (vect_dump, "no vectype for scalar type ");
+          print_generic_expr (vect_dump, rhs_type, TDF_SLIM);
+        }
+
+      return false;
+    }

   /* FORNOW */
   nunits_in = TYPE_VECTOR_SUBPARTS (vectype_in);
@@ -1986,7 +2010,18 @@ vectorizable_operation (gimple stmt, gim
      the same size as the output vector type.  */
   if (!vectype)
     vectype = get_same_sized_vectype (TREE_TYPE (op0), vectype_out);
-  gcc_assert (vectype);
+  if (vec_stmt)
+    gcc_assert (vectype);
+  if (!vectype)
+    {
+      if (vect_print_dump_info (REPORT_DETAILS))
+        {
+          fprintf (vect_dump, "no vectype for scalar type ");
+          print_generic_expr (vect_dump, TREE_TYPE (op0), TDF_SLIM);
+        }
+
+      return false;
+    }

   nunits_out = TYPE_VECTOR_SUBPARTS (vectype_out);
   nunits_in = TYPE_VECTOR_SUBPARTS (vectype);
@@ -2449,8 +2484,18 @@ vectorizable_type_demotion (gimple stmt,
      same size as the output vector type if possible.  */
   if (!vectype_in)
     vectype_in = get_same_sized_vectype (TREE_TYPE (op0), vectype_out);
+  if (vec_stmt)
+    gcc_assert (vectype_in);
   if (!vectype_in)
-    return false;
+    {
+      if (vect_print_dump_info (REPORT_DETAILS))
+        {
+          fprintf (vect_dump, "no vectype for scalar type ");
+          print_generic_expr (vect_dump, TREE_TYPE (op0), TDF_SLIM);
+        }
+
+      return false;
+    }

   nunits_in = TYPE_VECTOR_SUBPARTS (vectype_in);
   nunits_out = TYPE_VECTOR_SUBPARTS (vectype_out);
@@ -2718,8 +2763,18 @@ vectorizable_type_promotion (gimple stmt
      the same size as the output vector type.  */
   if (!vectype_in)
     vectype_in = get_same_sized_vectype (TREE_TYPE (op0), vectype_out);
+  if (vec_stmt)
+    gcc_assert (vectype_in);
   if (!vectype_in)
-    return false;
+    {
+      if (vect_print_dump_info (REPORT_DETAILS))
+        {
+          fprintf (vect_dump, "no vectype for scalar type ");
+          print_generic_expr (vect_dump, TREE_TYPE (op0), TDF_SLIM);
+        }
+
+      return false;
+    }

   nunits_in = TYPE_VECTOR_SUBPARTS (vectype_in);
   nunits_out = TYPE_VECTOR_SUBPARTS (vectype_out);


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