Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk
and branch.

Richard.

2012-10-19  Richard Biener  <rguent...@suse.de>

        PR tree-optimization/54976
        * tree-vect-stmts.c (get_vectype_for_scalar_type_and_size):
        Robustify against odd inner_mode inputs.

Index: gcc/tree-vect-stmts.c
===================================================================
*** gcc/tree-vect-stmts.c       (revision 192605)
--- gcc/tree-vect-stmts.c       (working copy)
*************** get_vectype_for_scalar_type_and_size (tr
*** 6082,6097 ****
       When the component mode passes the above test simply use a type
       corresponding to that mode.  The theory is that any use that
       would cause problems with this will disable vectorization anyway.  */
!   if (!SCALAR_FLOAT_TYPE_P (scalar_type)
!       && !INTEGRAL_TYPE_P (scalar_type)
!       && !POINTER_TYPE_P (scalar_type))
      scalar_type = lang_hooks.types.type_for_mode (inner_mode, 1);
  
    /* We can't build a vector type of elements with alignment bigger than
       their size.  */
!   if (nbytes < TYPE_ALIGN_UNIT (scalar_type))
      scalar_type = lang_hooks.types.type_for_mode (inner_mode, 1);
  
    /* If no size was supplied use the mode the target prefers.   Otherwise
       lookup a vector mode of the specified size.  */
    if (size == 0)
--- 6082,6102 ----
       When the component mode passes the above test simply use a type
       corresponding to that mode.  The theory is that any use that
       would cause problems with this will disable vectorization anyway.  */
!   else if (!SCALAR_FLOAT_TYPE_P (scalar_type)
!          && !INTEGRAL_TYPE_P (scalar_type)
!          && !POINTER_TYPE_P (scalar_type))
      scalar_type = lang_hooks.types.type_for_mode (inner_mode, 1);
  
    /* We can't build a vector type of elements with alignment bigger than
       their size.  */
!   else if (nbytes < TYPE_ALIGN_UNIT (scalar_type))
      scalar_type = lang_hooks.types.type_for_mode (inner_mode, 1);
  
+   /* If we felt back to using the mode fail if there was
+      no scalar type for it.  */
+   if (scalar_type == NULL_TREE)
+     return NULL_TREE;
+ 
    /* If no size was supplied use the mode the target prefers.   Otherwise
       lookup a vector mode of the specified size.  */
    if (size == 0)

Reply via email to