From: Bin Cheng Date: Tue, 28 Mar 2017 15:35:56 +0000 (+0000) Subject: tree-vect-loop.c (optimize_mask_stores): Add bb to the right loop. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9d384e80bda2cf905cd550c8908494210ae11c15;p=gcc.git tree-vect-loop.c (optimize_mask_stores): Add bb to the right loop. * tree-vect-loop.c (optimize_mask_stores): Add bb to the right loop. From-SVN: r246541 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fa216e904ab..b57d40b0863 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2017-03-28 Bin Cheng + + * tree-vect-loop.c (optimize_mask_stores): Add bb to the right + loop. + 2017-03-28 Bin Cheng * tree-vect-loop-manip.c (slpeel_add_loop_guard): New param and diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 6bbf8162a86..af874e7ad8e 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -7229,6 +7229,7 @@ optimize_mask_stores (struct loop *loop) unsigned nbbs = loop->num_nodes; unsigned i; basic_block bb; + struct loop *bb_loop; gimple_stmt_iterator gsi; gimple *stmt; auto_vec worklist; @@ -7267,11 +7268,16 @@ optimize_mask_stores (struct loop *loop) last = worklist.pop (); mask = gimple_call_arg (last, 2); bb = gimple_bb (last); - /* Create new bb. */ + /* Create then_bb and if-then structure in CFG, then_bb belongs to + the same loop as if_bb. It could be different to LOOP when two + level loop-nest is vectorized and mask_store belongs to the inner + one. */ e = split_block (bb, last); + bb_loop = bb->loop_father; + gcc_assert (loop == bb_loop || flow_loop_nested_p (loop, bb_loop)); join_bb = e->dest; store_bb = create_empty_bb (bb); - add_bb_to_loop (store_bb, loop); + add_bb_to_loop (store_bb, bb_loop); e->flags = EDGE_TRUE_VALUE; efalse = make_edge (bb, store_bb, EDGE_FALSE_VALUE); /* Put STORE_BB to likely part. */