summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-phiopt.c
diff options
context:
space:
mode:
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2004-05-19 18:31:35 +0000
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2004-05-19 18:31:35 +0000
commit50737d202cbfd3dd4e214b795baa62b32ceaa5b6 (patch)
tree8caf03eb5bb52d5bd46e5a0506f75d33507b2517 /gcc/tree-ssa-phiopt.c
parenta6629703d0608f506dfc32c20e017d6b0c6ce535 (diff)
downloadgcc-50737d202cbfd3dd4e214b795baa62b32ceaa5b6.tar.gz
* tree-ssa-phiopt.c (value_replacement): Handle the case where
the desired edge out of COND_BLOCK reaches OTHER_BLOCK rather than BB directly. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@82031 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-phiopt.c')
-rw-r--r--gcc/tree-ssa-phiopt.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c
index 7648bc090d6..fa342700d65 100644
--- a/gcc/tree-ssa-phiopt.c
+++ b/gcc/tree-ssa-phiopt.c
@@ -464,7 +464,20 @@ value_replacement (basic_block bb, tree phi, tree arg0, tree arg1)
edge e;
tree arg;
+ /* For NE_EXPR, we want to build an assignment result = arg where
+ arg is the PHI argument associated with the true edge. For
+ EQ_EXPR we want the PHI argument associated with the false edge. */
e = (TREE_CODE (cond) == NE_EXPR ? true_edge : false_edge);
+
+ /* Unfortunately, E may not reach BB (it may instead have gone to
+ OTHER_BLOCK). If that is the case, then we want the single outgoing
+ edge from OTHER_BLOCK which reaches BB and represents the desired
+ path from COND_BLOCK. */
+ if (e->dest == other_block)
+ e = e->dest->succ;
+
+ /* Now we know the incoming edge to BB that has the argument for the
+ RHS of our new assignment statement. */
if (PHI_ARG_EDGE (phi, 0) == e)
arg = arg0;
else