[36/46] Add a pattern_stmt_p field to stmt_vec_info
authorRichard Sandiford <richard.sandiford@arm.com>
Tue, 31 Jul 2018 14:25:47 +0000 (14:25 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Tue, 31 Jul 2018 14:25:47 +0000 (14:25 +0000)
This patch adds a pattern_stmt_p field to stmt_vec_info, so that it's
possible to tell whether the statement is a pattern statement without
referring to other statements.  The new field goes in what was
previously a hole in the structure, so the size is the same as before.

2018-07-31  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* tree-vectorizer.h (_stmt_vec_info::pattern_stmt_p): New field.
(is_pattern_stmt_p): Use it.
* tree-vect-patterns.c (vect_init_pattern_stmt): Set pattern_stmt_p
on pattern statements.

From-SVN: r263151

gcc/ChangeLog
gcc/tree-vect-patterns.c
gcc/tree-vectorizer.h

index ebe33a136072e4bd40e7c896d2cbca087a8afbd4..22ddb54eee6171a769d2de8fd2013096dd86d3a5 100644 (file)
@@ -1,3 +1,10 @@
+2018-07-31  Richard Sandiford  <richard.sandiford@arm.com>
+
+       * tree-vectorizer.h (_stmt_vec_info::pattern_stmt_p): New field.
+       (is_pattern_stmt_p): Use it.
+       * tree-vect-patterns.c (vect_init_pattern_stmt): Set pattern_stmt_p
+       on pattern statements.
+
 2018-07-31  Richard Sandiford  <richard.sandiford@arm.com>
 
        * tree-vect-patterns.c (vect_mark_pattern_stmts): Take the
index 0f710e5b23ca7403afd01e7f37fd7d5f584dd8bc..18619d18c0f6aecbda3898dca2de808802e1f98b 100644 (file)
@@ -108,6 +108,7 @@ vect_init_pattern_stmt (gimple *pattern_stmt, stmt_vec_info orig_stmt_info,
     pattern_stmt_info = orig_stmt_info->vinfo->add_stmt (pattern_stmt);
   gimple_set_bb (pattern_stmt, gimple_bb (orig_stmt_info->stmt));
 
+  pattern_stmt_info->pattern_stmt_p = true;
   STMT_VINFO_RELATED_STMT (pattern_stmt_info) = orig_stmt_info;
   STMT_VINFO_DEF_TYPE (pattern_stmt_info)
     = STMT_VINFO_DEF_TYPE (orig_stmt_info);
index 37f8b87e110daf8b2d9fd921bec74a3142888ccb..74ea6cf9b0d37e18823738d73e550020905a5f02 100644 (file)
@@ -791,6 +791,12 @@ struct _stmt_vec_info {
   /* Stmt is part of some pattern (computation idiom)  */
   bool in_pattern_p;
 
+  /* True if the statement was created during pattern recognition as
+     part of the replacement for RELATED_STMT.  This implies that the
+     statement isn't part of any basic block, although for convenience
+     its gimple_bb is the same as for RELATED_STMT.  */
+  bool pattern_stmt_p;
+
   /* Is this statement vectorizable or should it be skipped in (partial)
      vectorization.  */
   bool vectorizable;
@@ -1157,8 +1163,7 @@ get_later_stmt (stmt_vec_info stmt1_info, stmt_vec_info stmt2_info)
 static inline bool
 is_pattern_stmt_p (stmt_vec_info stmt_info)
 {
-  stmt_vec_info related_stmt_info = STMT_VINFO_RELATED_STMT (stmt_info);
-  return related_stmt_info && STMT_VINFO_IN_PATTERN_P (related_stmt_info);
+  return stmt_info->pattern_stmt_p;
 }
 
 /* Return true if BB is a loop header.  */