diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-05-30 11:08:36 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-05-30 11:08:36 +0000 |
commit | d1af79c68d60803fc7b832feb805c453c7f10732 (patch) | |
tree | ae64df2a7f595668efbb8b7fed58afdfa0b293c9 /gcc/cfgexpand.c | |
parent | 5081fac897ce340eef9ef46f0c12d644e281472d (diff) | |
download | gcc-d1af79c68d60803fc7b832feb805c453c7f10732.tar.gz |
2017-05-30 Richard Biener <rguenther@suse.de>
PR middle-end/80901
* cfgexpand.c (expand_gimple_cond): Match up loop fixup with
split_edge code.
* gcc.dg/torture/pr80901.c: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@248681 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cfgexpand.c')
-rw-r--r-- | gcc/cfgexpand.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index c5b4d70f4a3..698d43b60b4 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -2503,10 +2503,11 @@ expand_gimple_cond (basic_block bb, gcond *stmt) false_edge->flags |= EDGE_FALLTHRU; new_bb->count = false_edge->count; new_bb->frequency = EDGE_FREQUENCY (false_edge); - add_bb_to_loop (new_bb, dest->loop_father); - if (dest->loop_father->latch == bb - && dest->loop_father->header == dest) - dest->loop_father->latch = new_bb; + loop_p loop = find_common_loop (bb->loop_father, dest->loop_father); + add_bb_to_loop (new_bb, loop); + if (loop->latch == bb + && loop->header == dest) + loop->latch = new_bb; new_edge = make_edge (new_bb, dest, 0); new_edge->probability = REG_BR_PROB_BASE; new_edge->count = new_bb->count; |