diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-06-16 18:09:34 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-06-16 18:09:34 +0000 |
commit | 4c70bf73c41b6f492bcf208a69b20424954f85c6 (patch) | |
tree | 1a237f09f037eeb1745ba50100af6c885b4f29ea /gcc/tree-complex.c | |
parent | 3524624e41742e76fd93edd07e529dcc7c394b8f (diff) | |
download | gcc-4c70bf73c41b6f492bcf208a69b20424954f85c6.tar.gz |
PR tree-opt/22035
* builtins.c (fold_builtin_complex_mul): Remove.
(fold_builtin_complex_div): Remove.
(fold_builtin_1): Don't call them.
* fold-const.c (fold_complex_add, fold_complex_mult_parts,
fold_complex_mult, fold_complex_div_parts, fold_complex_div): Remove.
(fold_binary): Don't call them. Don't expand complex comparisons to
elementary comparisons.
* tree-complex.c (init_dont_simulate_again): Enhance search for
stmts that require decomposition.
(complex_visit_stmt): Handle RETURN_EXPR properly.
(create_components): Handle no referenced variables properly.
* tree.h (fold_complex_mult_parts): Remove.
(fold_complex_div_parts): Remove.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@101086 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-complex.c')
-rw-r--r-- | gcc/tree-complex.c | 62 |
1 files changed, 54 insertions, 8 deletions
diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c index 1fa76a900c3..a4c7329d3dd 100644 --- a/gcc/tree-complex.c +++ b/gcc/tree-complex.c @@ -150,7 +150,7 @@ init_dont_simulate_again (void) basic_block bb; block_stmt_iterator bsi; tree phi; - bool saw_a_complex_value = false; + bool saw_a_complex_op = false; FOR_EACH_BB (bb) { @@ -159,21 +159,62 @@ init_dont_simulate_again (void) for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi)) { - tree stmt = bsi_stmt (bsi); + tree orig_stmt, stmt, rhs = NULL; bool dsa = true; - if (TREE_CODE (stmt) == MODIFY_EXPR - && is_complex_reg (TREE_OPERAND (stmt, 0))) + orig_stmt = stmt = bsi_stmt (bsi); + switch (TREE_CODE (stmt)) { - dsa = false; - saw_a_complex_value = true; + case RETURN_EXPR: + stmt = TREE_OPERAND (stmt, 0); + if (!stmt || TREE_CODE (stmt) != MODIFY_EXPR) + break; + /* FALLTHRU */ + + case MODIFY_EXPR: + dsa = !is_complex_reg (TREE_OPERAND (stmt, 0)); + rhs = TREE_OPERAND (stmt, 1); + break; + + case COND_EXPR: + rhs = TREE_OPERAND (stmt, 0); + break; + + default: + break; } - DONT_SIMULATE_AGAIN (stmt) = dsa; + if (rhs) + switch (TREE_CODE (rhs)) + { + case EQ_EXPR: + case NE_EXPR: + rhs = TREE_OPERAND (rhs, 0); + /* FALLTHRU */ + + case PLUS_EXPR: + case MINUS_EXPR: + case MULT_EXPR: + case TRUNC_DIV_EXPR: + case CEIL_DIV_EXPR: + case FLOOR_DIV_EXPR: + case ROUND_DIV_EXPR: + case RDIV_EXPR: + case NEGATE_EXPR: + case CONJ_EXPR: + if (TREE_CODE (TREE_TYPE (rhs)) == COMPLEX_TYPE) + saw_a_complex_op = true; + break; + + default: + break; + } + + DONT_SIMULATE_AGAIN (orig_stmt) = dsa; } } - return saw_a_complex_value; + return saw_a_complex_op; } @@ -189,6 +230,8 @@ complex_visit_stmt (tree stmt, edge *taken_edge_p ATTRIBUTE_UNUSED, /* These conditions should be satisfied due to the initial filter set up in init_dont_simulate_again. */ + if (TREE_CODE (stmt) == RETURN_EXPR) + stmt = TREE_OPERAND (stmt, 0); gcc_assert (TREE_CODE (stmt) == MODIFY_EXPR); lhs = TREE_OPERAND (stmt, 0); @@ -308,6 +351,9 @@ create_components (void) size_t k, n; n = num_referenced_vars; + if (n == 0) + return; + complex_variable_components = VEC_alloc (tree, heap, 2*n); VEC_safe_grow (tree, heap, complex_variable_components, 2*n); |