aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-ccp.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-ssa-ccp.c')
-rw-r--r--gcc/tree-ssa-ccp.c11
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))