diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-05-10 07:58:27 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-05-10 07:58:27 +0000 |
commit | 5a1fe2db4de27e5d885582b199332d5672e2da16 (patch) | |
tree | 1b55fc7996845f84a927496e5f0f6f7aa9d75d19 /gcc/fold-const.c | |
parent | 7b46887f06a1be787421e8811cf92473b7d00ecd (diff) | |
download | gcc-5a1fe2db4de27e5d885582b199332d5672e2da16.tar.gz |
2012-05-10 Richard Guenther <rguenther@suse.de>
ada/
* gcc-interface/cuintp.c (UI_From_gnu): Remove TYPE_IS_SIZETYPE use.
c-family/
* c-common.c (c_sizeof_or_alignof_type): Remove assert and
adjust commentary about TYPE_IS_SIZETYPE types.
* tree.h (TYPE_IS_SIZETYPE): Remove.
* fold-const.c (int_const_binop_1): Remove TYPE_IS_SIZETYPE use.
(extract_muldiv_1): Likewise.
* gimple.c (gtc_visit): Likewise.
(gimple_types_compatible_p): Likewise.
(iterative_hash_canonical_type): Likewise.
(gimple_canonical_types_compatible_p): Likewise.
* gimplify.c (gimplify_one_sizepos): Likewise.
* print-tree.c (print_node): Likewise.
* stor-layout.c (initialize_sizetypes): Do not set TYPE_IS_SIZETYPE.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@187363 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 5bb75d490d9..c68db739ae9 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -940,8 +940,6 @@ int_const_binop_1 (enum tree_code code, const_tree arg1, const_tree arg2, tree t; tree type = TREE_TYPE (arg1); bool uns = TYPE_UNSIGNED (type); - bool is_sizetype - = (TREE_CODE (type) == INTEGER_TYPE && TYPE_IS_SIZETYPE (type)); bool overflow = false; op1 = tree_to_double_int (arg1); @@ -1077,7 +1075,7 @@ int_const_binop_1 (enum tree_code code, const_tree arg1, const_tree arg2, } t = force_fit_type_double (TREE_TYPE (arg1), res, overflowable, - ((!uns || is_sizetype) && overflow) + (!uns && overflow) | TREE_OVERFLOW (arg1) | TREE_OVERFLOW (arg2)); return t; @@ -5639,8 +5637,6 @@ extract_muldiv_1 (tree t, tree c, enum tree_code code, tree wide_type, /* ... and has wrapping overflow, and its type is smaller than ctype, then we cannot pass through as widening. */ && ((TYPE_OVERFLOW_WRAPS (TREE_TYPE (op0)) - && ! (TREE_CODE (TREE_TYPE (op0)) == INTEGER_TYPE - && TYPE_IS_SIZETYPE (TREE_TYPE (op0))) && (TYPE_PRECISION (ctype) > TYPE_PRECISION (TREE_TYPE (op0)))) /* ... or this is a truncation (t is narrower than op0), @@ -5818,7 +5814,6 @@ extract_muldiv_1 (tree t, tree c, enum tree_code code, tree wide_type, the operation since it will change the result if the original computation overflowed. */ if (TYPE_UNSIGNED (ctype) - && ! (TREE_CODE (ctype) == INTEGER_TYPE && TYPE_IS_SIZETYPE (ctype)) && ctype != type) break; @@ -5844,14 +5839,8 @@ extract_muldiv_1 (tree t, tree c, enum tree_code code, tree wide_type, (C * 8) % 4 since we know that's zero. */ if ((code == TRUNC_MOD_EXPR || code == CEIL_MOD_EXPR || code == FLOOR_MOD_EXPR || code == ROUND_MOD_EXPR) - /* If the multiplication can overflow we cannot optimize this. - ??? Until we can properly mark individual operations as - not overflowing we need to treat sizetype special here as - stor-layout relies on this opimization to make - DECL_FIELD_BIT_OFFSET always a constant. */ - && (TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (t)) - || (TREE_CODE (TREE_TYPE (t)) == INTEGER_TYPE - && TYPE_IS_SIZETYPE (TREE_TYPE (t)))) + /* If the multiplication can overflow we cannot optimize this. */ + && TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (t)) && TREE_CODE (TREE_OPERAND (t, 1)) == INTEGER_CST && integer_zerop (const_binop (TRUNC_MOD_EXPR, op1, c))) { @@ -5893,16 +5882,11 @@ extract_muldiv_1 (tree t, tree c, enum tree_code code, tree wide_type, (tree_to_double_int (c), TYPE_PRECISION (ctype), TYPE_UNSIGNED (ctype)), false, &overflow_p); - overflow_p = (((!TYPE_UNSIGNED (ctype) - || (TREE_CODE (ctype) == INTEGER_TYPE - && TYPE_IS_SIZETYPE (ctype))) - && overflow_p) + overflow_p = ((!TYPE_UNSIGNED (ctype) && overflow_p) | TREE_OVERFLOW (c) | TREE_OVERFLOW (op1)); if (!double_int_fits_to_tree_p (ctype, mul) && ((TYPE_UNSIGNED (ctype) && tcode != MULT_EXPR) - || !TYPE_UNSIGNED (ctype) - || (TREE_CODE (ctype) == INTEGER_TYPE - && TYPE_IS_SIZETYPE (ctype)))) + || !TYPE_UNSIGNED (ctype))) overflow_p = 1; if (!overflow_p) return fold_build2 (tcode, ctype, fold_convert (ctype, op0), |