diff options
author | Andrew Pinski <pinskia@physics.uc.edu> | 2005-11-22 19:22:21 +0000 |
---|---|---|
committer | Andrew Pinski <pinskia@gcc.gnu.org> | 2005-11-22 11:22:21 -0800 |
commit | d998dd65ec93baa138c10fe1bd11da1ba19b439e (patch) | |
tree | 6be3829aae3c9a7f5466fdc27a465d827c850835 | |
parent | 1c991891912695c2e6f536bb1d453e6fec331504 (diff) | |
download | gcc-d998dd65ec93baa138c10fe1bd11da1ba19b439e.zip gcc-d998dd65ec93baa138c10fe1bd11da1ba19b439e.tar.gz gcc-d998dd65ec93baa138c10fe1bd11da1ba19b439e.tar.bz2 |
re PR middle-end/23606 (fold does not fold (type)(a == b) into a == b (with type as the type))
2005-11-22 Andrew Pinski <pinskia@physics.uc.edu>
PR middle-end/23606
* fold-const.c (fold_unary) <case NOP_EXPR, CONVERT_EXPR>: For
COMPARISON_CLASS_P and an integral types create create a new
expression with the new type and fold that.
From-SVN: r107370
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/fold-const.c | 6 |
2 files changed, 13 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3a81593..f16711a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,12 @@ 2005-11-22 Andrew Pinski <pinskia@physics.uc.edu> + PR middle-end/23606 + * fold-const.c (fold_unary) <case NOP_EXPR, CONVERT_EXPR>: For + COMPARISON_CLASS_P and an integral types create create a new + expression with the new type and fold that. + +2005-11-22 Andrew Pinski <pinskia@physics.uc.edu> + PR target/24988 * config/rs6000/darwin.h (TARGET_OS_CPP_BUILTINS): Remove call to SUBTARGET_OS_CPP_BUILTINS. diff --git a/gcc/fold-const.c b/gcc/fold-const.c index e7f550b..2d750f6 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -6771,6 +6771,12 @@ fold_unary (enum tree_code code, tree type, tree op0) case FIX_ROUND_EXPR: if (TREE_TYPE (op0) == type) return op0; + + /* If we have (type) (a CMP b) and type is an integal type, return + new expression involving the new type. */ + if (COMPARISON_CLASS_P (op0) && INTEGRAL_TYPE_P (type)) + return fold_build2 (TREE_CODE (op0), type, TREE_OPERAND (op0, 0), + TREE_OPERAND (op0, 1)); /* Handle cases of two conversions in a row. */ if (TREE_CODE (op0) == NOP_EXPR |