summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2006-04-03 17:08:42 +0000
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2006-04-03 17:08:42 +0000
commitd76551d98c1ded3ab59400d7dff1dc1d8ebab1f1 (patch)
tree84dc8a6be3eb377b00a9178a3c11bd830efbe958
parent2b61c936b746c0352704acc5a839e01c9f0620a8 (diff)
downloadgcc-d76551d98c1ded3ab59400d7dff1dc1d8ebab1f1.tar.gz
* tree-ssa-dom.c (propagate_rhs_into_lhs): Avoid useless folding
and operand scanning in some common cases. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@112642 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/tree-ssa-dom.c55
2 files changed, 50 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d8c8dc199a8..b264035e7c7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2006-04-03 Jeff Law <law@redhat.com>
+
+ * tree-ssa-dom.c (propagate_rhs_into_lhs): Avoid useless folding
+ and operand scanning in some common cases.
+
2006-04-03 Paolo Bonzini <bonzini@gnu.org>
Dale Johannesen <dalej@apple.com>
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index f631eaaccd9..45034dd2ce7 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -2155,10 +2155,46 @@ propagate_rhs_into_lhs (tree stmt, tree lhs, tree rhs, bitmap interesting_names)
fprintf (dump_file, "\n");
}
- /* Propagate, fold and update the statement. Note this may
- expose new const/copy propagation opportunities as well
- collapse control statements. */
+ /* Propagate the RHS into this use of the LHS. */
propagate_value (use_p, rhs);
+
+ /* Special cases to avoid useless calls into the folding
+ routines, operand scanning, etc.
+
+ First, propagation into a PHI may cause the PHI to become
+ a degenerate, so mark the PHI as interesting. No other
+ actions are necessary.
+
+ Second, if we're propagating a virtual operand and the
+ propagation does not change the underlying _DECL node for
+ the virtual operand, then no further actions are necessary. */
+ if (TREE_CODE (use_stmt) == PHI_NODE
+ || (! is_gimple_reg (lhs)
+ && TREE_CODE (rhs) == SSA_NAME
+ && SSA_NAME_VAR (lhs) == SSA_NAME_VAR (rhs)))
+ {
+ /* Dump details. */
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, " Updated statement:");
+ print_generic_expr (dump_file, use_stmt, dump_flags);
+ fprintf (dump_file, "\n");
+ }
+
+ /* Propagation into a PHI may expose new degenerate PHIs,
+ so mark the result of the PHI as interesting. */
+ if (TREE_CODE (use_stmt) == PHI_NODE)
+ {
+ tree result = get_lhs_or_phi_result (use_stmt);
+ bitmap_set_bit (interesting_names, SSA_NAME_VERSION (result));
+ }
+ continue;
+ }
+
+ /* From this point onward we are propagating into a
+ real statement. Folding may (or may not) be possible,
+ we may expose new operands, expose dead EH edges,
+ etc. */
fold_stmt_inplace (use_stmt);
/* Sometimes propagation can expose new operands to the
@@ -2189,13 +2225,12 @@ propagate_rhs_into_lhs (tree stmt, tree lhs, tree rhs, bitmap interesting_names)
fprintf (dump_file, " Flagged to clear EH edges.\n");
}
- /* Propagation may expose new degenerate PHIs or
- trivial copy/constant propagation opportunities. */
- if (TREE_CODE (use_stmt) == PHI_NODE
- || (TREE_CODE (use_stmt) == MODIFY_EXPR
- && TREE_CODE (TREE_OPERAND (use_stmt, 0)) == SSA_NAME
- && (TREE_CODE (TREE_OPERAND (use_stmt, 1)) == SSA_NAME
- || is_gimple_min_invariant (TREE_OPERAND (use_stmt, 1)))))
+ /* Propagation may expose new trivial copy/constant propagation
+ opportunities. */
+ if (TREE_CODE (use_stmt) == MODIFY_EXPR
+ && TREE_CODE (TREE_OPERAND (use_stmt, 0)) == SSA_NAME
+ && (TREE_CODE (TREE_OPERAND (use_stmt, 1)) == SSA_NAME
+ || is_gimple_min_invariant (TREE_OPERAND (use_stmt, 1))))
{
tree result = get_lhs_or_phi_result (use_stmt);
bitmap_set_bit (interesting_names, SSA_NAME_VERSION (result));