aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-predcom.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@linaro.org>2017-12-20 12:55:45 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2017-12-20 12:55:45 +0000
commitcc8bea091633989bef6d665c40193a9e255ceb81 (patch)
tree0198dc636ad0b00daedf03723bb5e7349e3373a3 /gcc/tree-predcom.c
parenta90c88042b29b16ecadc2f0560f4d3581bcf9ad6 (diff)
downloadgcc-cc8bea091633989bef6d665c40193a9e255ceb81.zip
gcc-cc8bea091633989bef6d665c40193a9e255ceb81.tar.gz
gcc-cc8bea091633989bef6d665c40193a9e255ceb81.tar.bz2
poly_int: aff_tree
This patch changes the type of aff_tree::offset from widest_int to poly_widest_int and adjusts the function interfaces in the same way. 2017-12-20 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * tree-affine.h (aff_tree::offset): Change from widest_int to poly_widest_int. (wide_int_ext_for_comb): Delete. (aff_combination_const, aff_comb_cannot_overlap_p): Take the constants as poly_widest_int rather than widest_int. (aff_combination_constant_multiple_p): Return the multiplier as a poly_widest_int. (aff_combination_zero_p, aff_combination_singleton_var_p): Handle polynomial offsets. * tree-affine.c (wide_int_ext_for_comb): Make original widest_int version static and add an overload for poly_widest_int. (aff_combination_const, aff_combination_add_cst) (wide_int_constant_multiple_p, aff_comb_cannot_overlap_p): Take the constants as poly_widest_int rather than widest_int. (tree_to_aff_combination): Generalize INTEGER_CST case to poly_int_tree_p. (aff_combination_to_tree): Track offsets as poly_widest_ints. (aff_combination_add_product, aff_combination_mult): Handle polynomial offsets. (aff_combination_constant_multiple_p): Return the multiplier as a poly_widest_int. * tree-predcom.c (determine_offset): Return the offset as a poly_widest_int. (split_data_refs_to_components, suitable_component_p): Update accordingly. (valid_initializer_p): Update call to aff_combination_constant_multiple_p. * tree-ssa-address.c (addr_to_parts): Handle polynomial offsets. * tree-ssa-loop-ivopts.c (get_address_cost_ainc): Take the step as a poly_int64 rather than a HOST_WIDE_INT. (get_address_cost): Handle polynomial offsets. (iv_elimination_compare_lt): Likewise. (rewrite_use_nonlinear_expr): Likewise. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r255888
Diffstat (limited to 'gcc/tree-predcom.c')
-rw-r--r--gcc/tree-predcom.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/gcc/tree-predcom.c b/gcc/tree-predcom.c
index dde9037..d3a863e 100644
--- a/gcc/tree-predcom.c
+++ b/gcc/tree-predcom.c
@@ -692,7 +692,7 @@ aff_combination_dr_offset (struct data_reference *dr, aff_tree *offset)
static bool
determine_offset (struct data_reference *a, struct data_reference *b,
- widest_int *off)
+ poly_widest_int *off)
{
aff_tree diff, baseb, step;
tree typea, typeb;
@@ -801,7 +801,7 @@ split_data_refs_to_components (struct loop *loop,
FOR_EACH_VEC_ELT (depends, i, ddr)
{
- widest_int dummy_off;
+ poly_widest_int dummy_off;
if (DDR_ARE_DEPENDENT (ddr) == chrec_known)
continue;
@@ -958,7 +958,11 @@ suitable_component_p (struct loop *loop, struct component *comp)
for (i = 1; comp->refs.iterate (i, &a); i++)
{
- if (!determine_offset (first->ref, a->ref, &a->offset))
+ /* Polynomial offsets are no use, since we need to know the
+ gap between iteration numbers at compile time. */
+ poly_widest_int offset;
+ if (!determine_offset (first->ref, a->ref, &offset)
+ || !offset.is_constant (&a->offset))
return false;
enum ref_step_type a_step;
@@ -1187,7 +1191,7 @@ valid_initializer_p (struct data_reference *ref,
unsigned distance, struct data_reference *root)
{
aff_tree diff, base, step;
- widest_int off;
+ poly_widest_int off;
/* Both REF and ROOT must be accessing the same object. */
if (!operand_equal_p (DR_BASE_ADDRESS (ref), DR_BASE_ADDRESS (root), 0))
@@ -1215,7 +1219,7 @@ valid_initializer_p (struct data_reference *ref,
if (!aff_combination_constant_multiple_p (&diff, &step, &off))
return false;
- if (off != distance)
+ if (maybe_ne (off, distance))
return false;
return true;