diff options
author | Devang Patel <dpatel@apple.com> | 2004-10-14 11:19:47 -0700 |
---|---|---|
committer | Devang Patel <dpatel@gcc.gnu.org> | 2004-10-14 11:19:47 -0700 |
commit | 0ecf0d5f412d118111cb9cba1c297896615451a8 (patch) | |
tree | e261933f35d83b197a74e8a7cd7a25697a6aed21 /gcc/tree-if-conv.c | |
parent | 1399eca1907b6fe3a191c586211bcfcc46f47b4d (diff) | |
download | gcc-0ecf0d5f412d118111cb9cba1c297896615451a8.zip gcc-0ecf0d5f412d118111cb9cba1c297896615451a8.tar.gz gcc-0ecf0d5f412d118111cb9cba1c297896615451a8.tar.bz2 |
tree-if-conv.c (process_phi_nodes): Process latch block.
* tree-if-conv.c (process_phi_nodes): Process latch block.
(combine_blocks): Process latch block and update loop structure.
* gcc.dg/pr17635.c : New test.
From-SVN: r89045
Diffstat (limited to 'gcc/tree-if-conv.c')
-rw-r--r-- | gcc/tree-if-conv.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c index 8869646..bb2ab9c 100644 --- a/gcc/tree-if-conv.c +++ b/gcc/tree-if-conv.c @@ -815,7 +815,7 @@ process_phi_nodes (struct loop *loop) basic_block true_bb = NULL; bb = ifc_bbs[i]; - if (bb == loop->header || bb == loop->latch) + if (bb == loop->header) continue; phi = phi_nodes (bb); @@ -863,9 +863,6 @@ combine_blocks (struct loop *loop) bb = ifc_bbs[i]; - if (bb == loop->latch) - continue; - if (!exit_bb && bb_with_exit_edge_p (bb)) exit_bb = bb; @@ -891,6 +888,9 @@ combine_blocks (struct loop *loop) continue; } + if (bb == loop->latch && empty_block_p (bb)) + continue; + /* It is time to remove this basic block. First remove edges. */ while (EDGE_COUNT (bb->succs) > 0) ssa_remove_edge (EDGE_SUCC (bb, 0)); @@ -921,6 +921,8 @@ combine_blocks (struct loop *loop) delete_from_dominance_info (CDI_POST_DOMINATORS, bb); /* Remove basic block. */ + if (bb == loop->latch) + loop->latch = merge_target_bb; remove_bb_from_loops (bb); expunge_block (bb); } @@ -928,7 +930,10 @@ combine_blocks (struct loop *loop) /* Now if possible, merge loop header and block with exit edge. This reduces number of basic blocks to 2. Auto vectorizer addresses loops with two nodes only. FIXME: Use cleanup_tree_cfg(). */ - if (exit_bb != loop->latch && empty_block_p (loop->latch)) + if (exit_bb + && loop->header != loop->latch + && exit_bb != loop->latch + && empty_block_p (loop->latch)) { if (can_merge_blocks_p (loop->header, exit_bb)) { |