From bfc646bfc0fe67e0665c2cb2d350339cc10f0b7d Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Thu, 20 Apr 2006 10:13:12 -0600 Subject: [PATCH] re PR tree-optimization/26854 (Inordinate compile times on large routines) PR tree-optimization/26854 * tree-ssa-dse.c (dse_optimize_stmt): Avoid num_imm_uses when checking for zero or one use. * tree-ssa-dom.c (propagate_rhs_into_lhs): Similarly. * tree-cfgcleanup.c (merge_phi_nodes): Similarly. * tree-ssa-reassoc.c (negate_value): Similarly. (reassociate_bb): Similarly. From-SVN: r113120 --- gcc/ChangeLog | 10 ++++++++++ gcc/tree-cfgcleanup.c | 3 +-- gcc/tree-ssa-dom.c | 2 +- gcc/tree-ssa-dse.c | 2 +- gcc/tree-ssa-reassoc.c | 4 ++-- 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ba42b128f37a..8241b9882e17 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2006-04-20 Jeff Law + + PR tree-optimization/26854 + * tree-ssa-dse.c (dse_optimize_stmt): Avoid num_imm_uses when + checking for zero or one use. + * tree-ssa-dom.c (propagate_rhs_into_lhs): Similarly. + * tree-cfgcleanup.c (merge_phi_nodes): Similarly. + * tree-ssa-reassoc.c (negate_value): Similarly. + (reassociate_bb): Similarly. + 2006-04-20 Jakub Jelinek * c-pretty-print.c (pp_c_direct_abstract_declarator): Print diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c index fb1ea761d326..ab452c4af5a3 100644 --- a/gcc/tree-cfgcleanup.c +++ b/gcc/tree-cfgcleanup.c @@ -765,13 +765,12 @@ merge_phi_nodes (void) for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi)) { tree result = PHI_RESULT (phi); - int num_uses = num_imm_uses (result); use_operand_p imm_use; tree use_stmt; /* If the PHI's result is never used, then we can just ignore it. */ - if (num_uses == 0) + if (has_zero_uses (result)) continue; /* Get the single use of the result of this PHI node. */ diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c index 6f7c2ebad560..d99d6a0866c4 100644 --- a/gcc/tree-ssa-dom.c +++ b/gcc/tree-ssa-dom.c @@ -2318,7 +2318,7 @@ propagate_rhs_into_lhs (tree stmt, tree lhs, tree rhs, bitmap interesting_names) The maximum number of times we can re-execute the loop is bounded by the maximum number of times a given SSA_NAME appears in a single statement. */ - if (all && num_imm_uses (lhs) != 0) + if (all && !has_zero_uses (lhs)) goto repeat; /* If we were able to propagate away all uses of LHS, then diff --git a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c index 17ed1297affb..85be46961dae 100644 --- a/gcc/tree-ssa-dse.c +++ b/gcc/tree-ssa-dse.c @@ -269,7 +269,7 @@ dse_optimize_stmt (struct dom_walk_data *walk_data, /* If this virtual def does not have precisely one use, then we will not be able to eliminate STMT. */ - if (num_imm_uses (defvar) != 1) + if (! has_single_use (defvar)) { fail = true; break; diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c index 4d298fe9495d..477d8c8e4073 100644 --- a/gcc/tree-ssa-reassoc.c +++ b/gcc/tree-ssa-reassoc.c @@ -1032,7 +1032,7 @@ negate_value (tree tonegate, block_stmt_iterator *bsi) if (TREE_CODE (tonegate) == SSA_NAME && TREE_CODE (negatedef) == MODIFY_EXPR && TREE_CODE (TREE_OPERAND (negatedef, 0)) == SSA_NAME - && num_imm_uses (TREE_OPERAND (negatedef, 0)) == 1 + && has_single_use (TREE_OPERAND (negatedef, 0)) && TREE_CODE (TREE_OPERAND (negatedef, 1)) == PLUS_EXPR) { block_stmt_iterator bsi; @@ -1331,7 +1331,7 @@ reassociate_bb (basic_block bb) /* There may be no immediate uses left by the time we get here because we may have eliminated them all. */ - if (TREE_CODE (lhs) == SSA_NAME && num_imm_uses (lhs) == 0) + if (TREE_CODE (lhs) == SSA_NAME && has_zero_uses (lhs)) continue; TREE_VISITED (stmt) = 1;