summaryrefslogtreecommitdiff
path: root/gcc/cfgrtl.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2003-03-25 19:20:34 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2003-03-25 19:20:34 +0000
commitaccd6c4451dc71cb5ef567bc247f8b5138ee6d54 (patch)
tree0e69de262d22541befef3a9f7c91b5a102b2a66c /gcc/cfgrtl.c
parent4785ae19c91d32325801174da86c8243bc348d65 (diff)
downloadgcc-accd6c4451dc71cb5ef567bc247f8b5138ee6d54.tar.gz
PR opt/10056
* cfglayout.c (fixup_reorder_chain): Fix dealing with the conditional jump jumping to the next instruction. * cfgrtl.c (force_nonfallthru_and_redirect): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@64854 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cfgrtl.c')
-rw-r--r--gcc/cfgrtl.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 01b7e92c2cb..5e47236b4ce 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -78,7 +78,7 @@ static void commit_one_edge_insertion PARAMS ((edge, int));
static bool try_redirect_by_replacing_jump PARAMS ((edge, basic_block));
static rtx last_loop_beg_note PARAMS ((rtx));
static bool back_edge_of_syntactic_loop_p PARAMS ((basic_block, basic_block));
-static basic_block force_nonfallthru_and_redirect PARAMS ((edge, basic_block));
+basic_block force_nonfallthru_and_redirect PARAMS ((edge, basic_block));
/* Return true if NOTE is not one of the ones that must be kept paired,
so that we may simply delete it. */
@@ -930,7 +930,7 @@ redirect_edge_and_branch (e, target)
/* Like force_nonfallthru below, but additionally performs redirection
Used by redirect_edge_and_branch_force. */
-static basic_block
+basic_block
force_nonfallthru_and_redirect (e, target)
edge e;
basic_block target;
@@ -940,6 +940,34 @@ force_nonfallthru_and_redirect (e, target)
edge new_edge;
int abnormal_edge_flags = 0;
+ /* In the case the last instruction is conditional jump to the next
+ instruction, first redirect the jump itself and then continue
+ by creating an basic block afterwards to redirect fallthru edge. */
+ if (e->src != ENTRY_BLOCK_PTR && e->dest != EXIT_BLOCK_PTR
+ && any_condjump_p (e->src->end)
+ && JUMP_LABEL (e->src->end) == e->dest->head)
+ {
+ rtx note;
+ edge b = make_edge (e->src, target, 0);
+
+ if (!redirect_jump (e->src->end, block_label (target), 0))
+ abort ();
+ note = find_reg_note (e->src->end, REG_BR_PROB, NULL_RTX);
+ if (note)
+ {
+ int prob = INTVAL (XEXP (note, 0));
+
+ b->probability = prob;
+ b->count = e->count * prob / REG_BR_PROB_BASE;
+ e->probability -= e->probability;
+ e->count -= b->count;
+ if (e->probability < 0)
+ e->probability = 0;
+ if (e->count < 0)
+ e->count = 0;
+ }
+ }
+
if (e->flags & EDGE_ABNORMAL)
{
/* Irritating special case - fallthru edge to the same block as abnormal