Commit 6a97296a by Diego Novillo Committed by Diego Novillo

fold-const.c (fold): Avoid non INTEGER_TYPEs when widening operands in an integer comparison.

	* fold-const.c (fold): Avoid non INTEGER_TYPEs when widening
	operands in an integer comparison.
	* tree-cfg.c (find_taken_edge): Call fold() to determine
	whether the predicate is known.

From-SVN: r87855
parent 3b620440
2004-09-22 Diego Novillo <dnovillo@redhat.com>
* fold-const.c (fold): Avoid non INTEGER_TYPEs when widening
operands in an integer comparison.
* tree-cfg.c (find_taken_edge): Call fold() to determine
whether the predicate is known.
2004-09-22 Kelley Cook <kcook@gcc.gnu.org>
* aclocal.m4: Import AM_PROG_CC_C_O and AM_AUX_DIR_EXPAND.
......
......@@ -8290,6 +8290,7 @@ fold (tree expr)
&& (t1 = get_unwidened (arg1, TREE_TYPE (tem))) != 0
&& (TREE_TYPE (t1) == TREE_TYPE (tem)
|| (TREE_CODE (t1) == INTEGER_CST
&& TREE_CODE (TREE_TYPE (tem)) == INTEGER_TYPE
&& int_fits_type_p (t1, TREE_TYPE (tem)))))
return fold (build2 (code, type, tem,
fold_convert (TREE_TYPE (tem), t1)));
......
......@@ -2001,22 +2001,9 @@ find_taken_edge (basic_block bb, tree val)
gcc_assert (is_ctrl_stmt (stmt));
/* If VAL is a predicate of the form N RELOP N, where N is an
SSA_NAME, we can always determine its truth value (except when
doing floating point comparisons that may involve NaNs). */
if (val
&& COMPARISON_CLASS_P (val)
&& TREE_OPERAND (val, 0) == TREE_OPERAND (val, 1)
&& TREE_CODE (TREE_OPERAND (val, 0)) == SSA_NAME
&& (TREE_CODE (TREE_TYPE (TREE_OPERAND (val, 0))) != REAL_TYPE
|| !HONOR_NANS (TYPE_MODE (TREE_TYPE (TREE_OPERAND (val, 0))))))
{
enum tree_code code = TREE_CODE (val);
if (code == EQ_EXPR || code == LE_EXPR || code == GE_EXPR)
val = boolean_true_node;
else if (code == LT_EXPR || code == GT_EXPR || code == NE_EXPR)
val = boolean_false_node;
}
SSA_NAME, we can usually determine its truth value. */
if (val && COMPARISON_CLASS_P (val))
val = fold (val);
/* If VAL is not a constant, we can't determine which edge might
be taken. */
......
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