tree-phinodes.c (remove_all_phi_nodes_for): Speed up using a pointer to the last...
authorKazu Hirata <kazu@cs.umass.edu>
Sat, 6 Nov 2004 15:14:11 +0000 (15:14 +0000)
committerKazu Hirata <kazu@gcc.gnu.org>
Sat, 6 Nov 2004 15:14:11 +0000 (15:14 +0000)
* tree-phinodes.c (remove_all_phi_nodes_for): Speed up using a
pointer to the last PHI node in the new PHI chain.

From-SVN: r90173

gcc/ChangeLog
gcc/tree-phinodes.c

index 33c708b77918fdece2f51981599267d2469abc0b..402f31d8903ed05a833e4cb8b4e350e908a476d6 100644 (file)
@@ -1,3 +1,8 @@
+2004-11-06  Kazu Hirata  <kazu@cs.umass.edu>
+
+       * tree-phinodes.c (remove_all_phi_nodes_for): Speed up using a
+       pointer to the last PHI node in the new PHI chain.
+
 2004-11-06  Kaz Kojima  <kkojima@gcc.gnu.org>
 
        * config/sh/sh.c (prepare_move_operands): Emit a use of r12
index 2e190e58179db8ecd68a4c38a47065dfb781b6ef..0d621b5333967ae8759a6c94af8069ead0f79277 100644 (file)
@@ -449,10 +449,10 @@ remove_all_phi_nodes_for (bitmap vars)
   FOR_EACH_BB (bb)
     {
       /* Build a new PHI list for BB without variables in VARS.  */
-      tree phi, new_phi_list, last_phi, next;
+      tree phi, new_phi_list, next;
+      tree *lastp = &new_phi_list;
 
-      last_phi = new_phi_list = NULL_TREE;
-      for (phi = phi_nodes (bb), next = NULL; phi; phi = next)
+      for (phi = phi_nodes (bb); phi; phi = next)
        {
          tree var = SSA_NAME_VAR (PHI_RESULT (phi));
 
@@ -465,13 +465,8 @@ remove_all_phi_nodes_for (bitmap vars)
                 Note that fact in PHI_REWRITTEN.  */
              PHI_REWRITTEN (phi) = 1;
 
-             if (new_phi_list == NULL_TREE)
-               new_phi_list = last_phi = phi;
-             else
-               {
-                 PHI_CHAIN (last_phi) = phi;
-                 last_phi = phi;
-               }
+             *lastp = phi;
+             lastp = &PHI_CHAIN (phi);
            }
          else
            {
@@ -483,8 +478,7 @@ remove_all_phi_nodes_for (bitmap vars)
        }
 
       /* Make sure the last node in the new list has no successors.  */
-      if (last_phi)
-       PHI_CHAIN (last_phi) = NULL_TREE;
+      *lastp = NULL;
       bb_ann (bb)->phi_nodes = new_phi_list;
 
 #if defined ENABLE_CHECKING