diff options
author | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 1998-06-29 21:40:49 +0000 |
---|---|---|
committer | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 1998-06-29 21:40:49 +0000 |
commit | 9e042f31282adcb5f843b644184aac6ff8854d3f (patch) | |
tree | 1ec056a51ca5f7af70d48889aab8bbf9c1f9d9aa /gcc/fold-const.c | |
parent | ad8517524f837261bb29c3a684354173d4c2c47f (diff) | |
download | gcc-9e042f31282adcb5f843b644184aac6ff8854d3f.tar.gz |
* Merge from gcc2 June 9, 1998 snapshot. See ChangeLog.13 for
details.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@20808 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 7544f8b673a..8849608795a 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -3293,14 +3293,16 @@ fold_range_test (exp) && operand_equal_p (lhs, rhs, 0)) { /* If simple enough, just rewrite. Otherwise, make a SAVE_EXPR - unless we are at top level, in which case we can't do this. */ + unless we are at top level or LHS contains a PLACEHOLDER_EXPR, in + which cases we can't do this. */ if (simple_operand_p (lhs)) return build (TREE_CODE (exp) == TRUTH_ANDIF_EXPR ? TRUTH_AND_EXPR : TRUTH_OR_EXPR, TREE_TYPE (exp), TREE_OPERAND (exp, 0), TREE_OPERAND (exp, 1)); - else if (current_function_decl != 0) + else if (current_function_decl != 0 + && ! contains_placeholder_p (lhs)) { tree common = save_expr (lhs); @@ -3997,7 +3999,9 @@ fold (expr) else if ((TREE_CODE (arg1) == COND_EXPR || (TREE_CODE_CLASS (TREE_CODE (arg1)) == '<' && TREE_CODE_CLASS (code) != '<')) - && (! TREE_SIDE_EFFECTS (arg0) || current_function_decl != 0)) + && (! TREE_SIDE_EFFECTS (arg0) + || (current_function_decl != 0 + && ! contains_placeholder_p (arg0)))) { tree test, true_value, false_value; tree lhs = 0, rhs = 0; @@ -4068,7 +4072,9 @@ fold (expr) else if ((TREE_CODE (arg0) == COND_EXPR || (TREE_CODE_CLASS (TREE_CODE (arg0)) == '<' && TREE_CODE_CLASS (code) != '<')) - && (! TREE_SIDE_EFFECTS (arg1) || current_function_decl != 0)) + && (! TREE_SIDE_EFFECTS (arg1) + || (current_function_decl != 0 + && ! contains_placeholder_p (arg1)))) { tree test, true_value, false_value; tree lhs = 0, rhs = 0; @@ -4633,7 +4639,8 @@ fold (expr) if (real_onep (arg1)) return non_lvalue (convert (type, arg0)); /* x*2 is x+x */ - if (! wins && real_twop (arg1) && current_function_decl != 0) + if (! wins && real_twop (arg1) && current_function_decl != 0 + && ! contains_placeholder_p (arg0)) { tree arg = save_expr (arg0); return build (PLUS_EXPR, type, arg, arg); @@ -5656,14 +5663,16 @@ fold (expr) return t1 ? t1 : t; } - /* If this is a comparison of complex values and either or both - sizes are a COMPLEX_EXPR, it is best to split up the comparisons - and join them with a TRUTH_ANDIF_EXPR or TRUTH_ORIF_EXPR. This - may prevent needless evaluations. */ + /* If this is a comparison of complex values and either or both sides + are a COMPLEX_EXPR or COMPLEX_CST, it is best to split up the + comparisons and join them with a TRUTH_ANDIF_EXPR or TRUTH_ORIF_EXPR. + This may prevent needless evaluations. */ if ((code == EQ_EXPR || code == NE_EXPR) && TREE_CODE (TREE_TYPE (arg0)) == COMPLEX_TYPE && (TREE_CODE (arg0) == COMPLEX_EXPR - || TREE_CODE (arg1) == COMPLEX_EXPR)) + || TREE_CODE (arg1) == COMPLEX_EXPR + || TREE_CODE (arg0) == COMPLEX_CST + || TREE_CODE (arg1) == COMPLEX_CST)) { tree subtype = TREE_TYPE (TREE_TYPE (arg0)); tree real0, imag0, real1, imag1; |