This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] 18815
- From: Devang Patel <dpatel at apple dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 23 Feb 2005 09:26:52 -0800
- Subject: [PATCH] 18815
This is another case involving loops with zero exit edges. Tree
if-conversion did not adjust loop header's succ edge in this case.
Updated verifiers on TCB catches this. To fix this, new FALLTHRU edge
is created to connect loop header and loop latch.
Bootstrapped and tested on powerpc-darwin. I also ran dejaGNU tests on
TCB to verify pr17635.c test case. No new regressions, mainline as well
as TCB.
OK for mainline?
2005-02-23 Devang Patel <dpatel@apple.com>
PR 18815
* tree-if-conv.c (combine_blocks): Adjust loop header edges for
loops with zero exit edges.
-
Devang
*** gcc.0/gcc/tree-if-conv.c Fri Feb 18 11:44:13 2005
--- gcc.2/gcc/tree-if-conv.c Tue Feb 22 17:17:03 2005
*************** combine_blocks (struct loop *loop)
*** 903,912 ****
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));
/* Remove labels and make stmts member of loop->header. */
for (bsi = bsi_start (bb); !bsi_end_p (bsi); )
--- 903,923 ----
continue;
/* It is time to remove this basic block. First remove
edges. */
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); )