summaryrefslogtreecommitdiff
path: root/gcc/tree-vect-loop-manip.c
diff options
context:
space:
mode:
authoramker <amker@138bc75d-0d04-0410-961f-82ee72b054a4>2016-10-13 11:00:13 +0000
committeramker <amker@138bc75d-0d04-0410-961f-82ee72b054a4>2016-10-13 11:00:13 +0000
commit8a61cfb8ee0dce3f9e46ccd81c2605cf66ac9aa1 (patch)
treed0035ce22c1a765c6219850ca42c1d303c72ddac /gcc/tree-vect-loop-manip.c
parent73e363e16eb4577477f13068a2286269d0fa12f5 (diff)
downloadgcc-8a61cfb8ee0dce3f9e46ccd81c2605cf66ac9aa1.tar.gz
* tree-vect-loop-manip.c (slpeel_tree_duplicate_loop_to_edge_cfg): Put
duplicated loop after its preheader and after the original loop. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241098 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-vect-loop-manip.c')
-rw-r--r--gcc/tree-vect-loop-manip.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c
index e6c297c76fe..9eb82185577 100644
--- a/gcc/tree-vect-loop-manip.c
+++ b/gcc/tree-vect-loop-manip.c
@@ -776,7 +776,7 @@ slpeel_tree_duplicate_loop_to_edge_cfg (struct loop *loop,
struct loop *scalar_loop, edge e)
{
struct loop *new_loop;
- basic_block *new_bbs, *bbs;
+ basic_block *new_bbs, *bbs, *pbbs;
bool at_exit;
bool was_imm_dom;
basic_block exit_dest;
@@ -792,12 +792,13 @@ slpeel_tree_duplicate_loop_to_edge_cfg (struct loop *loop,
scalar_loop = loop;
bbs = XNEWVEC (basic_block, scalar_loop->num_nodes + 1);
- get_loop_body_with_size (scalar_loop, bbs, scalar_loop->num_nodes);
+ pbbs = bbs + 1;
+ get_loop_body_with_size (scalar_loop, pbbs, scalar_loop->num_nodes);
/* Allow duplication of outer loops. */
if (scalar_loop->inner)
duplicate_outer_loop = true;
/* Check whether duplication is possible. */
- if (!can_copy_bbs_p (bbs, scalar_loop->num_nodes))
+ if (!can_copy_bbs_p (pbbs, scalar_loop->num_nodes))
{
free (bbs);
return NULL;
@@ -817,15 +818,15 @@ slpeel_tree_duplicate_loop_to_edge_cfg (struct loop *loop,
pre-header unconditionally for this. */
basic_block preheader = split_edge (loop_preheader_edge (scalar_loop));
edge entry_e = single_pred_edge (preheader);
- bbs[scalar_loop->num_nodes] = preheader;
+ bbs[0] = preheader;
new_bbs = XNEWVEC (basic_block, scalar_loop->num_nodes + 1);
exit = single_exit (scalar_loop);
copy_bbs (bbs, scalar_loop->num_nodes + 1, new_bbs,
&exit, 1, &new_exit, NULL,
- e->src, true);
+ at_exit ? loop->latch : e->src, true);
exit = single_exit (loop);
- basic_block new_preheader = new_bbs[scalar_loop->num_nodes];
+ basic_block new_preheader = new_bbs[0];
add_phi_args_after_copy (new_bbs, scalar_loop->num_nodes + 1, NULL);