From: Richard Biener Date: Fri, 5 Aug 2016 07:41:45 +0000 (+0000) Subject: tree-cfgcleanup.c (tree_forwarder_block_p): Use bb_loop_header_p. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ee2810081e4008656ffb5a2f37a5a68d5d477e7e;p=gcc.git tree-cfgcleanup.c (tree_forwarder_block_p): Use bb_loop_header_p. 2016-08-05 Richard Biener * tree-cfgcleanup.c (tree_forwarder_block_p): Use bb_loop_header_p. * cfghooks.c (force_nonfallthru): If we ended up splitting a latch adjust loop info accordingly. From-SVN: r239163 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7bb9dc96c01..be93f5b9ca8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-08-05 Richard Biener + + * tree-cfgcleanup.c (tree_forwarder_block_p): Use bb_loop_header_p. + * cfghooks.c (force_nonfallthru): If we ended up splitting a latch + adjust loop info accordingly. + 2016-08-05 Kugan Vivekanandarajah * tree-vrp.c (extract_range_basic): Check cfun->after_inlining diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c index 06c05d1fb39..4a6fcbf56dc 100644 --- a/gcc/cfghooks.c +++ b/gcc/cfghooks.c @@ -1030,11 +1030,17 @@ force_nonfallthru (edge e) if (current_loops != NULL) { + basic_block pred = single_pred (ret); + basic_block succ = single_succ (ret); struct loop *loop - = find_common_loop (single_pred (ret)->loop_father, - single_succ (ret)->loop_father); + = find_common_loop (pred->loop_father, succ->loop_father); rescan_loop_exit (e, false, true); add_bb_to_loop (ret, loop); + + /* If we split the latch edge of loop adjust the latch block. */ + if (loop->latch == pred + && loop->header == succ) + loop->latch = ret; } } diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c index 4134c383dd9..ab8a9139f76 100644 --- a/gcc/tree-cfgcleanup.c +++ b/gcc/tree-cfgcleanup.c @@ -344,7 +344,7 @@ tree_forwarder_block_p (basic_block bb, bool phi_wanted) { basic_block dest; /* Protect loop headers. */ - if (bb->loop_father->header == bb) + if (bb_loop_header_p (bb)) return false; dest = EDGE_SUCC (bb, 0)->dest;