diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2017-12-21 07:02:20 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2017-12-21 07:02:20 +0000 |
commit | f7ed31955b00970413b202e0b4c3144aeec136d5 (patch) | |
tree | 380b5c0912af6eebd8cb2079f0f03a9f9086678d /gcc | |
parent | aca52e6f8d29064f4712e5f3f4429a36f918f099 (diff) | |
download | gcc-f7ed31955b00970413b202e0b4c3144aeec136d5.zip gcc-f7ed31955b00970413b202e0b4c3144aeec136d5.tar.gz gcc-f7ed31955b00970413b202e0b4c3144aeec136d5.tar.bz2 |
poly_int: build_ref_for_offset
This patch changes the offset parameter to build_ref_for_offset
from HOST_WIDE_INT to poly_int64.
2017-12-21 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
gcc/
* ipa-prop.h (build_ref_for_offset): Take the offset as a poly_int64
rather than a HOST_WIDE_INT.
* tree-sra.c (build_ref_for_offset): Likewise.
Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r255931
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/ipa-prop.h | 2 | ||||
-rw-r--r-- | gcc/tree-sra.c | 17 |
3 files changed, 17 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2bdcde1..d206c34 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -2,6 +2,14 @@ Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> + * ipa-prop.h (build_ref_for_offset): Take the offset as a poly_int64 + rather than a HOST_WIDE_INT. + * tree-sra.c (build_ref_for_offset): Likewise. + +2017-12-21 Richard Sandiford <richard.sandiford@linaro.org> + Alan Hayward <alan.hayward@arm.com> + David Sherwood <david.sherwood@arm.com> + * fold-const.h (mem_ref_offset): Return a poly_offset_int rather than an offset_int. * tree.c (mem_ref_offset): Likewise. diff --git a/gcc/ipa-prop.h b/gcc/ipa-prop.h index c362405..2b3ea68 100644 --- a/gcc/ipa-prop.h +++ b/gcc/ipa-prop.h @@ -785,7 +785,7 @@ void ipa_release_body_info (struct ipa_func_body_info *); tree ipa_get_callee_param_type (struct cgraph_edge *e, int i); /* From tree-sra.c: */ -tree build_ref_for_offset (location_t, tree, HOST_WIDE_INT, bool, tree, +tree build_ref_for_offset (location_t, tree, poly_int64, bool, tree, gimple_stmt_iterator *, bool); /* In ipa-cp.c */ diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index 93de044..d7112a8 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -1706,7 +1706,7 @@ make_fancy_name (tree expr) of handling bitfields. */ tree -build_ref_for_offset (location_t loc, tree base, HOST_WIDE_INT offset, +build_ref_for_offset (location_t loc, tree base, poly_int64 offset, bool reverse, tree exp_type, gimple_stmt_iterator *gsi, bool insert_after) { @@ -1724,7 +1724,7 @@ build_ref_for_offset (location_t loc, tree base, HOST_WIDE_INT offset, TYPE_QUALS (exp_type) | ENCODE_QUAL_ADDR_SPACE (as)); - gcc_checking_assert (offset % BITS_PER_UNIT == 0); + poly_int64 byte_offset = exact_div (offset, BITS_PER_UNIT); get_object_alignment_1 (base, &align, &misalign); base = get_addr_base_and_unit_offset (base, &base_offset); @@ -1746,27 +1746,26 @@ build_ref_for_offset (location_t loc, tree base, HOST_WIDE_INT offset, else gsi_insert_before (gsi, stmt, GSI_SAME_STMT); - off = build_int_cst (reference_alias_ptr_type (prev_base), - offset / BITS_PER_UNIT); + off = build_int_cst (reference_alias_ptr_type (prev_base), byte_offset); base = tmp; } else if (TREE_CODE (base) == MEM_REF) { off = build_int_cst (TREE_TYPE (TREE_OPERAND (base, 1)), - base_offset + offset / BITS_PER_UNIT); + base_offset + byte_offset); off = int_const_binop (PLUS_EXPR, TREE_OPERAND (base, 1), off); base = unshare_expr (TREE_OPERAND (base, 0)); } else { off = build_int_cst (reference_alias_ptr_type (prev_base), - base_offset + offset / BITS_PER_UNIT); + base_offset + byte_offset); base = build_fold_addr_expr (unshare_expr (base)); } - misalign = (misalign + offset) & (align - 1); - if (misalign != 0) - align = least_bit_hwi (misalign); + unsigned int align_bound = known_alignment (misalign + offset); + if (align_bound != 0) + align = MIN (align, align_bound); if (align != TYPE_ALIGN (exp_type)) exp_type = build_aligned_type (exp_type, align); |