With the work-around-limited-IL patch I put in earlier we now need
to cope with dt_external stmts (in self-referencing SLPs).  Thus
keep the def-type check to the analysis phase (larger refactoring
to split analysis and transform phase more properly is not appropriate
at this stage).

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

Richard.

2016-01-12  Richard Biener  <rguent...@suse.de>

        PR tree-optimization/69157
        * tree-vect-stmts.c (vectorizable_mask_load_store): Check
        stmts def type only during analyze phase.
        (vectorizable_call): Likewise.
        (vectorizable_simd_clone_call): Likewise.
        (vectorizable_conversion): Likewise.
        (vectorizable_assignment): Likewise.
        (vectorizable_shift): Likewise.
        (vectorizable_operation): Likewise.
        (vectorizable_store): Likewise.
        (vectorizable_load): Likewise.

        * gcc.dg/torture/pr69157.c: New testcase.

Index: gcc/tree-vect-stmts.c
===================================================================
*** gcc/tree-vect-stmts.c       (revision 232213)
--- gcc/tree-vect-stmts.c       (working copy)
*************** vectorizable_mask_load_store (gimple *st
*** 1757,1763 ****
    if (!STMT_VINFO_RELEVANT_P (stmt_info))
      return false;
  
!   if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_internal_def)
      return false;
  
    if (!STMT_VINFO_DATA_REF (stmt_info))
--- 1760,1767 ----
    if (!STMT_VINFO_RELEVANT_P (stmt_info))
      return false;
  
!   if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_internal_def
!       && ! vec_stmt)
      return false;
  
    if (!STMT_VINFO_DATA_REF (stmt_info))
*************** vectorizable_call (gimple *gs, gimple_st
*** 2206,2212 ****
    if (!STMT_VINFO_RELEVANT_P (stmt_info) && !bb_vinfo)
      return false;
  
!   if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_internal_def)
      return false;
  
    /* Is GS a vectorizable call?   */
--- 2210,2217 ----
    if (!STMT_VINFO_RELEVANT_P (stmt_info) && !bb_vinfo)
      return false;
  
!   if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_internal_def
!       && ! vec_stmt)
      return false;
  
    /* Is GS a vectorizable call?   */
*************** vectorizable_simd_clone_call (gimple *st
*** 2811,2817 ****
    if (!STMT_VINFO_RELEVANT_P (stmt_info) && !bb_vinfo)
      return false;
  
!   if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_internal_def)
      return false;
  
    if (gimple_call_lhs (stmt)
--- 2816,2823 ----
    if (!STMT_VINFO_RELEVANT_P (stmt_info) && !bb_vinfo)
      return false;
  
!   if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_internal_def
!       && ! vec_stmt)
      return false;
  
    if (gimple_call_lhs (stmt)
*************** vectorizable_conversion (gimple *stmt, g
*** 3669,3675 ****
    if (!STMT_VINFO_RELEVANT_P (stmt_info) && !bb_vinfo)
      return false;
  
!   if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_internal_def)
      return false;
  
    if (!is_gimple_assign (stmt))
--- 3675,3682 ----
    if (!STMT_VINFO_RELEVANT_P (stmt_info) && !bb_vinfo)
      return false;
  
!   if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_internal_def
!       && ! vec_stmt)
      return false;
  
    if (!is_gimple_assign (stmt))
*************** vectorizable_assignment (gimple *stmt, g
*** 4246,4252 ****
    if (!STMT_VINFO_RELEVANT_P (stmt_info) && !bb_vinfo)
      return false;
  
!   if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_internal_def)
      return false;
  
    /* Is vectorizable assignment?  */
--- 4253,4260 ----
    if (!STMT_VINFO_RELEVANT_P (stmt_info) && !bb_vinfo)
      return false;
  
!   if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_internal_def
!       && ! vec_stmt)
      return false;
  
    /* Is vectorizable assignment?  */
*************** vectorizable_shift (gimple *stmt, gimple
*** 4462,4468 ****
    if (!STMT_VINFO_RELEVANT_P (stmt_info) && !bb_vinfo)
      return false;
  
!   if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_internal_def)
      return false;
  
    /* Is STMT a vectorizable binary/unary operation?   */
--- 4470,4477 ----
    if (!STMT_VINFO_RELEVANT_P (stmt_info) && !bb_vinfo)
      return false;
  
!   if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_internal_def
!       && ! vec_stmt)
      return false;
  
    /* Is STMT a vectorizable binary/unary operation?   */
*************** vectorizable_operation (gimple *stmt, gi
*** 4823,4829 ****
    if (!STMT_VINFO_RELEVANT_P (stmt_info) && !bb_vinfo)
      return false;
  
!   if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_internal_def)
      return false;
  
    /* Is STMT a vectorizable binary/unary operation?   */
--- 4832,4839 ----
    if (!STMT_VINFO_RELEVANT_P (stmt_info) && !bb_vinfo)
      return false;
  
!   if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_internal_def
!       && ! vec_stmt)
      return false;
  
    /* Is STMT a vectorizable binary/unary operation?   */
*************** vectorizable_store (gimple *stmt, gimple
*** 5248,5254 ****
    if (!STMT_VINFO_RELEVANT_P (stmt_info) && !bb_vinfo)
      return false;
  
!   if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_internal_def)
      return false;
  
    /* Is vectorizable store? */
--- 5258,5265 ----
    if (!STMT_VINFO_RELEVANT_P (stmt_info) && !bb_vinfo)
      return false;
  
!   if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_internal_def
!       && ! vec_stmt)
      return false;
  
    /* Is vectorizable store? */
*************** vectorizable_load (gimple *stmt, gimple_
*** 6237,6243 ****
    if (!STMT_VINFO_RELEVANT_P (stmt_info) && !bb_vinfo)
      return false;
  
!   if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_internal_def)
      return false;
  
    /* Is vectorizable load? */
--- 6248,6255 ----
    if (!STMT_VINFO_RELEVANT_P (stmt_info) && !bb_vinfo)
      return false;
  
!   if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_internal_def
!       && ! vec_stmt)
      return false;
  
    /* Is vectorizable load? */
Index: gcc/testsuite/gcc.dg/torture/pr69157.c
===================================================================
*** gcc/testsuite/gcc.dg/torture/pr69157.c      (revision 0)
--- gcc/testsuite/gcc.dg/torture/pr69157.c      (working copy)
***************
*** 0 ****
--- 1,17 ----
+ /* { dg-do compile } */
+ 
+ typedef struct {
+     float *data_normal3f;
+     float *data_texcoordtexture2f;
+     float *data_texcoordlightmap2f;
+     float *data_color4f;
+ } dp_model_t;
+ dp_model_t a;
+ float *b;
+ void fn1() {
+     int c;
+     a.data_normal3f = b + c * 3;
+     a.data_texcoordtexture2f = a.data_normal3f + c * 3;
+     a.data_texcoordlightmap2f = a.data_color4f =
+       a.data_texcoordlightmap2f + c * 2;
+ }

Reply via email to