aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-cfg.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-cfg.c')
-rw-r--r--gcc/tree-cfg.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index cdab639..ff72601 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -1674,8 +1674,12 @@ gimple_can_merge_blocks_p (basic_block a, basic_block b)
return false;
}
- /* Protect the loop latches. */
- if (current_loops && b->loop_father->latch == b)
+ /* Protect simple loop latches. We only want to avoid merging
+ the latch with the loop header in this case. */
+ if (current_loops
+ && b->loop_father->latch == b
+ && loops_state_satisfies_p (LOOPS_HAVE_SIMPLE_LATCHES)
+ && b->loop_father->header == a)
return false;
/* It must be possible to eliminate all phi nodes in B. If ssa form