Commit cbc75e62 by Jeff Law Committed by Jeff Law

tree-ssa-dom.c (propagate_rhs_into_lhs): Avoid useless folding and operand…

tree-ssa-dom.c (propagate_rhs_into_lhs): Avoid useless folding and operand scanning in some common cases.


        * tree-ssa-dom.c (propagate_rhs_into_lhs): Avoid useless folding
        and operand scanning in some common cases.

From-SVN: r112642
parent e4724785
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> 2006-04-03 Paolo Bonzini <bonzini@gnu.org>
Dale Johannesen <dalej@apple.com> Dale Johannesen <dalej@apple.com>
......
...@@ -2155,10 +2155,46 @@ propagate_rhs_into_lhs (tree stmt, tree lhs, tree rhs, bitmap interesting_names) ...@@ -2155,10 +2155,46 @@ propagate_rhs_into_lhs (tree stmt, tree lhs, tree rhs, bitmap interesting_names)
fprintf (dump_file, "\n"); fprintf (dump_file, "\n");
} }
/* Propagate, fold and update the statement. Note this may /* Propagate the RHS into this use of the LHS. */
expose new const/copy propagation opportunities as well
collapse control statements. */
propagate_value (use_p, rhs); 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); fold_stmt_inplace (use_stmt);
/* Sometimes propagation can expose new operands to the /* 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) ...@@ -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"); fprintf (dump_file, " Flagged to clear EH edges.\n");
} }
/* Propagation may expose new degenerate PHIs or /* Propagation may expose new trivial copy/constant propagation
trivial copy/constant propagation opportunities. */ opportunities. */
if (TREE_CODE (use_stmt) == PHI_NODE if (TREE_CODE (use_stmt) == MODIFY_EXPR
|| (TREE_CODE (use_stmt) == MODIFY_EXPR && TREE_CODE (TREE_OPERAND (use_stmt, 0)) == SSA_NAME
&& TREE_CODE (TREE_OPERAND (use_stmt, 0)) == SSA_NAME && (TREE_CODE (TREE_OPERAND (use_stmt, 1)) == SSA_NAME
&& (TREE_CODE (TREE_OPERAND (use_stmt, 1)) == SSA_NAME || is_gimple_min_invariant (TREE_OPERAND (use_stmt, 1))))
|| is_gimple_min_invariant (TREE_OPERAND (use_stmt, 1)))))
{ {
tree result = get_lhs_or_phi_result (use_stmt); tree result = get_lhs_or_phi_result (use_stmt);
bitmap_set_bit (interesting_names, SSA_NAME_VERSION (result)); bitmap_set_bit (interesting_names, SSA_NAME_VERSION (result));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment