tree-phinodes.c (add_phi_arg): Turn an "if" that always triggers into gcc_assert.
authorKazu Hirata <kazu@cs.umass.edu>
Fri, 29 Oct 2004 00:48:00 +0000 (00:48 +0000)
committerKazu Hirata <kazu@gcc.gnu.org>
Fri, 29 Oct 2004 00:48:00 +0000 (00:48 +0000)
* tree-phinodes.c (add_phi_arg): Turn an "if" that always
triggers into gcc_assert.

From-SVN: r89800

gcc/ChangeLog
gcc/tree-phinodes.c

index 8cde54e11f156f3cce6d12e5be3c16304f72556f..68c121b4fee68c4f82236d854b3eeedeb3c8187f 100644 (file)
@@ -1,3 +1,8 @@
+2004-10-29  Kazu Hirata  <kazu@cs.umass.edu>
+
+       * tree-phinodes.c (add_phi_arg): Turn an "if" that always
+       triggers into gcc_assert.
+
 2004-10-28  Diego Novillo  <dnovillo@redhat.com>
 
        PR tree-optimization/16728
index fdeb57a45a17358151091f15ac3b6d6e8d1e58f9..1cc613cc4afc83a0b99837f3835e89a5e490f871 100644 (file)
@@ -321,42 +321,41 @@ add_phi_arg (tree *phi, tree def, edge e)
   if (i >= PHI_ARG_CAPACITY (*phi))
     {
       tree old_phi = *phi;
+      basic_block bb;
 
-      /* Resize the phi.  Unfortunately, this may also relocate it.  */
+      /* Resize the phi.  Unfortunately, this will relocate it.  */
       resize_phi_node (phi, ideal_phi_node_len (i + 4));
 
+      /* resize_phi_node will necessarily relocate the phi.  */
+      gcc_assert (*phi != old_phi);
+
       /* The result of the phi is defined by this phi node.  */
       SSA_NAME_DEF_STMT (PHI_RESULT (*phi)) = *phi;
 
-      /* If the PHI was relocated, update the PHI chains appropriately and
-        release the old PHI node.  */
-      if (*phi != old_phi)
+      /* Extract the basic block for the PHI from the PHI's annotation
+        rather than the edge.  This works better as the edge's
+        destination may not currently be the block with the PHI node
+        if we are in the process of threading the edge to a new
+        destination.  */
+      bb = bb_for_stmt (*phi);
+
+      release_phi_node (old_phi);
+
+      /* Update the list head if replacing the first listed phi.  */
+      if (phi_nodes (bb) == old_phi)
+       bb_ann (bb)->phi_nodes = *phi;
+      else
        {
-         /* Extract the basic block for the PHI from the PHI's annotation
-            rather than the edge.  This works better as the edge's
-            destination may not currently be the block with the PHI
-            node if we are in the process of threading the edge to
-            a new destination.  */
-         basic_block bb = bb_for_stmt (*phi);
-
-         release_phi_node (old_phi);
-
-         /* Update the list head if replacing the first listed phi.  */
-         if (phi_nodes (bb) == old_phi)
-           bb_ann (bb)->phi_nodes = *phi;
-         else
-           {
-             /* Traverse the list looking for the phi node to chain to.  */
-             tree p;
+         /* Traverse the list looking for the phi node to chain to.  */
+         tree p;
 
-             for (p = phi_nodes (bb);
-                  p && PHI_CHAIN (p) != old_phi;
-                  p = PHI_CHAIN (p))
-               ;
+         for (p = phi_nodes (bb);
+              p && PHI_CHAIN (p) != old_phi;
+              p = PHI_CHAIN (p))
+           ;
 
-             gcc_assert (p);
-             PHI_CHAIN (p) = *phi;
-           }
+         gcc_assert (p);
+         PHI_CHAIN (p) = *phi;
        }
     }