aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorOlivier Hainque <hainque@act-europe.fr>2003-04-16 23:33:19 +0200
committerRichard Kenner <kenner@gcc.gnu.org>2003-04-16 17:33:19 -0400
commita9ecacf6c44316e20d54c36f84ae80dedfff09e6 (patch)
treed54db0fbb9e85319256be0471da62b0bf8117eb6 /gcc/fold-const.c
parent15b19a7dbf433b1936eecd042ce7dedbb23220f9 (diff)
downloadgcc-a9ecacf6c44316e20d54c36f84ae80dedfff09e6.zip
gcc-a9ecacf6c44316e20d54c36f84ae80dedfff09e6.tar.gz
gcc-a9ecacf6c44316e20d54c36f84ae80dedfff09e6.tar.bz2
tree.c (skip_simple_arithmetics_at, [...]): New functions.
* tree.c (skip_simple_arithmetics_at, saved_expr_p): New functions. (save_expr): Replace loop by call to skip_simple_arithmetics_at. * tree.h: Add prototypes for the two new functions. * fold-const.c (fold_binary_op_with_conditional_arg): Replace test updates introduced in the previous revision by call to saved_expr_p. * stor-layout.c (put_pending_size): Use skip_simple_arithmetics_at. From-SVN: r65702
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 065a4fc..fa64fd2 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -4568,21 +4568,19 @@ fold_binary_op_with_conditional_arg (code, type, cond, arg, cond_first_p)
false_value = convert (testtype, integer_zero_node);
}
- /* If ARG is complex we want to make sure we only evaluate
- it once. Though this is only required if it is volatile, it
- might be more efficient even if it is not. However, if we
- succeed in folding one part to a constant, we do not need
- to make this SAVE_EXPR. Since we do this optimization
- primarily to see if we do end up with constant and this
- SAVE_EXPR interferes with later optimizations, suppressing
- it when we can is important.
-
- If we are not in a function, we can't make a SAVE_EXPR, so don't
- try to do so. Don't try to see if the result is a constant
- if an arm is a COND_EXPR since we get exponential behavior
- in that case. */
-
- if (TREE_CODE (arg) == SAVE_EXPR)
+ /* If ARG is complex we want to make sure we only evaluate it once. Though
+ this is only required if it is volatile, it might be more efficient even
+ if it is not. However, if we succeed in folding one part to a constant,
+ we do not need to make this SAVE_EXPR. Since we do this optimization
+ primarily to see if we do end up with constant and this SAVE_EXPR
+ interferes with later optimizations, suppressing it when we can is
+ important.
+
+ If we are not in a function, we can't make a SAVE_EXPR, so don't try to
+ do so. Don't try to see if the result is a constant if an arm is a
+ COND_EXPR since we get exponential behavior in that case. */
+
+ if (saved_expr_p (arg))
save = 1;
else if (lhs == 0 && rhs == 0
&& !TREE_CONSTANT (arg)