This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Avoid re-allocating PHIs in split_edge
- From: Richard Biener <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 22 Aug 2017 11:03:14 +0200 (CEST)
- Subject: [PATCH] Avoid re-allocating PHIs in split_edge
- Authentication-results: sourceware.org; auth=none
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.
Richard.
2017-08-22 Richard Biener <rguenther@suse.de>
* 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;