This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[39/46] Replace STMT_VINFO_UNALIGNED_DR with the associated statement


After previous changes, it makes more sense to record which stmt's
access is going to be aligned via peeling, rather than the associated
scalar data reference.


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

gcc/
	* tree-vectorizer.h (_loop_vec_info::unaligned_dr): Replace with...
	(_loop_vec_info::unaligned_stmt): ...this new field.
	(LOOP_VINFO_UNALIGNED_DR): Delete.
	(LOOP_VINFO_UNALIGNED_STMT): New macro.
	* tree-vect-data-refs.c (vect_enhance_data_refs_alignment): Use
	LOOP_VINFO_UNALIGNED_STMT instead of LOOP_VINFO_UNALIGNED_DR.
	* tree-vect-loop-manip.c (get_misalign_in_elems): Likewise.
	(vect_gen_prolog_loop_niters): Likewise.
	* tree-vect-loop.c (_loop_vec_info::_loop_vec_info): Update
	after above change to _loop_vec_info.

Index: gcc/tree-vectorizer.h
===================================================================
--- gcc/tree-vectorizer.h	2018-07-24 10:24:08.924434128 +0100
+++ gcc/tree-vectorizer.h	2018-07-24 10:24:12.252404574 +0100
@@ -436,7 +436,7 @@ typedef struct _loop_vec_info : public v
   tree mask_compare_type;
 
   /* Unknown DRs according to which loop was peeled.  */
-  struct data_reference *unaligned_dr;
+  stmt_vec_info unaligned_stmt;
 
   /* peeling_for_alignment indicates whether peeling for alignment will take
      place, and what the peeling factor should be:
@@ -445,7 +445,7 @@ typedef struct _loop_vec_info : public v
         If X>0: Peel first X iterations.
         If X=-1: Generate a runtime test to calculate the number of iterations
                  to be peeled, using the dataref recorded in the field
-                 unaligned_dr.  */
+                 unaligned_stmt.  */
   int peeling_for_alignment;
 
   /* The mask used to check the alignment of pointers or arrays.  */
@@ -576,7 +576,7 @@ #define LOOP_VINFO_DATAREFS(L)
 #define LOOP_VINFO_DDRS(L)                 (L)->shared->ddrs
 #define LOOP_VINFO_INT_NITERS(L)           (TREE_INT_CST_LOW ((L)->num_iters))
 #define LOOP_VINFO_PEELING_FOR_ALIGNMENT(L) (L)->peeling_for_alignment
-#define LOOP_VINFO_UNALIGNED_DR(L)         (L)->unaligned_dr
+#define LOOP_VINFO_UNALIGNED_STMT(L)       (L)->unaligned_stmt
 #define LOOP_VINFO_MAY_MISALIGN_STMTS(L)   (L)->may_misalign_stmts
 #define LOOP_VINFO_MAY_ALIAS_DDRS(L)       (L)->may_alias_ddrs
 #define LOOP_VINFO_COMP_ALIAS_DDRS(L)      (L)->comp_alias_ddrs
Index: gcc/tree-vect-data-refs.c
===================================================================
--- gcc/tree-vect-data-refs.c	2018-07-24 10:24:08.924434128 +0100
+++ gcc/tree-vect-data-refs.c	2018-07-24 10:24:12.248404609 +0100
@@ -2134,7 +2134,7 @@ vect_enhance_data_refs_alignment (loop_v
 						   peel_stmt_info, npeel);
 	      }
 
-          LOOP_VINFO_UNALIGNED_DR (loop_vinfo) = dr0;
+          LOOP_VINFO_UNALIGNED_STMT (loop_vinfo) = peel_stmt_info;
           if (npeel)
             LOOP_VINFO_PEELING_FOR_ALIGNMENT (loop_vinfo) = npeel;
           else
Index: gcc/tree-vect-loop-manip.c
===================================================================
--- gcc/tree-vect-loop-manip.c	2018-07-24 10:24:05.740462405 +0100
+++ gcc/tree-vect-loop-manip.c	2018-07-24 10:24:12.248404609 +0100
@@ -1560,8 +1560,8 @@ vect_update_ivs_after_vectorizer (loop_v
 static tree
 get_misalign_in_elems (gimple **seq, loop_vec_info loop_vinfo)
 {
-  struct data_reference *dr = LOOP_VINFO_UNALIGNED_DR (loop_vinfo);
-  stmt_vec_info stmt_info = vect_dr_stmt (dr);
+  stmt_vec_info stmt_info = LOOP_VINFO_UNALIGNED_STMT (loop_vinfo);
+  struct data_reference *dr = STMT_VINFO_DATA_REF (stmt_info);
   tree vectype = STMT_VINFO_VECTYPE (stmt_info);
 
   unsigned int target_align = STMT_VINFO_TARGET_ALIGNMENT (stmt_info);
@@ -1594,8 +1594,8 @@ get_misalign_in_elems (gimple **seq, loo
 /* Function vect_gen_prolog_loop_niters
 
    Generate the number of iterations which should be peeled as prolog for the
-   loop represented by LOOP_VINFO.  It is calculated as the misalignment of
-   DR - the data reference recorded in LOOP_VINFO_UNALIGNED_DR (LOOP_VINFO).
+   loop represented by LOOP_VINFO.  It is calculated as the misalignment of DR
+   - the data reference recorded in LOOP_VINFO_UNALIGNED_STMT (LOOP_VINFO).
    As a result, after the execution of this loop, the data reference DR will
    refer to an aligned location.  The following computation is generated:
 
@@ -1626,12 +1626,12 @@ get_misalign_in_elems (gimple **seq, loo
 vect_gen_prolog_loop_niters (loop_vec_info loop_vinfo,
 			     basic_block bb, int *bound)
 {
-  struct data_reference *dr = LOOP_VINFO_UNALIGNED_DR (loop_vinfo);
+  stmt_vec_info stmt_info = LOOP_VINFO_UNALIGNED_STMT (loop_vinfo);
+  data_reference *dr = STMT_VINFO_DATA_REF (stmt_info);
   tree var;
   tree niters_type = TREE_TYPE (LOOP_VINFO_NITERS (loop_vinfo));
   gimple_seq stmts = NULL, new_stmts = NULL;
   tree iters, iters_name;
-  stmt_vec_info stmt_info = vect_dr_stmt (dr);
   tree vectype = STMT_VINFO_VECTYPE (stmt_info);
   unsigned int target_align = STMT_VINFO_TARGET_ALIGNMENT (stmt_info);
 
Index: gcc/tree-vect-loop.c
===================================================================
--- gcc/tree-vect-loop.c	2018-07-24 10:24:02.360492422 +0100
+++ gcc/tree-vect-loop.c	2018-07-24 10:24:12.252404574 +0100
@@ -817,7 +817,7 @@ _loop_vec_info::_loop_vec_info (struct l
     max_vectorization_factor (0),
     mask_skip_niters (NULL_TREE),
     mask_compare_type (NULL_TREE),
-    unaligned_dr (NULL),
+    unaligned_stmt (NULL),
     peeling_for_alignment (0),
     ptr_mask (0),
     ivexpr_map (NULL),
@@ -2142,8 +2142,8 @@ vect_analyze_loop_2 (loop_vec_info loop_
 	  /* Niters for peeled prolog loop.  */
 	  if (LOOP_VINFO_PEELING_FOR_ALIGNMENT (loop_vinfo) < 0)
 	    {
-	      struct data_reference *dr = LOOP_VINFO_UNALIGNED_DR (loop_vinfo);
-	      tree vectype = STMT_VINFO_VECTYPE (vect_dr_stmt (dr));
+	      stmt_vec_info stmt_info = LOOP_VINFO_UNALIGNED_STMT (loop_vinfo);
+	      tree vectype = STMT_VINFO_VECTYPE (stmt_info);
 	      niters_th += TYPE_VECTOR_SUBPARTS (vectype) - 1;
 	    }
 	  else


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]