This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Make loop optimizer happy about redirected loop exits
- To: rth at cygnus dot com, patches at x86-64 dot org, gcc-patches at gcc dot gnu dot org
- Subject: Make loop optimizer happy about redirected loop exits
- From: Jan Hubicka <jh at suse dot cz>
- Date: Sat, 14 Jul 2001 21:02:40 +0200
Hi,
the loop optimizer may get confused, if we emit an jump instruction before
the LOOP_END note, as may happen if the fallthru edge is redirected somewhere.
This patch solves the problem by placing new BB as late as possible.
Honza
Sat Jul 14 20:57:24 CEST 2001 Jan Hubicka <jh@suse.cz>
* flow.c (redirect_edge_and_branch_force): Place new basic block
after the possible loop_end or block_end notes.
*** /p1/jumpr2/egcs/gcc/flow.c Sat Jul 14 02:30:25 2001
--- flow.c Sat Jul 14 22:05:38 2001
*************** redirect_edge_and_branch_force (e, targe
*** 1922,1928 ****
memset (new_bb, 0, sizeof (*new_bb));
! new_bb->end = new_bb->head = e->src->end;
new_bb->succ = NULL;
new_bb->pred = new_edge;
new_bb->count = e->count;
--- 1925,1934 ----
memset (new_bb, 0, sizeof (*new_bb));
! /* In case the basic block is followed by LOOP_END or BLOCK_END note, we want
! the new basic block appear after that one, as it is no longer member of loop
! or syntactic block. */
! new_bb->end = new_bb->head = PREV_INSN (BASIC_BLOCK (e->src->index + 1)->head);
new_bb->succ = NULL;
new_bb->pred = new_edge;
new_bb->count = e->count;