Commit 87f2a9f5 by Roger Sayle Committed by Roger Sayle

tree.h (TREE_OVERFLOW): Make this flag/predicate specific to constant nodes, i.e.


	* tree.h (TREE_OVERFLOW): Make this flag/predicate specific to
	constant nodes, i.e. INTEGER_CST, REAL_CST, etc...
	* tree-vrp.c (compare_values): Only check TREE_OVERFLOW for
	integer constant comparisons.

ada/
	* utils.c (max_size): Only test for TREE_OVERFLOW on INTEGER_CST
	nodes.

From-SVN: r107870
parent cf84391c
2005-12-01 Roger Sayle <roger@eyesopen.com>
* tree.h (TREE_OVERFLOW): Make this flag/predicate specific to
constant nodes, i.e. INTEGER_CST, REAL_CST, etc...
* tree-vrp.c (compare_values): Only check TREE_OVERFLOW for
integer constant comparisons.
2005-12-02 Jon Grimm <jgrimm2@us.ibm.com> 2005-12-02 Jon Grimm <jgrimm2@us.ibm.com>
Janis Johnson <janis187@us.ibm.com> Janis Johnson <janis187@us.ibm.com>
David Edelsohn <dje@watson.ibm.com> David Edelsohn <dje@watson.ibm.com>
......
2005-12-01 Roger Sayle <roger@eyesopen.com>
* utils.c (max_size): Only test for TREE_OVERFLOW on INTEGER_CST
nodes.
2005-11-23 Laurent GUERBY <laurent@guerby.net> 2005-11-23 Laurent GUERBY <laurent@guerby.net>
* mlib-prj.adb (Build_Library): Initialize Delete. * mlib-prj.adb (Build_Library): Initialize Delete.
......
...@@ -2031,12 +2031,19 @@ max_size (tree exp, bool max_p) ...@@ -2031,12 +2031,19 @@ max_size (tree exp, bool max_p)
Likewise, handle a MINUS_EXPR or PLUS_EXPR with the LHS Likewise, handle a MINUS_EXPR or PLUS_EXPR with the LHS
overflowing or the maximum possible value and the RHS overflowing or the maximum possible value and the RHS
a variable. */ a variable. */
if (max_p && code == MIN_EXPR && TREE_OVERFLOW (rhs)) if (max_p
&& code == MIN_EXPR
&& TREE_CODE (rhs) == INTEGER_CST
&& TREE_OVERFLOW (rhs))
return lhs; return lhs;
else if (max_p && code == MIN_EXPR && TREE_OVERFLOW (lhs)) else if (max_p
&& code == MIN_EXPR
&& TREE_CODE (lhs) == INTEGER_CST
&& TREE_OVERFLOW (lhs))
return rhs; return rhs;
else if ((code == MINUS_EXPR || code == PLUS_EXPR) else if ((code == MINUS_EXPR || code == PLUS_EXPR)
&& ((TREE_CONSTANT (lhs) && TREE_OVERFLOW (lhs)) && ((TREE_CODE (lhs) == INTEGER_CST
&& TREE_OVERFLOW (lhs))
|| operand_equal_p (lhs, TYPE_MAX_VALUE (type), 0)) || operand_equal_p (lhs, TYPE_MAX_VALUE (type), 0))
&& !TREE_CONSTANT (rhs)) && !TREE_CONSTANT (rhs))
return lhs; return lhs;
......
...@@ -528,12 +528,14 @@ compare_values (tree val1, tree val2) ...@@ -528,12 +528,14 @@ compare_values (tree val1, tree val2)
if (!is_gimple_min_invariant (val1) || !is_gimple_min_invariant (val2)) if (!is_gimple_min_invariant (val1) || !is_gimple_min_invariant (val2))
return -2; return -2;
/* We cannot compare overflowed values. */
if (TREE_OVERFLOW (val1) || TREE_OVERFLOW (val2))
return -2;
if (!POINTER_TYPE_P (TREE_TYPE (val1))) if (!POINTER_TYPE_P (TREE_TYPE (val1)))
return tree_int_cst_compare (val1, val2); {
/* We cannot compare overflowed values. */
if (TREE_OVERFLOW (val1) || TREE_OVERFLOW (val2))
return -2;
return tree_int_cst_compare (val1, val2);
}
else else
{ {
tree t; tree t;
......
...@@ -335,7 +335,6 @@ struct tree_common GTY(()) ...@@ -335,7 +335,6 @@ struct tree_common GTY(())
TREE_OVERFLOW in TREE_OVERFLOW in
INTEGER_CST, REAL_CST, COMPLEX_CST, VECTOR_CST INTEGER_CST, REAL_CST, COMPLEX_CST, VECTOR_CST
??? and other expressions?
TREE_PUBLIC in TREE_PUBLIC in
VAR_DECL or FUNCTION_DECL or IDENTIFIER_NODE VAR_DECL or FUNCTION_DECL or IDENTIFIER_NODE
ASM_VOLATILE_P in ASM_VOLATILE_P in
...@@ -907,11 +906,9 @@ extern void tree_operand_check_failed (int, enum tree_code, ...@@ -907,11 +906,9 @@ extern void tree_operand_check_failed (int, enum tree_code,
/* In an INTEGER_CST, REAL_CST, COMPLEX_CST, or VECTOR_CST, this means /* In an INTEGER_CST, REAL_CST, COMPLEX_CST, or VECTOR_CST, this means
there was an overflow in folding, and no warning has been issued there was an overflow in folding, and no warning has been issued
for this subexpression. TREE_OVERFLOW implies TREE_CONSTANT_OVERFLOW, for this subexpression. TREE_OVERFLOW implies TREE_CONSTANT_OVERFLOW,
but not vice versa. but not vice versa. */
??? Apparently, lots of code assumes this is defined in all #define TREE_OVERFLOW(NODE) (CST_CHECK (NODE)->common.public_flag)
expressions. */
#define TREE_OVERFLOW(NODE) ((NODE)->common.public_flag)
/* In a VAR_DECL or FUNCTION_DECL, /* In a VAR_DECL or FUNCTION_DECL,
nonzero means name is to be accessible from outside this module. nonzero means name is to be accessible from outside this module.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment