From c0a465457beb663430257375ba529af74b0e4e56 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Fri, 12 Jan 2018 14:48:53 +0000 Subject: [PATCH] Handle polynomial DR_INIT The idea with the main 107-patch poly_int series (latterly 109-patch) was to change the mode sizes and vector element counts to poly_int and then propagate those changes as far as they needed to go to fix build failures from incompatible types. This means that DR_INIT is now constructed as a poly_int64: poly_int64 pbytepos; if (!multiple_p (pbitpos, BITS_PER_UNIT, &pbytepos)) { if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, "failed: bit offset alignment.\n"); return false; } [...] init = ssize_int (pbytepos); This patch adjusts other references to DR_INIT accordingly. Unlike the above, the adjustments weren't needed to avoid a build-time type incompatibility, but they are needed to make the producer and consumers of DR_INIT logically consistent. 2018-01-12 Richard Sandiford gcc/ * tree-predcom.c (aff_combination_dr_offset): Use wi::to_poly_widest rather than wi::to_widest for DR_INITs. * tree-vect-data-refs.c (vect_find_same_alignment_drs): Use wi::to_poly_offset rather than wi::to_offset for DR_INIT. (vect_analyze_data_ref_accesses): Require both DR_INITs to be INTEGER_CSTs. (vect_analyze_group_access_1): Note that here. From-SVN: r256587 --- gcc/ChangeLog | 10 ++++++++++ gcc/tree-predcom.c | 2 +- gcc/tree-vect-data-refs.c | 14 ++++++++++---- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7195a2a729f..752c77731e2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2018-01-12 Richard Sandiford + + * tree-predcom.c (aff_combination_dr_offset): Use wi::to_poly_widest + rather than wi::to_widest for DR_INITs. + * tree-vect-data-refs.c (vect_find_same_alignment_drs): Use + wi::to_poly_offset rather than wi::to_offset for DR_INIT. + (vect_analyze_data_ref_accesses): Require both DR_INITs to be + INTEGER_CSTs. + (vect_analyze_group_access_1): Note that here. + 2018-01-12 Richard Sandiford * tree-vectorizer.c (get_vec_alignment_for_array_type): Handle diff --git a/gcc/tree-predcom.c b/gcc/tree-predcom.c index 0fe46f04320..2bde732f8ad 100644 --- a/gcc/tree-predcom.c +++ b/gcc/tree-predcom.c @@ -680,7 +680,7 @@ aff_combination_dr_offset (struct data_reference *dr, aff_tree *offset) tree_to_aff_combination_expand (DR_OFFSET (dr), type, offset, &name_expansions); - aff_combination_const (&delta, type, wi::to_widest (DR_INIT (dr))); + aff_combination_const (&delta, type, wi::to_poly_widest (DR_INIT (dr))); aff_combination_add (offset, &delta); } diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index e0a2f7b7c89..eb825942598 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -2227,9 +2227,9 @@ vect_find_same_alignment_drs (struct data_dependence_relation *ddr) return; /* Two references with distance zero have the same alignment. */ - offset_int diff = (wi::to_offset (DR_INIT (dra)) - - wi::to_offset (DR_INIT (drb))); - if (diff != 0) + poly_offset_int diff = (wi::to_poly_offset (DR_INIT (dra)) + - wi::to_poly_offset (DR_INIT (drb))); + if (maybe_ne (diff, 0)) { /* Get the wider of the two alignments. */ unsigned int align_a = (vect_calculate_target_alignment (dra) @@ -2239,7 +2239,7 @@ vect_find_same_alignment_drs (struct data_dependence_relation *ddr) unsigned int max_align = MAX (align_a, align_b); /* Require the gap to be a multiple of the larger vector alignment. */ - if (!wi::multiple_of_p (diff, max_align, SIGNED)) + if (!multiple_p (diff, max_align)) return; } @@ -2475,6 +2475,7 @@ vect_analyze_group_access_1 (struct data_reference *dr) gimple *prev = stmt; HOST_WIDE_INT diff, gaps = 0; + /* By construction, all group members have INTEGER_CST DR_INITs. */ while (next) { /* Skip same data-refs. In case that two or more stmts share @@ -2864,6 +2865,11 @@ vect_analyze_data_ref_accesses (vec_info *vinfo) TREE_TYPE (DR_REF (drb)))) break; + /* Check that the DR_INITs are compile-time constants. */ + if (TREE_CODE (DR_INIT (dra)) != INTEGER_CST + || TREE_CODE (DR_INIT (drb)) != INTEGER_CST) + break; + /* Sorting has ensured that DR_INIT (dra) <= DR_INIT (drb). */ HOST_WIDE_INT init_a = TREE_INT_CST_LOW (DR_INIT (dra)); HOST_WIDE_INT init_b = TREE_INT_CST_LOW (DR_INIT (drb)); -- 2.30.2