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]

[3/7] Rename DR_ALIGNED_TO to DR_OFFSET_ALIGNMENT


This patch renames DR_ALIGNED_TO to DR_OFFSET_ALIGNMENT, to avoid
confusion with the upcoming DR_BASE_ALIGNMENT.  Nothing needed the
value as a tree, and the value is clipped to BIGGEST_ALIGNMENT
(maybe it should be MAX_OFILE_ALIGNMENT?) so we might as well use
an unsigned int instead.

Tested on aarch64-linux-gnu and x86_64-linux-gnu.  OK to install?

Richard


2017-07-03  Richard Sandiford  <richard.sandiford@linaro.org>

gcc/
	* tree-data-ref.h (innermost_loop_behavior): Replace aligned_to
	with offset_alignment.
	(DR_ALIGNED_TO): Delete.
	(DR_OFFSET_ALIGNMENT): New macro.
	* tree-vectorizer.h (STMT_VINFO_DR_ALIGNED_TO): Delete.
	(STMT_VINFO_DR_OFFSET_ALIGNMENT): New macro.
	* tree-data-ref.c (dr_analyze_innermost): Update after above changes.
	(create_data_ref): Likewise.
	* tree-vect-data-refs.c (vect_compute_data_ref_alignment): Likewise.
	(vect_analyze_data_refs): Likewise.
	* tree-if-conv.c (if_convertible_loop_p_1): Use memset before
	creating dummy innermost behavior.

Index: gcc/tree-data-ref.h
===================================================================
--- gcc/tree-data-ref.h	2017-07-03 08:03:19.181500132 +0100
+++ gcc/tree-data-ref.h	2017-07-03 08:06:19.720107957 +0100
@@ -52,9 +52,10 @@ struct innermost_loop_behavior
   tree init;
   tree step;
 
-  /* Alignment information.  ALIGNED_TO is set to the largest power of two
-     that divides OFFSET.  */
-  tree aligned_to;
+  /* The largest power of two that divides OFFSET, capped to a suitably
+     high value if the offset is zero.  This is a byte rather than a bit
+     quantity.  */
+  unsigned int offset_alignment;
 };
 
 /* Describes the evolutions of indices of the memory reference.  The indices
@@ -143,7 +144,7 @@ #define DR_OFFSET(DR)              (DR)-
 #define DR_INIT(DR)                (DR)->innermost.init
 #define DR_STEP(DR)                (DR)->innermost.step
 #define DR_PTR_INFO(DR)            (DR)->alias.ptr_info
-#define DR_ALIGNED_TO(DR)          (DR)->innermost.aligned_to
+#define DR_OFFSET_ALIGNMENT(DR)    (DR)->innermost.offset_alignment
 #define DR_INNERMOST(DR)           (DR)->innermost
 
 typedef struct data_reference *data_reference_p;
Index: gcc/tree-vectorizer.h
===================================================================
--- gcc/tree-vectorizer.h	2017-07-03 07:57:56.883079731 +0100
+++ gcc/tree-vectorizer.h	2017-07-03 08:06:19.721107925 +0100
@@ -707,7 +707,8 @@ #define STMT_VINFO_DR_BASE_ADDRESS(S)
 #define STMT_VINFO_DR_INIT(S)              (S)->dr_wrt_vec_loop.init
 #define STMT_VINFO_DR_OFFSET(S)            (S)->dr_wrt_vec_loop.offset
 #define STMT_VINFO_DR_STEP(S)              (S)->dr_wrt_vec_loop.step
-#define STMT_VINFO_DR_ALIGNED_TO(S)        (S)->dr_wrt_vec_loop.aligned_to
+#define STMT_VINFO_DR_OFFSET_ALIGNMENT(S) \
+  (S)->dr_wrt_vec_loop.offset_alignment
 
 #define STMT_VINFO_IN_PATTERN_P(S)         (S)->in_pattern_p
 #define STMT_VINFO_RELATED_STMT(S)         (S)->related_stmt
Index: gcc/tree-data-ref.c
===================================================================
--- gcc/tree-data-ref.c	2017-07-03 08:03:19.181500132 +0100
+++ gcc/tree-data-ref.c	2017-07-03 08:06:19.720107957 +0100
@@ -869,7 +869,7 @@ dr_analyze_innermost (struct data_refere
   drb->offset = fold_convert (ssizetype, offset_iv.base);
   drb->init = init;
   drb->step = step;
-  drb->aligned_to = size_int (highest_pow2_factor (offset_iv.base));
+  drb->offset_alignment = highest_pow2_factor (offset_iv.base);
 
   if (dump_file && (dump_flags & TDF_DETAILS))
     fprintf (dump_file, "success.\n");
@@ -1083,8 +1083,8 @@ create_data_ref (loop_p nest, loop_p loo
       print_generic_expr (dump_file, DR_INIT (dr), TDF_SLIM);
       fprintf (dump_file, "\n\tstep: ");
       print_generic_expr (dump_file, DR_STEP (dr), TDF_SLIM);
-      fprintf (dump_file, "\n\taligned to: ");
-      print_generic_expr (dump_file, DR_ALIGNED_TO (dr), TDF_SLIM);
+      fprintf (dump_file, "\n\toffset alignment: %d",
+	       DR_OFFSET_ALIGNMENT (dr));
       fprintf (dump_file, "\n\tbase_object: ");
       print_generic_expr (dump_file, DR_BASE_OBJECT (dr), TDF_SLIM);
       fprintf (dump_file, "\n");
Index: gcc/tree-vect-data-refs.c
===================================================================
--- gcc/tree-vect-data-refs.c	2017-07-03 07:57:47.758408141 +0100
+++ gcc/tree-vect-data-refs.c	2017-07-03 08:06:19.721107925 +0100
@@ -772,7 +772,7 @@ vect_compute_data_ref_alignment (struct
 
   alignment = TYPE_ALIGN_UNIT (vectype);
 
-  if ((compare_tree_int (drb->aligned_to, alignment) < 0)
+  if (drb->offset_alignment < alignment
       || !step_preserves_misalignment_p)
     {
       if (dump_enabled_p ())
@@ -3412,8 +3412,8 @@ vect_analyze_data_refs (vec_info *vinfo,
 				    {
 				      DR_OFFSET (newdr) = ssize_int (0);
 				      DR_STEP (newdr) = step;
-				      DR_ALIGNED_TO (newdr)
-					= size_int (BIGGEST_ALIGNMENT);
+				      DR_OFFSET_ALIGNMENT (newdr)
+					= BIGGEST_ALIGNMENT;
 				      dr = newdr;
 				      simd_lane_access = true;
 				    }
@@ -3644,8 +3644,8 @@ vect_analyze_data_refs (vec_info *vinfo,
 	  STMT_VINFO_DR_INIT (stmt_info) = outer_init;
 	  STMT_VINFO_DR_OFFSET (stmt_info) =
 				fold_convert (ssizetype, offset_iv.base);
-	  STMT_VINFO_DR_ALIGNED_TO (stmt_info) =
-				size_int (highest_pow2_factor (offset_iv.base));
+	  STMT_VINFO_DR_OFFSET_ALIGNMENT (stmt_info)
+	    = highest_pow2_factor (offset_iv.base);
 
           if (dump_enabled_p ())
 	    {
@@ -3663,10 +3663,8 @@ vect_analyze_data_refs (vec_info *vinfo,
 	      dump_printf (MSG_NOTE, "\n\touter step: ");
 	      dump_generic_expr (MSG_NOTE, TDF_SLIM,
                                  STMT_VINFO_DR_STEP (stmt_info));
-	      dump_printf (MSG_NOTE, "\n\touter aligned to: ");
-	      dump_generic_expr (MSG_NOTE, TDF_SLIM,
-                                 STMT_VINFO_DR_ALIGNED_TO (stmt_info));
-	      dump_printf (MSG_NOTE, "\n");
+	      dump_printf (MSG_NOTE, "\n\touter offset alignment: %d\n",
+			   STMT_VINFO_DR_OFFSET_ALIGNMENT (stmt_info));
 	    }
 	}
 
Index: gcc/tree-if-conv.c
===================================================================
--- gcc/tree-if-conv.c	2017-07-03 07:53:58.064561604 +0100
+++ gcc/tree-if-conv.c	2017-07-03 08:07:23.239704138 +0100
@@ -1441,11 +1441,8 @@ if_convertible_loop_p_1 (struct loop *lo
 	         || TREE_CODE (ref) == REALPART_EXPR)
 	    ref = TREE_OPERAND (ref, 0);
 
-          DR_BASE_ADDRESS (dr) = ref;
-          DR_OFFSET (dr) = NULL;
-          DR_INIT (dr) = NULL;
-          DR_STEP (dr) = NULL;
-          DR_ALIGNED_TO (dr) = NULL;
+	  memset (&DR_INNERMOST (dr), 0, sizeof (DR_INNERMOST (dr)));
+	  DR_BASE_ADDRESS (dr) = ref;
         }
       hash_memrefs_baserefs_and_store_DRs_read_written_info (dr);
     }


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