OSDN Git Service

* tree-vectorizer.h (struct _stmt_vec_info): Add new field to
authorirar <irar@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 26 Apr 2010 06:39:27 +0000 (06:39 +0000)
committerMasaki Muranaka <monaka@monami-software.com>
Sun, 23 May 2010 04:49:03 +0000 (13:49 +0900)
determine if the statement is vectorizable, and a macro to
access it.
* tree-vect-data-refs.c (vect_analyze_data_ref_dependence):
Skip statements that can't be vectorized. If the analysis
fails, mark the statement as unvectorizable if vectorizing
basic block.
(vect_compute_data_refs_alignment): Likewise.
(vect_verify_datarefs_alignment): Skip statements marked as
unvectorizable. Add print.
(vect_analyze_group_access): Skip statements that can't be
vectorized. If the analysis fails, mark the statement as
unvectorizable if vectorizing basic block.
(vect_analyze_data_ref_accesses, vect_analyze_data_refs):
Likewise.
* tree-vect-stmts.c (vectorizable_store): Fix the number of
generated stmts for SLP.
(new_stmt_vec_info): Initialize the new field.
* tree-vect-slp.c (vect_build_slp_tree): Fail to vectorize
statements marked as unvectorizable.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158719 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/tree-vect-slp.c
gcc/tree-vect-stmts.c
gcc/tree-vectorizer.h

index a6fd13b..3b4ed3c 100644 (file)
@@ -1,3 +1,26 @@
+2010-04-26  Ira Rosen  <irar@il.ibm.com>
+
+       * tree-vectorizer.h (struct _stmt_vec_info): Add new field to 
+       determine if the statement is vectorizable, and a macro to 
+       access it.
+       * tree-vect-data-refs.c (vect_analyze_data_ref_dependence): 
+       Skip statements that can't be vectorized. If the analysis 
+       fails, mark the statement as unvectorizable if vectorizing 
+       basic block.
+       (vect_compute_data_refs_alignment): Likewise.
+       (vect_verify_datarefs_alignment): Skip statements marked as 
+       unvectorizable. Add print.
+       (vect_analyze_group_access): Skip statements that can't be 
+       vectorized. If the analysis fails, mark the statement as 
+       unvectorizable if vectorizing basic block.
+       (vect_analyze_data_ref_accesses, vect_analyze_data_refs): 
+       Likewise.
+       * tree-vect-stmts.c (vectorizable_store): Fix the number of 
+       generated stmts for SLP.
+       (new_stmt_vec_info): Initialize the new field.
+       * tree-vect-slp.c (vect_build_slp_tree): Fail to vectorize 
+       statements marked as unvectorizable.
+
 2010-04-25  Joseph Myers  <joseph@codesourcery.com>
 
        * c-common.c (flag_isoc1x): New.
index add87e8..badf910 100644 (file)
@@ -1,3 +1,7 @@
+2010-04-26  Ira Rosen  <irar@il.ibm.com>
+
+       * gcc.dg/vect/bb-slp-23.c: New test.
+
 2010-04-25  Joseph Myers  <joseph@codesourcery.com>
 
        * gcc.dg/c90-float-1.c: Also test that C1X macros are not defined.
index 6949ebd..f313294 100644 (file)
@@ -344,6 +344,19 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
          print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
        }
 
+      /* Fail to vectorize statements marked as unvectorizable.  */
+      if (!STMT_VINFO_VECTORIZABLE (vinfo_for_stmt (stmt)))
+        {
+          if (vect_print_dump_info (REPORT_SLP))
+            {
+              fprintf (vect_dump,
+                       "Build SLP failed: unvectorizable statement ");
+              print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
+            }
+
+          return false;
+        }
+
       lhs = gimple_get_lhs (stmt);
       if (lhs == NULL_TREE)
        {
index 988749b..0dabb6a 100644 (file)
@@ -3031,12 +3031,17 @@ vectorizable_store (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
        }
 
       if (slp)
-       strided_store = false;
-
-      /* VEC_NUM is the number of vect stmts to be created for this group.  */
-      if (slp)
-       vec_num = SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node);
+        {
+          strided_store = false;
+          /* VEC_NUM is the number of vect stmts to be created for this 
+             group.  */
+          vec_num = SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node);
+          first_stmt = VEC_index (gimple, SLP_TREE_SCALAR_STMTS (slp_node), 0); 
+          first_dr = STMT_VINFO_DATA_REF (vinfo_for_stmt (first_stmt));
+        } 
       else
+        /* VEC_NUM is the number of vect stmts to be created for this 
+           group.  */
        vec_num = group_size;
     }
   else
@@ -4327,6 +4332,7 @@ new_stmt_vec_info (gimple stmt, loop_vec_info loop_vinfo,
   STMT_VINFO_LIVE_P (res) = false;
   STMT_VINFO_VECTYPE (res) = NULL;
   STMT_VINFO_VEC_STMT (res) = NULL;
+  STMT_VINFO_VECTORIZABLE (res) = true;
   STMT_VINFO_IN_PATTERN_P (res) = false;
   STMT_VINFO_RELATED_STMT (res) = NULL;
   STMT_VINFO_DATA_REF (res) = NULL;
index bd43a4b..c80c345 100644 (file)
@@ -489,6 +489,10 @@ typedef struct _stmt_vec_info {
 
   /* The bb_vec_info with respect to which STMT is vectorized.  */
   bb_vec_info bb_vinfo;
+
+  /* Is this statement vectorizable or should it be skipped in (partial)
+     vectorization.  */
+  bool vectorizable;
 } *stmt_vec_info;
 
 /* Access Functions.  */
@@ -500,6 +504,7 @@ typedef struct _stmt_vec_info {
 #define STMT_VINFO_LIVE_P(S)               (S)->live
 #define STMT_VINFO_VECTYPE(S)              (S)->vectype
 #define STMT_VINFO_VEC_STMT(S)             (S)->vectorized_stmt
+#define STMT_VINFO_VECTORIZABLE(S)         (S)->vectorizable
 #define STMT_VINFO_DATA_REF(S)             (S)->data_ref_info
 
 #define STMT_VINFO_DR_BASE_ADDRESS(S)      (S)->dr_base_address