aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-dom.c
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2017-11-19 13:15:45 -0700
committerJeff Law <law@gcc.gnu.org>2017-11-19 13:15:45 -0700
commit43502b83135b5a368972e6c5f57f945d002e7c50 (patch)
tree31322f916a322ae66dd935bbeb04f0da8be18bd9 /gcc/tree-ssa-dom.c
parent8a4a6d2e844df54583cd8fac181586b10f63fe25 (diff)
downloadgcc-43502b83135b5a368972e6c5f57f945d002e7c50.zip
gcc-43502b83135b5a368972e6c5f57f945d002e7c50.tar.gz
gcc-43502b83135b5a368972e6c5f57f945d002e7c50.tar.bz2
tree-ssa-dom.c (record_equivalences_from_phis): Fix handling of degenerates resulting from ignoring an edge.
* tree-ssa-dom.c (record_equivalences_from_phis): Fix handling of degenerates resulting from ignoring an edge. From-SVN: r254938
Diffstat (limited to 'gcc/tree-ssa-dom.c')
-rw-r--r--gcc/tree-ssa-dom.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index eb85b4a..916d661 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -1011,6 +1011,7 @@ record_equivalences_from_phis (basic_block bb)
tree rhs = NULL;
size_t i;
+ bool ignored_phi_arg = false;
for (i = 0; i < gimple_phi_num_args (phi); i++)
{
tree t = gimple_phi_arg_def (phi, i);
@@ -1021,10 +1022,14 @@ record_equivalences_from_phis (basic_block bb)
if (lhs == t)
continue;
- /* If the associated edge is not marked as executable, then it
- can be ignored. */
+ /* We want to track if we ignored any PHI arguments because
+ their associated edges were not executable. This impacts
+ whether or not we can use any equivalence we might discover. */
if ((gimple_phi_arg_edge (phi, i)->flags & EDGE_EXECUTABLE) == 0)
- continue;
+ {
+ ignored_phi_arg = true;
+ continue;
+ }
t = dom_valueize (t);
@@ -1049,9 +1054,15 @@ record_equivalences_from_phis (basic_block bb)
a useful equivalence. We do not need to record unwind data for
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. */
+ by this assignment, so unwinding just costs time and space.
+
+ Note that if we ignored a PHI argument and the resulting equivalence
+ is SSA_NAME = SSA_NAME. Then we can not use the equivalence as the
+ uses of the LHS SSA_NAME are not necessarily dominated by the
+ assignment of the RHS SSA_NAME. */
if (i == gimple_phi_num_args (phi)
- && may_propagate_copy (lhs, rhs))
+ && may_propagate_copy (lhs, rhs)
+ && (!ignored_phi_arg || TREE_CODE (rhs) != SSA_NAME))
set_ssa_name_value (lhs, rhs);
}
}