This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Avoid re-allocating PHIs in split_edge

The following patch makes sure to not grow the number of incoming
edges in the destination when doing split_edge on GIMPLE.  That's
easy by first redirecting the existing edge to the destination
to the new block rather than creating the new fallthru from the
new block to the destination.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.


2017-08-22  Richard Biener  <>

	* tree-cfg.c (gimple_split_edge): Avoid reallocating target
	PHI nodes.

Index: gcc/tree-cfg.c
--- gcc/tree-cfg.c	(revision 251215)
+++ gcc/tree-cfg.c	(working copy)
@@ -2844,10 +2844,11 @@ gimple_split_edge (edge edge_in)
   new_bb = create_empty_bb (after_bb);
   new_bb->frequency = EDGE_FREQUENCY (edge_in);
   new_bb->count = edge_in->count;
-  new_edge = make_single_succ_edge (new_bb, dest, EDGE_FALLTHRU);
   e = redirect_edge_and_branch (edge_in, new_bb);
   gcc_assert (e == edge_in);
+  new_edge = make_single_succ_edge (new_bb, dest, EDGE_FALLTHRU);
   reinstall_phi_args (new_edge, e);
   return new_bb;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]