diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2017-12-20 12:55:37 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2017-12-20 12:55:37 +0000 |
commit | a90c88042b29b16ecadc2f0560f4d3581bcf9ad6 (patch) | |
tree | 2e6dcba8a6c3ba6a73ae47044aa1ecc7a042c4ed /gcc/tree-ssa-ccp.c | |
parent | 588db50c8cf2c2ea081b2be7c1c3bc5452cdef20 (diff) | |
download | gcc-a90c88042b29b16ecadc2f0560f4d3581bcf9ad6.zip gcc-a90c88042b29b16ecadc2f0560f4d3581bcf9ad6.tar.gz gcc-a90c88042b29b16ecadc2f0560f4d3581bcf9ad6.tar.bz2 |
poly_int: get_addr_base_and_unit_offset
This patch changes the values returned by
get_addr_base_and_unit_offset from HOST_WIDE_INT to poly_int64.
maxsize in gimple_fold_builtin_memory_op goes from HOST_WIDE_INT
to poly_uint64 (rather than poly_int) to match the previous use
of tree_fits_uhwi_p.
2017-12-20 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
gcc/
* tree-dfa.h (get_addr_base_and_unit_offset_1): Return the offset
as a poly_int64_pod rather than a HOST_WIDE_INT.
(get_addr_base_and_unit_offset): Likewise.
* tree-dfa.c (get_addr_base_and_unit_offset_1): Likewise.
(get_addr_base_and_unit_offset): Likewise.
* doc/match-and-simplify.texi: Change off from HOST_WIDE_INT
to poly_int64 in example.
* fold-const.c (fold_binary_loc): Update call to
get_addr_base_and_unit_offset.
* gimple-fold.c (gimple_fold_builtin_memory_op): Likewise.
(maybe_canonicalize_mem_ref_addr): Likewise.
(gimple_fold_stmt_to_constant_1): Likewise.
* gimple-ssa-warn-restrict.c (builtin_memref::builtin_memref):
Likewise.
* ipa-param-manipulation.c (ipa_modify_call_arguments): Likewise.
* match.pd: Likewise.
* omp-low.c (lower_omp_target): Likewise.
* tree-sra.c (build_ref_for_offset): Likewise.
(build_debug_ref_for_model): Likewise.
* tree-ssa-address.c (maybe_fold_tmr): Likewise.
* tree-ssa-alias.c (ao_ref_init_from_ptr_and_size): Likewise.
* tree-ssa-ccp.c (optimize_memcpy): Likewise.
* tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Likewise.
(constant_pointer_difference): Likewise.
* tree-ssa-loop-niter.c (expand_simple_operations): Likewise.
* tree-ssa-phiopt.c (jump_function_from_stmt): Likewise.
* tree-ssa-pre.c (create_component_ref_by_pieces_1): Likewise.
* tree-ssa-sccvn.c (vn_reference_fold_indirect): Likewise.
(vn_reference_maybe_forwprop_address, vn_reference_lookup_3): Likewise.
(set_ssa_val_to): Likewise.
* tree-ssa-strlen.c (get_addr_stridx, addr_stridxptr)
(maybe_diag_stxncpy_trunc): Likewise.
* tree-vrp.c (vrp_prop::check_array_ref): Likewise.
* tree.c (build_simple_mem_ref_loc): Likewise.
(array_at_struct_end_p): Likewise.
Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r255887
Diffstat (limited to 'gcc/tree-ssa-ccp.c')
-rw-r--r-- | gcc/tree-ssa-ccp.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index 3acddf9..e38c009 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -3032,7 +3032,7 @@ optimize_memcpy (gimple_stmt_iterator *gsip, tree dest, tree src, tree len) gimple *defstmt = SSA_NAME_DEF_STMT (vuse); tree src2 = NULL_TREE, len2 = NULL_TREE; - HOST_WIDE_INT offset, offset2; + poly_int64 offset, offset2; tree val = integer_zero_node; if (gimple_store_p (defstmt) && gimple_assign_single_p (defstmt) @@ -3064,16 +3064,16 @@ optimize_memcpy (gimple_stmt_iterator *gsip, tree dest, tree src, tree len) ? DECL_SIZE_UNIT (TREE_OPERAND (src2, 1)) : TYPE_SIZE_UNIT (TREE_TYPE (src2))); if (len == NULL_TREE - || TREE_CODE (len) != INTEGER_CST + || !poly_int_tree_p (len) || len2 == NULL_TREE - || TREE_CODE (len2) != INTEGER_CST) + || !poly_int_tree_p (len2)) return; src = get_addr_base_and_unit_offset (src, &offset); src2 = get_addr_base_and_unit_offset (src2, &offset2); if (src == NULL_TREE || src2 == NULL_TREE - || offset < offset2) + || maybe_lt (offset, offset2)) return; if (!operand_equal_p (src, src2, 0)) @@ -3082,7 +3082,8 @@ optimize_memcpy (gimple_stmt_iterator *gsip, tree dest, tree src, tree len) /* [ src + offset2, src + offset2 + len2 - 1 ] is set to val. Make sure that [ src + offset, src + offset + len - 1 ] is a subset of that. */ - if (wi::to_offset (len) + (offset - offset2) > wi::to_offset (len2)) + if (maybe_gt (wi::to_poly_offset (len) + (offset - offset2), + wi::to_poly_offset (len2))) return; if (dump_file && (dump_flags & TDF_DETAILS)) |