diff options
Diffstat (limited to 'gcc/cfgcleanup.c')
-rw-r--r-- | gcc/cfgcleanup.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c index 078b669..bc637e4 100644 --- a/gcc/cfgcleanup.c +++ b/gcc/cfgcleanup.c @@ -1116,9 +1116,20 @@ outgoing_edges_match (mode, bb1, bb2) if (!bb2->succ || !bb2->succ->succ_next - || bb1->succ->succ_next->succ_next + || bb2->succ->succ_next->succ_next || !any_condjump_p (bb2->end) - || !onlyjump_p (bb1->end)) + || !onlyjump_p (bb2->end)) + return false; + + /* Do not crossjump across loop boundaries. This is a temporary + workaround for the common scenario in which crossjumping results + in killing the duplicated loop condition, making bb-reorder rotate + the loop incorectly, leaving an extra unconditional jump inside + the loop. + + This check should go away once bb-reorder knows how to duplicate + code in this case or rotate the loops to avoid this scenario. */ + if (bb1->loop_depth != bb2->loop_depth) return false; b1 = BRANCH_EDGE (bb1); @@ -1194,9 +1205,10 @@ outgoing_edges_match (mode, bb1, bb2) /* Do not use f2 probability as f2 may be forwarded. */ prob2 = REG_BR_PROB_BASE - b2->probability; - /* Fail if the difference in probabilities is - greater than 5%. */ - if (abs (b1->probability - prob2) > REG_BR_PROB_BASE / 20) + /* Fail if the difference in probabilities is greater than 50%. + This rules out two well-predicted branches with opposite + outcomes. */ + if (abs (b1->probability - prob2) > REG_BR_PROB_BASE / 5) { if (rtl_dump_file) fprintf (rtl_dump_file, |