summaryrefslogtreecommitdiff
path: root/gcc/cfgexpand.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2017-05-19 08:23:37 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2017-05-19 08:23:37 +0000
commite4102b1d806355a2d2116f0df860cc5b67b7351b (patch)
treeac85c22d0871839024511e1895e6d1ca0b09ab10 /gcc/cfgexpand.c
parent29e3d809381eb9f5fd8cd81026370468ca8b13d5 (diff)
downloadgcc-e4102b1d806355a2d2116f0df860cc5b67b7351b.tar.gz
2017-05-19 Richard Biener <rguenther@suse.de>
PR middle-end/80764 * cfgexpand.c (expand_gimple_cond): Fix loop fixup. * gcc.dg/torture/pr80764.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@248261 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cfgexpand.c')
-rw-r--r--gcc/cfgexpand.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index e38c8e4ac49..9965310353e 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -2503,7 +2503,10 @@ 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, bb->loop_father);
+ add_bb_to_loop (new_bb, dest->loop_father);
+ if (bb->loop_father->latch == bb
+ && bb->loop_father->header == dest)
+ bb->loop_father->latch = new_bb;
new_edge = make_edge (new_bb, dest, 0);
new_edge->probability = REG_BR_PROB_BASE;
new_edge->count = new_bb->count;