summaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2002-12-23 14:43:28 +0000
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2002-12-23 14:43:28 +0000
commite420c537d0aeb03e6946b1af996d69785c1f7660 (patch)
tree31685ad42eeb50810729dd451ba7b19f425a95a3 /gcc/tree.c
parentacd10ceeac6f0cf144671a7a9a6ec2dc05466073 (diff)
downloadgcc-e420c537d0aeb03e6946b1af996d69785c1f7660.tar.gz
* tree.c (save_expr): Allow either side of a dyadic operand to be
constant. * doc/portability.texi (portability): Update portability goals. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@60435 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index b2b336b9561..f2fc48fd8ce 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -1363,12 +1363,23 @@ save_expr (expr)
a constant, it will be more efficient to not make another SAVE_EXPR since
it will allow better simplification and GCSE will be able to merge the
computations if they actualy occur. */
- for (inner = t;
- (TREE_CODE_CLASS (TREE_CODE (inner)) == '1'
- || (TREE_CODE_CLASS (TREE_CODE (inner)) == '2'
- && TREE_CONSTANT (TREE_OPERAND (inner, 1))));
- inner = TREE_OPERAND (inner, 0))
- ;
+ inner = t;
+ while (1)
+ {
+ if (TREE_CODE_CLASS (TREE_CODE (inner)) == '1')
+ inner = TREE_OPERAND (inner, 0);
+ else if (TREE_CODE_CLASS (TREE_CODE (inner)) == '2')
+ {
+ if (TREE_CONSTANT (TREE_OPERAND (inner, 1)))
+ inner = TREE_OPERAND (inner, 0);
+ else if (TREE_CONSTANT (TREE_OPERAND (inner, 0)))
+ inner = TREE_OPERAND (inner, 1);
+ else
+ break;
+ }
+ else
+ break;
+ }
/* If the tree evaluates to a constant, then we don't want to hide that
fact (i.e. this allows further folding, and direct checks for constants).
@@ -1377,7 +1388,8 @@ save_expr (expr)
literal node. */
if (TREE_CONSTANT (inner)
|| (TREE_READONLY (inner) && ! TREE_SIDE_EFFECTS (inner))
- || TREE_CODE (inner) == SAVE_EXPR || TREE_CODE (inner) == ERROR_MARK)
+ || TREE_CODE (inner) == SAVE_EXPR
+ || TREE_CODE (inner) == ERROR_MARK)
return t;
/* If T contains a PLACEHOLDER_EXPR, we must evaluate it each time, since