diff options
author | Bin Cheng <bin.cheng@arm.com> | 2017-08-01 09:28:18 +0000 |
---|---|---|
committer | Bin Cheng <amker@gcc.gnu.org> | 2017-08-01 09:28:18 +0000 |
commit | 5e19d4371e4e2c7e8251f9f560abe4c43208e63a (patch) | |
tree | 2c36746342cba0e2f34acd02755cf06afc325d81 /gcc/fold-const.c | |
parent | 7061cfc027e29b6d276ef5e09835c93899cfd132 (diff) | |
download | gcc-5e19d4371e4e2c7e8251f9f560abe4c43208e63a.zip gcc-5e19d4371e4e2c7e8251f9f560abe4c43208e63a.tar.gz gcc-5e19d4371e4e2c7e8251f9f560abe4c43208e63a.tar.bz2 |
tree.h (POINTER_TYPE_OVERFLOW_UNDEFINED): Delete.
* tree.h (POINTER_TYPE_OVERFLOW_UNDEFINED): Delete.
* fold-const.c (fold_comparison, fold_binary_loc): Delete use of
above macro.
* match.pd: Ditto in address comparison pattern.
gcc/testsuite
* gcc.dg/no-strict-overflow-7.c: Revise comment and test string.
* gcc.dg/tree-ssa/pr81388-1.c: Ditto.
From-SVN: r250765
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 524208a..eeeff1e 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -8458,14 +8458,9 @@ fold_comparison (location_t loc, enum tree_code code, tree type, { /* We can fold this expression to a constant if the non-constant offset parts are equal. */ - if ((offset0 == offset1 - || (offset0 && offset1 - && operand_equal_p (offset0, offset1, 0))) - && (equality_code - || (indirect_base0 - && (DECL_P (base0) || CONSTANT_CLASS_P (base0))) - || POINTER_TYPE_OVERFLOW_UNDEFINED)) - + if (offset0 == offset1 + || (offset0 && offset1 + && operand_equal_p (offset0, offset1, 0))) { if (!equality_code && bitpos0 != bitpos1 @@ -8500,11 +8495,7 @@ fold_comparison (location_t loc, enum tree_code code, tree type, because pointer arithmetic is restricted to retain within an object and overflow on pointer differences is undefined as of 6.5.6/8 and /9 with respect to the signed ptrdiff_t. */ - else if (bitpos0 == bitpos1 - && (equality_code - || (indirect_base0 - && (DECL_P (base0) || CONSTANT_CLASS_P (base0))) - || POINTER_TYPE_OVERFLOW_UNDEFINED)) + else if (bitpos0 == bitpos1) { /* By converting to signed sizetype we cover middle-end pointer arithmetic which operates on unsigned pointer types of size @@ -9590,7 +9581,7 @@ fold_binary_loc (location_t loc, /* With undefined overflow prefer doing association in a type which wraps on overflow, if that is one of the operand types. */ - if ((POINTER_TYPE_P (type) && POINTER_TYPE_OVERFLOW_UNDEFINED) + if (POINTER_TYPE_P (type) || (INTEGRAL_TYPE_P (type) && !TYPE_OVERFLOW_WRAPS (type))) { if (INTEGRAL_TYPE_P (TREE_TYPE (arg0)) @@ -9604,7 +9595,7 @@ fold_binary_loc (location_t loc, /* With undefined overflow we can only associate constants with one variable, and constants whose association doesn't overflow. */ - if ((POINTER_TYPE_P (atype) && POINTER_TYPE_OVERFLOW_UNDEFINED) + if (POINTER_TYPE_P (atype) || (INTEGRAL_TYPE_P (atype) && !TYPE_OVERFLOW_WRAPS (atype))) { if (var0 && var1) |