aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-dom.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2014-06-26 11:29:34 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2014-06-26 11:29:34 +0000
commit73c7d6bc25d9bb86bdb81283d237a5b94607ac8c (patch)
tree1c939200ec3ae5f46afa0de763e00de9f4d4e65b /gcc/tree-ssa-dom.c
parent1d805a56b6a5c2252baccd257e00a719a22ad143 (diff)
downloadgcc-73c7d6bc25d9bb86bdb81283d237a5b94607ac8c.zip
gcc-73c7d6bc25d9bb86bdb81283d237a5b94607ac8c.tar.gz
gcc-73c7d6bc25d9bb86bdb81283d237a5b94607ac8c.tar.bz2
re PR tree-optimization/61607 (DOM missed jump threading and destroyed loops)
2014-06-26 Richard Biener <rguenther@suse.de> PR tree-optimization/61607 * tree-ssa-copy.c (copy_prop_visit_phi_node): Adjust comment explaining why we restrict copies on loop depth. * tree-ssa-dom.c (cprop_operand): Remove restriction on on loop depth. (record_equivalences_from_phis): Instead add it here. * gcc.dg/tree-ssa/ssa-dom-thread-5.c: New testcase. From-SVN: r212026
Diffstat (limited to 'gcc/tree-ssa-dom.c')
-rw-r--r--gcc/tree-ssa-dom.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index 62444b2..795ed09 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -1234,7 +1234,13 @@ record_equivalences_from_phis (basic_block bb)
this, since this is a true assignment and not an equivalence
inferred from a comparison. All uses of this ssa name are dominated
by this assignment, so unwinding just costs time and space. */
- if (i == gimple_phi_num_args (phi) && may_propagate_copy (lhs, rhs))
+ if (i == gimple_phi_num_args (phi)
+ && may_propagate_copy (lhs, rhs)
+ /* Do not propagate copies if the propagated value is at a deeper loop
+ depth than the propagatee. Otherwise, this may introduce uses
+ of loop variant variables outside of their loops and prevent
+ coalescing opportunities. */
+ && !(loop_depth_of_name (rhs) > loop_depth_of_name (lhs)))
set_ssa_name_value (lhs, rhs);
}
}
@@ -2247,14 +2253,6 @@ cprop_operand (gimple stmt, use_operand_p op_p)
if (!may_propagate_copy (op, val))
return;
- /* Do not propagate copies if the propagated value is at a deeper loop
- depth than the propagatee. Otherwise, this may move loop variant
- variables outside of their loops and prevent coalescing
- opportunities. If the value was loop invariant, it will be hoisted
- by LICM and exposed for copy propagation. */
- if (loop_depth_of_name (val) > loop_depth_of_name (op))
- return;
-
/* Do not propagate copies into simple IV increment statements.
See PR23821 for how this can disturb IV analysis. */
if (TREE_CODE (val) != INTEGER_CST