mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-01-11 18:35:32 +08:00
fold-const.c (int_const_binop): Don't generate non-overflowing size-types specially.
* fold-const.c (int_const_binop): Don't generate non-overflowing size-types specially. (fold_convert_const): Likewise. From-SVN: r86321
This commit is contained in:
parent
3224beadb4
commit
fabead0613
@ -1,5 +1,9 @@
|
|||||||
2004-08-20 Nathan Sidwell <nathan@codesourcery.com>
|
2004-08-20 Nathan Sidwell <nathan@codesourcery.com>
|
||||||
|
|
||||||
|
* fold-const.c (int_const_binop): Don't generate non-overflowing
|
||||||
|
size-types specially.
|
||||||
|
(fold_convert_const): Likewise.
|
||||||
|
|
||||||
* stor-layout.c (initialize_sizetypes): Set SIZETYPE earlier,
|
* stor-layout.c (initialize_sizetypes): Set SIZETYPE earlier,
|
||||||
clear cache on copied sizetype.
|
clear cache on copied sizetype.
|
||||||
|
|
||||||
|
@ -1412,15 +1412,6 @@ int_const_binop (enum tree_code code, tree arg1, tree arg2, int notrunc)
|
|||||||
abort ();
|
abort ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If this is for a sizetype, can be represented as one (signed)
|
|
||||||
HOST_WIDE_INT word, and doesn't overflow, use size_int since it caches
|
|
||||||
constants. */
|
|
||||||
if (is_sizetype
|
|
||||||
&& ((hi == 0 && (HOST_WIDE_INT) low >= 0)
|
|
||||||
|| (hi == -1 && (HOST_WIDE_INT) low < 0))
|
|
||||||
&& overflow == 0 && ! TREE_OVERFLOW (arg1) && ! TREE_OVERFLOW (arg2))
|
|
||||||
return size_int_type (low, type);
|
|
||||||
else
|
|
||||||
t = build_int_cst (TREE_TYPE (arg1), low, hi);
|
t = build_int_cst (TREE_TYPE (arg1), low, hi);
|
||||||
|
|
||||||
if (notrunc)
|
if (notrunc)
|
||||||
@ -1783,13 +1774,6 @@ fold_convert_const (enum tree_code code, tree type, tree arg1)
|
|||||||
if (TYPE_PRECISION (type) > 2 * HOST_BITS_PER_WIDE_INT)
|
if (TYPE_PRECISION (type) > 2 * HOST_BITS_PER_WIDE_INT)
|
||||||
return NULL_TREE;
|
return NULL_TREE;
|
||||||
|
|
||||||
/* If we are trying to make a sizetype for a small integer, use
|
|
||||||
size_int to pick up cached types to reduce duplicate nodes. */
|
|
||||||
if (TREE_CODE (type) == INTEGER_TYPE && TYPE_IS_SIZETYPE (type)
|
|
||||||
&& !TREE_CONSTANT_OVERFLOW (arg1)
|
|
||||||
&& compare_tree_int (arg1, 10000) < 0)
|
|
||||||
return size_int_type (TREE_INT_CST_LOW (arg1), type);
|
|
||||||
|
|
||||||
/* Given an integer constant, make new constant with new type,
|
/* Given an integer constant, make new constant with new type,
|
||||||
appropriately sign-extended or truncated. */
|
appropriately sign-extended or truncated. */
|
||||||
t = build_int_cst (type, TREE_INT_CST_LOW (arg1),
|
t = build_int_cst (type, TREE_INT_CST_LOW (arg1),
|
||||||
|
Loading…
Reference in New Issue
Block a user