]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/37385 (ICE in set_mem_alias_set with the vectorizer and function...
authorRichard Guenther <rguenther@suse.de>
Wed, 17 Sep 2008 11:42:11 +0000 (11:42 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 17 Sep 2008 11:42:11 +0000 (11:42 +0000)
2008-09-17  Richard Guenther  <rguenther@suse.de>

PR middle-end/37385
PR tree-optimization/37491
* alias.c (get_alias_set): Use the canonical type.
* tree-vect-transform.c (vectorizable_store): Use the type of
the lhs for the vector type.  Adjust checking.
(vectorizable_load): Adjust checking.

From-SVN: r140412

gcc/ChangeLog
gcc/alias.c
gcc/tree-vect-transform.c

index e6238c23a97ce4c8853c133884c840b1583aeabf..fcabf719d142b0411f0d33133a5f7bc606897c0f 100644 (file)
@@ -1,3 +1,12 @@
+2008-09-17  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/37385
+       PR tree-optimization/37491
+       * alias.c (get_alias_set): Use the canonical type.
+       * tree-vect-transform.c (vectorizable_store): Use the type of
+       the lhs for the vector type.  Adjust checking.
+       (vectorizable_load): Adjust checking.
+
 2008-09-16  Jakub Jelinek  <jakub@redhat.com>
            Adam Nemet  <anemet@caviumnetworks.com>
 
index 56660ec38d9bd5c61f8797bf856fdfa5f54e8412..35a40bc99a882754d2d06be2359ba7c67ce8598a 100644 (file)
@@ -604,8 +604,11 @@ get_alias_set (tree t)
     }
 
   /* Variant qualifiers don't affect the alias set, so get the main
-     variant. If this is a type with a known alias set, return it.  */
+     variant.  Always use the canonical type as well.
+     If this is a type with a known alias set, return it.  */
   t = TYPE_MAIN_VARIANT (t);
+  if (TYPE_CANONICAL (t))
+    t = TYPE_CANONICAL (t);
   if (TYPE_ALIAS_SET_KNOWN_P (t))
     return TYPE_ALIAS_SET (t);
 
index d69ce51814b7fe3f80e82490e189e939b29a342a..06d6791e63913420d228882067d75ead258f3c57 100644 (file)
@@ -5182,24 +5182,23 @@ vectorizable_store (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
       return false;
     }
 
-  /* The type of the vector store is determined by the rhs.  */
-  vectype = get_vectype_for_scalar_type (TREE_TYPE (op));
-
   /* If accesses through a pointer to vectype do not alias the original
-     memory reference we have a problem.  */
-  if (get_alias_set (vectype) != get_alias_set (TREE_TYPE (scalar_dest))
+     memory reference we have a problem.  This should never be the case.  */
+  if (get_alias_set (vectype) != get_alias_set (scalar_dest)
       && !alias_set_subset_of (get_alias_set (vectype), 
-                               get_alias_set (TREE_TYPE (scalar_dest))))
+                               get_alias_set (scalar_dest)))
     {
       if (vect_print_dump_info (REPORT_DETAILS))
-        fprintf (vect_dump, "vector type does not alias scalar type");
+        fprintf (vect_dump, "???  vector type does not alias scalar type");
       return false;
     }
 
-  if (!useless_type_conversion_p (TREE_TYPE (op), TREE_TYPE (scalar_dest)))
+  /* The scalar rhs type needs to be trivially convertible to the vector
+     component type.  This should always be the case.  */
+  if (!useless_type_conversion_p (TREE_TYPE (vectype), TREE_TYPE (op)))
     {      
       if (vect_print_dump_info (REPORT_DETAILS))
-        fprintf (vect_dump, "operands of different types");
+        fprintf (vect_dump, "???  operands of different types");
       return false;
     }
 
@@ -5367,8 +5366,8 @@ vectorizable_store (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
                     Therefore, NEXT_STMT can't be NULL_TREE.  In case that 
                     there is no interleaving, GROUP_SIZE is 1, and only one 
                     iteration of the loop will be executed.  */
-                 gcc_assert (next_stmt);
-                 gcc_assert (gimple_assign_single_p (next_stmt));
+                 gcc_assert (next_stmt
+                             && gimple_assign_single_p (next_stmt));
                  op = gimple_assign_rhs1 (next_stmt);
 
                  vec_oprnd = vect_get_vec_def_for_operand (op, next_stmt, 
@@ -5379,9 +5378,12 @@ vectorizable_store (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
                }
            }
 
+         /* We should have catched mismatched types earlier.  */
+         gcc_assert (useless_type_conversion_p (vectype,
+                                                TREE_TYPE (vec_oprnd)));
          dataref_ptr = vect_create_data_ref_ptr (first_stmt, NULL, NULL_TREE, 
                                                  &dummy, &ptr_incr, false, 
-                                                 &inv_p, TREE_TYPE (vec_oprnd));
+                                                 &inv_p, NULL);
          gcc_assert (!inv_p);
        }
       else 
@@ -6384,13 +6386,22 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
     }
 
   /* If accesses through a pointer to vectype do not alias the original
-     memory reference we have a problem.  */
-  if (get_alias_set (vectype) != get_alias_set (scalar_type)
+     memory reference we have a problem.  This should never happen.  */
+  if (get_alias_set (vectype) != get_alias_set (gimple_assign_rhs1 (stmt))
       && !alias_set_subset_of (get_alias_set (vectype),
-                               get_alias_set (scalar_type)))
+                               get_alias_set (gimple_assign_rhs1 (stmt))))
     {
       if (vect_print_dump_info (REPORT_DETAILS))
-        fprintf (vect_dump, "vector type does not alias scalar type");
+        fprintf (vect_dump, "???  vector type does not alias scalar type");
+      return false;
+    }
+
+  /* The vector component type needs to be trivially convertible to the
+     scalar lhs.  This should always be the case.  */
+  if (!useless_type_conversion_p (TREE_TYPE (scalar_dest), TREE_TYPE (vectype)))
+    {      
+      if (vect_print_dump_info (REPORT_DETAILS))
+        fprintf (vect_dump, "???  operands of different types");
       return false;
     }