OSDN Git Service

PR middle-end/49465
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 23 Jun 2011 20:26:07 +0000 (20:26 +0000)
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 23 Jun 2011 20:26:07 +0000 (20:26 +0000)
* tree-ssa-threadupate.c (fix_duplicate_block_edges): Fix condition
to detect threading through joiner block.  If there was already
an edge to the new target, then do not change the PHI nodes.

*************** fix_duplicate_block_edges (struct redire

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@175351 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/tree-ssa-threadupdate.c

index fad0966..d5c6ee5 100644 (file)
@@ -1,3 +1,10 @@
+2011-06-16  Jeff Law  <law@redhat.com>
+
+       PR middle-end/49465
+       * tree-ssa-threadupate.c (fix_duplicate_block_edges): Fix condition
+       to detect threading through joiner block.  If there was already
+       an edge to the new target, then do not change the PHI nodes.
+
 2011-06-23  Jakub Jelinek  <jakub@redhat.com>
 
        * tree-vect-data-refs.c (vect_compute_data_ref_alignment): Use
index e0335dc..0cdf846 100644 (file)
@@ -385,7 +385,7 @@ fix_duplicate_block_edges (struct redirection_data *rd,
      to keep its control statement and redirect an outgoing edge.
      Else we want to remove the control statement & edges, then create
      a new outgoing edge.  In both cases we may need to update PHIs.  */
-  if (THREAD_TARGET2 (rd->incoming_edges->e) == rd->outgoing_edge)
+  if (THREAD_TARGET2 (rd->incoming_edges->e))
     {
       edge victim;
       edge e2;
@@ -400,8 +400,11 @@ fix_duplicate_block_edges (struct redirection_data *rd,
       victim = find_edge (rd->dup_block, THREAD_TARGET (e)->dest);
       e2 = redirect_edge_and_branch (victim, THREAD_TARGET2 (e)->dest);
 
-      /* This updates the PHI at the target of the threaded edge.  */
-      copy_phi_args (e2->dest, THREAD_TARGET2 (e), e2);
+      /* If we redirected the edge, then we need to copy PHI arguments
+        at the target.  If the edge already existed (e2 != victim case),
+        then the PHIs in the target already have the correct arguments.  */
+      if (e2 == victim)
+       copy_phi_args (e2->dest, THREAD_TARGET2 (e), e2);
     }
   else
     {