[30/46] Use stmt_vec_infos rather than gimple stmts for worklists

Message ID 87bmaxne4f.fsf@arm.com
State New
Headers show
Series
  • Remove vinfo_for_stmt etc.
Related show

Commit Message

Richard Sandiford July 24, 2018, 10:04 a.m.
2018-07-24  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* tree-vect-loop.c (vect_analyze_scalar_cycles_1): Change the type
	of the worklist from a vector of gimple stmts to a vector of
	stmt_vec_infos.
	* tree-vect-stmts.c (vect_mark_relevant, process_use)
	(vect_mark_stmts_to_be_vectorized): Likewise

Comments

Richard Biener July 25, 2018, 10:04 a.m. | #1
On Tue, Jul 24, 2018 at 12:05 PM Richard Sandiford
<richard.sandiford@arm.com> wrote:
>

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

>

> gcc/

>         * tree-vect-loop.c (vect_analyze_scalar_cycles_1): Change the type

>         of the worklist from a vector of gimple stmts to a vector of

>         stmt_vec_infos.

>         * tree-vect-stmts.c (vect_mark_relevant, process_use)

>         (vect_mark_stmts_to_be_vectorized): Likewise


OK

> Index: gcc/tree-vect-loop.c

> ===================================================================

> --- gcc/tree-vect-loop.c        2018-07-24 10:23:38.964700191 +0100

> +++ gcc/tree-vect-loop.c        2018-07-24 10:23:42.472669038 +0100

> @@ -474,7 +474,7 @@ vect_analyze_scalar_cycles_1 (loop_vec_i

>  {

>    basic_block bb = loop->header;

>    tree init, step;

> -  auto_vec<gimple *, 64> worklist;

> +  auto_vec<stmt_vec_info, 64> worklist;

>    gphi_iterator gsi;

>    bool double_reduc;

>

> @@ -543,9 +543,9 @@ vect_analyze_scalar_cycles_1 (loop_vec_i

>    /* Second - identify all reductions and nested cycles.  */

>    while (worklist.length () > 0)

>      {

> -      gimple *phi = worklist.pop ();

> +      stmt_vec_info stmt_vinfo = worklist.pop ();

> +      gphi *phi = as_a <gphi *> (stmt_vinfo->stmt);

>        tree def = PHI_RESULT (phi);

> -      stmt_vec_info stmt_vinfo = vinfo_for_stmt (phi);

>

>        if (dump_enabled_p ())

>          {

> Index: gcc/tree-vect-stmts.c

> ===================================================================

> --- gcc/tree-vect-stmts.c       2018-07-24 10:23:38.968700155 +0100

> +++ gcc/tree-vect-stmts.c       2018-07-24 10:23:42.472669038 +0100

> @@ -194,7 +194,7 @@ vect_clobber_variable (gimple *stmt, gim

>     Mark STMT as "relevant for vectorization" and add it to WORKLIST.  */

>

>  static void

> -vect_mark_relevant (vec<gimple *> *worklist, gimple *stmt,

> +vect_mark_relevant (vec<stmt_vec_info> *worklist, gimple *stmt,

>                     enum vect_relevant relevant, bool live_p)

>  {

>    stmt_vec_info stmt_info = vinfo_for_stmt (stmt);

> @@ -453,7 +453,7 @@ exist_non_indexing_operands_for_use_p (t

>

>  static bool

>  process_use (gimple *stmt, tree use, loop_vec_info loop_vinfo,

> -            enum vect_relevant relevant, vec<gimple *> *worklist,

> +            enum vect_relevant relevant, vec<stmt_vec_info> *worklist,

>              bool force)

>  {

>    stmt_vec_info stmt_vinfo = vinfo_for_stmt (stmt);

> @@ -618,16 +618,14 @@ vect_mark_stmts_to_be_vectorized (loop_v

>    basic_block *bbs = LOOP_VINFO_BBS (loop_vinfo);

>    unsigned int nbbs = loop->num_nodes;

>    gimple_stmt_iterator si;

> -  gimple *stmt;

>    unsigned int i;

> -  stmt_vec_info stmt_vinfo;

>    basic_block bb;

>    bool live_p;

>    enum vect_relevant relevant;

>

>    DUMP_VECT_SCOPE ("vect_mark_stmts_to_be_vectorized");

>

> -  auto_vec<gimple *, 64> worklist;

> +  auto_vec<stmt_vec_info, 64> worklist;

>

>    /* 1. Init worklist.  */

>    for (i = 0; i < nbbs; i++)

> @@ -665,17 +663,17 @@ vect_mark_stmts_to_be_vectorized (loop_v

>        use_operand_p use_p;

>        ssa_op_iter iter;

>

> -      stmt = worklist.pop ();

> +      stmt_vec_info stmt_vinfo = worklist.pop ();

>        if (dump_enabled_p ())

>         {

> -          dump_printf_loc (MSG_NOTE, vect_location, "worklist: examine stmt: ");

> -          dump_gimple_stmt (MSG_NOTE, TDF_SLIM, stmt, 0);

> +         dump_printf_loc (MSG_NOTE, vect_location,

> +                          "worklist: examine stmt: ");

> +         dump_gimple_stmt (MSG_NOTE, TDF_SLIM, stmt_vinfo->stmt, 0);

>         }

>

>        /* Examine the USEs of STMT. For each USE, mark the stmt that defines it

>          (DEF_STMT) as relevant/irrelevant according to the relevance property

>          of STMT.  */

> -      stmt_vinfo = vinfo_for_stmt (stmt);

>        relevant = STMT_VINFO_RELEVANT (stmt_vinfo);

>

>        /* Generally, the relevance property of STMT (in STMT_VINFO_RELEVANT) is

Patch

Index: gcc/tree-vect-loop.c
===================================================================
--- gcc/tree-vect-loop.c	2018-07-24 10:23:38.964700191 +0100
+++ gcc/tree-vect-loop.c	2018-07-24 10:23:42.472669038 +0100
@@ -474,7 +474,7 @@  vect_analyze_scalar_cycles_1 (loop_vec_i
 {
   basic_block bb = loop->header;
   tree init, step;
-  auto_vec<gimple *, 64> worklist;
+  auto_vec<stmt_vec_info, 64> worklist;
   gphi_iterator gsi;
   bool double_reduc;
 
@@ -543,9 +543,9 @@  vect_analyze_scalar_cycles_1 (loop_vec_i
   /* Second - identify all reductions and nested cycles.  */
   while (worklist.length () > 0)
     {
-      gimple *phi = worklist.pop ();
+      stmt_vec_info stmt_vinfo = worklist.pop ();
+      gphi *phi = as_a <gphi *> (stmt_vinfo->stmt);
       tree def = PHI_RESULT (phi);
-      stmt_vec_info stmt_vinfo = vinfo_for_stmt (phi);
 
       if (dump_enabled_p ())
         {
Index: gcc/tree-vect-stmts.c
===================================================================
--- gcc/tree-vect-stmts.c	2018-07-24 10:23:38.968700155 +0100
+++ gcc/tree-vect-stmts.c	2018-07-24 10:23:42.472669038 +0100
@@ -194,7 +194,7 @@  vect_clobber_variable (gimple *stmt, gim
    Mark STMT as "relevant for vectorization" and add it to WORKLIST.  */
 
 static void
-vect_mark_relevant (vec<gimple *> *worklist, gimple *stmt,
+vect_mark_relevant (vec<stmt_vec_info> *worklist, gimple *stmt,
 		    enum vect_relevant relevant, bool live_p)
 {
   stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
@@ -453,7 +453,7 @@  exist_non_indexing_operands_for_use_p (t
 
 static bool
 process_use (gimple *stmt, tree use, loop_vec_info loop_vinfo,
-	     enum vect_relevant relevant, vec<gimple *> *worklist,
+	     enum vect_relevant relevant, vec<stmt_vec_info> *worklist,
 	     bool force)
 {
   stmt_vec_info stmt_vinfo = vinfo_for_stmt (stmt);
@@ -618,16 +618,14 @@  vect_mark_stmts_to_be_vectorized (loop_v
   basic_block *bbs = LOOP_VINFO_BBS (loop_vinfo);
   unsigned int nbbs = loop->num_nodes;
   gimple_stmt_iterator si;
-  gimple *stmt;
   unsigned int i;
-  stmt_vec_info stmt_vinfo;
   basic_block bb;
   bool live_p;
   enum vect_relevant relevant;
 
   DUMP_VECT_SCOPE ("vect_mark_stmts_to_be_vectorized");
 
-  auto_vec<gimple *, 64> worklist;
+  auto_vec<stmt_vec_info, 64> worklist;
 
   /* 1. Init worklist.  */
   for (i = 0; i < nbbs; i++)
@@ -665,17 +663,17 @@  vect_mark_stmts_to_be_vectorized (loop_v
       use_operand_p use_p;
       ssa_op_iter iter;
 
-      stmt = worklist.pop ();
+      stmt_vec_info stmt_vinfo = worklist.pop ();
       if (dump_enabled_p ())
 	{
-          dump_printf_loc (MSG_NOTE, vect_location, "worklist: examine stmt: ");
-          dump_gimple_stmt (MSG_NOTE, TDF_SLIM, stmt, 0);
+	  dump_printf_loc (MSG_NOTE, vect_location,
+			   "worklist: examine stmt: ");
+	  dump_gimple_stmt (MSG_NOTE, TDF_SLIM, stmt_vinfo->stmt, 0);
 	}
 
       /* Examine the USEs of STMT. For each USE, mark the stmt that defines it
 	 (DEF_STMT) as relevant/irrelevant according to the relevance property
 	 of STMT.  */
-      stmt_vinfo = vinfo_for_stmt (stmt);
       relevant = STMT_VINFO_RELEVANT (stmt_vinfo);
 
       /* Generally, the relevance property of STMT (in STMT_VINFO_RELEVANT) is