summaryrefslogtreecommitdiff
path: root/gcc/tree-if-conv.c
diff options
context:
space:
mode:
authordpatel <dpatel@138bc75d-0d04-0410-961f-82ee72b054a4>2005-03-02 19:45:25 +0000
committerdpatel <dpatel@138bc75d-0d04-0410-961f-82ee72b054a4>2005-03-02 19:45:25 +0000
commit46d1d560e93eb52b85884a6c478d08933b2b010e (patch)
treef15d106931283c142d64e6370d183a0ca48a6600 /gcc/tree-if-conv.c
parent18e20a6b22f2d7855c4e8b774030f223819b1319 (diff)
downloadgcc-46d1d560e93eb52b85884a6c478d08933b2b010e.tar.gz
PR tree-optimization/18815
* tree-if-conv.c (combine_blocks): Adjust loop header edges for loops with zero exit edges. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@95796 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-if-conv.c')
-rw-r--r--gcc/tree-if-conv.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index bb832d24616..ce66e2a7bbc 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -905,11 +905,22 @@ combine_blocks (struct loop *loop)
continue;
/* It is time to remove this basic block. First remove edges. */
- while (EDGE_COUNT (bb->succs) > 0)
- remove_edge (EDGE_SUCC (bb, 0));
while (EDGE_COUNT (bb->preds) > 0)
remove_edge (EDGE_PRED (bb, 0));
+ /* This is loop latch and loop does not have exit then do not
+ delete this basic block. Just remove its PREDS and reconnect
+ loop->header and loop->latch blocks. */
+ if (bb == loop->latch && loop->num_exits == 0)
+ {
+ make_edge (loop->header, loop->latch, EDGE_FALLTHRU);
+ set_immediate_dominator (CDI_DOMINATORS, loop->latch, loop->header);
+ continue;
+ }
+
+ while (EDGE_COUNT (bb->succs) > 0)
+ remove_edge (EDGE_SUCC (bb, 0));
+
/* Remove labels and make stmts member of loop->header. */
for (bsi = bsi_start (bb); !bsi_end_p (bsi); )
{