Skip to content

Commit 5e14e1c

Browse files
author
law
committed
* tree-ssa-dom.c (record_equivalences_from_phis): Fix handling
of degenerates resulting from ignoring an edge. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@254938 138bc75d-0d04-0410-961f-82ee72b054a4
1 parent 9abc6a0 commit 5e14e1c

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

gcc/ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2017-11-19 Jeff Law <[email protected]>
2+
3+
* tree-ssa-dom.c (record_equivalences_from_phis): Fix handling
4+
of degenerates resulting from ignoring an edge.
5+
16
2017-11-19 Jan Hubicka <[email protected]>
27

38
PR ipa/81360

gcc/tree-ssa-dom.c

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,6 +1011,7 @@ record_equivalences_from_phis (basic_block bb)
10111011
tree rhs = NULL;
10121012
size_t i;
10131013

1014+
bool ignored_phi_arg = false;
10141015
for (i = 0; i < gimple_phi_num_args (phi); i++)
10151016
{
10161017
tree t = gimple_phi_arg_def (phi, i);
@@ -1021,10 +1022,14 @@ record_equivalences_from_phis (basic_block bb)
10211022
if (lhs == t)
10221023
continue;
10231024

1024-
/* If the associated edge is not marked as executable, then it
1025-
can be ignored. */
1025+
/* We want to track if we ignored any PHI arguments because
1026+
their associated edges were not executable. This impacts
1027+
whether or not we can use any equivalence we might discover. */
10261028
if ((gimple_phi_arg_edge (phi, i)->flags & EDGE_EXECUTABLE) == 0)
1027-
continue;
1029+
{
1030+
ignored_phi_arg = true;
1031+
continue;
1032+
}
10281033

10291034
t = dom_valueize (t);
10301035

@@ -1049,9 +1054,15 @@ record_equivalences_from_phis (basic_block bb)
10491054
a useful equivalence. We do not need to record unwind data for
10501055
this, since this is a true assignment and not an equivalence
10511056
inferred from a comparison. All uses of this ssa name are dominated
1052-
by this assignment, so unwinding just costs time and space. */
1057+
by this assignment, so unwinding just costs time and space.
1058+
1059+
Note that if we ignored a PHI argument and the resulting equivalence
1060+
is SSA_NAME = SSA_NAME. Then we can not use the equivalence as the
1061+
uses of the LHS SSA_NAME are not necessarily dominated by the
1062+
assignment of the RHS SSA_NAME. */
10531063
if (i == gimple_phi_num_args (phi)
1054-
&& may_propagate_copy (lhs, rhs))
1064+
&& may_propagate_copy (lhs, rhs)
1065+
&& (!ignored_phi_arg || TREE_CODE (rhs) != SSA_NAME))
10551066
set_ssa_name_value (lhs, rhs);
10561067
}
10571068
}

0 commit comments

Comments
 (0)