From e054a1852bf903139a80f34c726453d34338e008 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Mon, 3 Jul 2017 13:36:36 +0000 Subject: [PATCH] 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. 2017-07-03 Richard Sandiford 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. From-SVN: r249914 --- gcc/ChangeLog | 15 +++++++++++++++ gcc/tree-data-ref.c | 6 +++--- gcc/tree-data-ref.h | 9 +++++---- gcc/tree-if-conv.c | 7 ++----- gcc/tree-vect-data-refs.c | 16 +++++++--------- gcc/tree-vectorizer.h | 3 ++- 6 files changed, 34 insertions(+), 22 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5abc06de67c..b063bb49ebe 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,18 @@ +2017-07-03 Richard Sandiford + + * 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. + 2017-07-03 Richard Sandiford * tree-data-ref.h (dr_analyze_innermost): Replace the dr argument diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index 1545fdb9076..c5cf0acabae 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -869,7 +869,7 @@ dr_analyze_innermost (innermost_loop_behavior *drb, tree ref, 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"); @@ -1084,8 +1084,8 @@ create_data_ref (loop_p nest, loop_p loop, tree memref, gimple *stmt, 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"); diff --git a/gcc/tree-data-ref.h b/gcc/tree-data-ref.h index c8bb813e77c..45ecf9bc172 100644 --- a/gcc/tree-data-ref.h +++ b/gcc/tree-data-ref.h @@ -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 @@ struct data_reference #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; diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c index ca29c762299..d78731f1678 100644 --- a/gcc/tree-if-conv.c +++ b/gcc/tree-if-conv.c @@ -1441,11 +1441,8 @@ if_convertible_loop_p_1 (struct loop *loop, vec *refs) || 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); } diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index 3b4d570cc6a..091771cedbc 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -772,7 +772,7 @@ vect_compute_data_ref_alignment (struct data_reference *dr) 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 @@ again: { 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 @@ again: 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 @@ again: 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)); } } diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index 4a1e302fe36..15f5dc3a925 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -709,7 +709,8 @@ STMT_VINFO_BB_VINFO (stmt_vec_info stmt_vinfo) #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 -- 2.30.2