diff options
author | Diego Novillo <dnovillo@redhat.com> | 2004-09-22 11:40:12 +0000 |
---|---|---|
committer | Diego Novillo <dnovillo@gcc.gnu.org> | 2004-09-22 07:40:12 -0400 |
commit | 6a97296a060b9e053ae598076ffa14c41a5b6f39 (patch) | |
tree | 72b9739f89b8a8c1be1a8932e4dea6cccbb6d17e | |
parent | 3b620440d3041539ea0150599073d829cea2982d (diff) | |
download | gcc-6a97296a060b9e053ae598076ffa14c41a5b6f39.zip gcc-6a97296a060b9e053ae598076ffa14c41a5b6f39.tar.gz gcc-6a97296a060b9e053ae598076ffa14c41a5b6f39.tar.bz2 |
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
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/fold-const.c | 1 | ||||
-rw-r--r-- | gcc/tree-cfg.c | 19 |
3 files changed, 11 insertions, 16 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7eff6e8..115f39b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +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. diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 25c84a4..c762fad 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -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))); diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 37b5710..51c4bed 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -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. */ |