Commit 874b5b14 by Richard Henderson Committed by Richard Henderson

ifcvt.c (dead_or_predicable): Handling merging when other_bb and new_dest are the same.

        * ifcvt.c (dead_or_predicable): Handling merging when other_bb
        and new_dest are the same.

From-SVN: r49366
parent 89cf7be5
2002-01-30 Richard Henderson <rth@redhat.com> 2002-01-30 Richard Henderson <rth@redhat.com>
* ifcvt.c (dead_or_predicable): Handling merging when other_bb
and new_dest are the same.
2002-01-30 Richard Henderson <rth@redhat.com>
PR opt/5076 PR opt/5076
* rtl.h (NOTE_INSN_LOOP_END_TOP_COND): New. * rtl.h (NOTE_INSN_LOOP_END_TOP_COND): New.
* rtl.c (note_insn_name): Update. * rtl.c (note_insn_name): Update.
......
...@@ -2629,35 +2629,41 @@ dead_or_predicable (test_bb, merge_bb, other_bb, new_dest, reversep) ...@@ -2629,35 +2629,41 @@ dead_or_predicable (test_bb, merge_bb, other_bb, new_dest, reversep)
change group management. */ change group management. */
old_dest = JUMP_LABEL (jump); old_dest = JUMP_LABEL (jump);
new_label = block_label (new_dest); if (other_bb != new_dest)
if (reversep {
? ! invert_jump_1 (jump, new_label) new_label = block_label (new_dest);
: ! redirect_jump_1 (jump, new_label)) if (reversep
goto cancel; ? ! invert_jump_1 (jump, new_label)
: ! redirect_jump_1 (jump, new_label))
goto cancel;
}
if (! apply_change_group ()) if (! apply_change_group ())
return FALSE; return FALSE;
if (old_dest) if (other_bb != new_dest)
LABEL_NUSES (old_dest) -= 1;
if (new_label)
LABEL_NUSES (new_label) += 1;
JUMP_LABEL (jump) = new_label;
if (reversep)
invert_br_probabilities (jump);
redirect_edge_succ (BRANCH_EDGE (test_bb), new_dest);
if (reversep)
{ {
gcov_type count, probability; if (old_dest)
count = BRANCH_EDGE (test_bb)->count; LABEL_NUSES (old_dest) -= 1;
BRANCH_EDGE (test_bb)->count = FALLTHRU_EDGE (test_bb)->count; if (new_label)
FALLTHRU_EDGE (test_bb)->count = count; LABEL_NUSES (new_label) += 1;
probability = BRANCH_EDGE (test_bb)->probability; JUMP_LABEL (jump) = new_label;
BRANCH_EDGE (test_bb)->probability = FALLTHRU_EDGE (test_bb)->probability; if (reversep)
FALLTHRU_EDGE (test_bb)->probability = probability; invert_br_probabilities (jump);
update_br_prob_note (test_bb);
redirect_edge_succ (BRANCH_EDGE (test_bb), new_dest);
if (reversep)
{
gcov_type count, probability;
count = BRANCH_EDGE (test_bb)->count;
BRANCH_EDGE (test_bb)->count = FALLTHRU_EDGE (test_bb)->count;
FALLTHRU_EDGE (test_bb)->count = count;
probability = BRANCH_EDGE (test_bb)->probability;
BRANCH_EDGE (test_bb)->probability
= FALLTHRU_EDGE (test_bb)->probability;
FALLTHRU_EDGE (test_bb)->probability = probability;
update_br_prob_note (test_bb);
}
} }
/* Move the insns out of MERGE_BB to before the branch. */ /* Move the insns out of MERGE_BB to before the branch. */
...@@ -2671,6 +2677,16 @@ dead_or_predicable (test_bb, merge_bb, other_bb, new_dest, reversep) ...@@ -2671,6 +2677,16 @@ dead_or_predicable (test_bb, merge_bb, other_bb, new_dest, reversep)
reorder_insns (head, end, PREV_INSN (earliest)); reorder_insns (head, end, PREV_INSN (earliest));
} }
/* Remove the jump and edge if we can. */
if (other_bb == new_dest)
{
delete_insn (jump);
remove_edge (BRANCH_EDGE (test_bb));
/* ??? Can't merge blocks here, as then_bb is still in use.
At minimum, the merge will get done just before bb-reorder. */
}
return TRUE; return TRUE;
cancel: cancel:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment