aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorJason Merrill <merrill@gnu.org>1995-05-11 19:25:36 +0000
committerJason Merrill <merrill@gnu.org>1995-05-11 19:25:36 +0000
commit0982a4b872aa0f8c0d3ec8f8cf66aeaf0be97380 (patch)
treed96b57b759e9164245a2d7d04c69def51160876f /gcc/fold-const.c
parentf5acdcc1786fd73accb1d303a724793d440a1434 (diff)
downloadgcc-0982a4b872aa0f8c0d3ec8f8cf66aeaf0be97380.zip
gcc-0982a4b872aa0f8c0d3ec8f8cf66aeaf0be97380.tar.gz
gcc-0982a4b872aa0f8c0d3ec8f8cf66aeaf0be97380.tar.bz2
*** empty log message ***
From-SVN: r9623
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 7c137ec..644807d 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -1741,7 +1741,8 @@ operand_equal_for_comparison_p (arg0, arg1, other)
if (operand_equal_p (arg0, arg1, 0))
return 1;
- if (! INTEGRAL_TYPE_P (TREE_TYPE (arg0)))
+ if (! INTEGRAL_TYPE_P (TREE_TYPE (arg0))
+ || ! INTEGRAL_TYPE_P (TREE_TYPE (arg1)))
return 0;
/* Duplicate what shorten_compare does to ARG1 and see if that gives the
@@ -5053,16 +5054,29 @@ fold (expr)
tree arg00 = TREE_OPERAND (arg0, 0);
tree arg01;
- if (kind0 == '1')
+ if (kind0 == '1' || code0 == TRUTH_NOT_EXPR)
return fold (build1 (code0, type,
fold (build1 (CLEANUP_POINT_EXPR,
TREE_TYPE (arg00), arg00))));
- if ((kind0 == '<' || kind0 == '2')
- && ! TREE_SIDE_EFFECTS (arg01 = TREE_OPERAND (arg0, 1)))
- return fold (build (code0, type,
- fold (build1 (CLEANUP_POINT_EXPR,
- TREE_TYPE (arg00), arg00)),
- arg01));
+
+ if (kind0 == '<' || kind0 == '2'
+ || code0 == TRUTH_ANDIF_EXPR || code0 == TRUTH_ORIF_EXPR
+ || code0 == TRUTH_AND_EXPR || code0 == TRUTH_OR_EXPR
+ || code0 == TRUTH_XOR_EXPR)
+ {
+ arg01 = TREE_OPERAND (arg0, 1);
+
+ if (! TREE_SIDE_EFFECTS (arg00))
+ return fold (build (code0, type, arg00,
+ fold (build1 (CLEANUP_POINT_EXPR,
+ TREE_TYPE (arg01), arg01))));
+
+ if (! TREE_SIDE_EFFECTS (arg01))
+ return fold (build (code0, type,
+ fold (build1 (CLEANUP_POINT_EXPR,
+ TREE_TYPE (arg00), arg00)),
+ arg01));
+ }
return t;
}