This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] tree-cfg.c: Remove duplicate code.
- From: Kazu Hirata <kazu at cs dot umass dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 08 Nov 2004 09:10:12 -0500 (EST)
- Subject: [patch] tree-cfg.c: Remove duplicate code.
Hi,
Attached is a patch to remove duplicate code.
tree_make_forwarder_block tries to reverse a PHI chain. We already
have nreverse, so we should use it.
Tested on i686-pc-linux-gnu. OK to apply?
Kazu Hirata
2004-11-08 Kazu Hirata <kazu@cs.umass.edu>
* tree-cfg.c (tree_make_forwarder_block): Use nreverse.
Index: tree-cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-cfg.c,v
retrieving revision 2.101
diff -u -d -p -r2.101 tree-cfg.c
--- tree-cfg.c 6 Nov 2004 15:57:25 -0000 2.101
+++ tree-cfg.c 6 Nov 2004 20:30:28 -0000
@@ -3655,7 +3655,7 @@ tree_make_forwarder_block (edge fallthru
edge e;
edge_iterator ei;
basic_block dummy, bb;
- tree phi, new_phi, var, prev, next;
+ tree phi, new_phi, var;
dummy = fallthru->src;
bb = fallthru->dest;
@@ -3675,14 +3675,7 @@ tree_make_forwarder_block (edge fallthru
}
/* Ensure that the PHI node chain is in the same order. */
- prev = NULL;
- for (phi = phi_nodes (bb); phi; phi = next)
- {
- next = PHI_CHAIN (phi);
- PHI_CHAIN (phi) = prev;
- prev = phi;
- }
- set_phi_nodes (bb, prev);
+ set_phi_nodes (bb, nreverse (phi_nodes (bb)));
/* Add the arguments we have stored on edges. */
FOR_EACH_EDGE (e, ei, bb->preds)