This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[cfg-branch] fix deleting of edges in unswitching
- From: Jan Hubicka <jh at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org, gcc-pdo at atrey dot karlin dot mff dot cuni dot cz
- Date: Sat, 6 Apr 2002 18:42:41 +0200
- Subject: [cfg-branch] fix deleting of edges in unswitching
Hi,
loop_delete_branch_edge can be better implemented by redirecting edge that in
turn should remove the condtional jump.
Current code had problems with updating edge probabilities when sum of
probabilities != REG_BR_PROB_BASE due to numerical errors.
Sat Apr 6 18:36:17 CEST 2002 Jan Hubicka <jh@suse.cz>
* loop-bew (loop_delete_branch_edge): Use cfg_layout_redirect_edge.
Index: loop-new.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/loop-new.c,v
retrieving revision 1.1.2.14
diff -c -3 -p -r1.1.2.14 loop-new.c
*** loop-new.c 2002/04/06 15:29:42 1.1.2.14
--- loop-new.c 2002/04/06 16:31:53
*************** loop_delete_branch_edge (e)
*** 1159,1190 ****
if (src->succ->succ_next)
{
- int tot_pr, tot_rem;
- edge ae;
-
/* Cannot handle more than two exit edges. */
if (src->succ->succ_next->succ_next)
return;
/* Neither this. */
if (!any_condjump_p (src->end))
return;
!
! /* Try to fix probabilities. This is probably as wrong as to leave
! them as they are. */
! tot_pr = 0;
! for (ae = src->succ; ae; ae = ae->succ_next)
! tot_pr += ae->probability;
! tot_rem = tot_pr - e->probability;
! if (tot_rem > 0)
! {
! for (ae = src->succ; ae; ae = ae->succ_next)
! ae->probability = (ae->probability * tot_pr) / tot_rem;
! }
!
! delete_insn (src->end);
!
! remove_edge (e);
! src->succ->flags |= EDGE_FALLTHRU;
}
else
{
--- 1159,1173 ----
if (src->succ->succ_next)
{
/* Cannot handle more than two exit edges. */
if (src->succ->succ_next->succ_next)
return;
/* Neither this. */
if (!any_condjump_p (src->end))
return;
! cfg_layout_redirect_edge (e,
! e == src->succ ? src->succ->succ_next->dest
! : src->succ->dest);
}
else
{