summaryrefslogtreecommitdiff
path: root/gcc/cfgexpand.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2010-02-19 10:53:51 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2010-02-19 10:53:51 +0100
commit40e90eac9591b388ab335cac5f793906cc9a5b0a (patch)
treeae0cff8e2a111a3f985e8b1442893617e40733f1 /gcc/cfgexpand.c
parent554cf33034e4a4ba3960a0885f45fa7a919dbd0d (diff)
downloadgcc-40e90eac9591b388ab335cac5f793906cc9a5b0a.tar.gz
re PR middle-end/42233 (c++ builtin_expect code generation regression)
PR middle-end/42233 * expr.h (jumpifnot, jumpifnot_1, jumpif, jumpif_1, do_jump, do_jump_1, do_compare_rtx_and_jump): Add PROB argument. * dojump.c: Include output.h. (inv): New inline function. (jumpifnot, jumpifnot_1, jumpif, jumpif_1, do_jump_1, do_jump, do_jump_by_parts_greater_rtx, do_jump_by_parts_greater, do_jump_by_parts_zero_rtx, do_jump_by_parts_equality_rtx, do_jump_by_parts_equality, do_compare_and_jump): Add PROB argument, pass it down to other calls. (do_compare_rtx_and_jump): Likewise. If PROB is not -1, add REG_BR_PROB note to the conditional jump. * cfgexpand.c (add_reg_br_prob_note): Removed. (expand_gimple_cond): Don't call it, add the probability as last argument to jumpif_1/jumpifnot_1. * Makefile.in (dojump.o): Depend on output.h. * builtins.c (expand_errno_check): Adjust do_compare_rtx_and_jump callers. * expmed.c (emit_store_flag_force, do_cmp_and_jump): Likewise. * stmt.c (do_jump_if_equal): Likewise. * cfgrtl.c (rtl_lv_add_condition_to_bb): Likewise. * loop-unswitch.c (compare_and_jump_seq): Likewise. * config/rs6000/rs6000.c (rs6000_aix_emit_builtin_unwind_init): Likewise. * optabs.c (expand_doubleword_shift, expand_abs): Likewise. * expr.c (expand_expr_real_1): Adjust do_jump, jumpifnot and jumpifnot_1 callers. (expand_expr_real_2): Adjust jumpifnot_1 and do_compare_rtx_and_jump callers. (store_expr): Adjust jumpifnot caller. (store_constructor): Adjust jumpif caller. From-SVN: r156889
Diffstat (limited to 'gcc/cfgexpand.c')
-rw-r--r--gcc/cfgexpand.c52
1 files changed, 6 insertions, 46 deletions
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index a0d4ba52b12..53beecd57fd 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -91,46 +91,6 @@ gimple_assign_rhs_to_tree (gimple stmt)
}
-/* Verify that there is exactly single jump instruction since last and attach
- REG_BR_PROB note specifying probability.
- ??? We really ought to pass the probability down to RTL expanders and let it
- re-distribute it when the conditional expands into multiple conditionals.
- This is however difficult to do. */
-void
-add_reg_br_prob_note (rtx last, int probability)
-{
- if (profile_status == PROFILE_ABSENT)
- return;
- for (last = NEXT_INSN (last); last && NEXT_INSN (last); last = NEXT_INSN (last))
- if (JUMP_P (last))
- {
- /* It is common to emit condjump-around-jump sequence when we don't know
- how to reverse the conditional. Special case this. */
- if (!any_condjump_p (last)
- || !JUMP_P (NEXT_INSN (last))
- || !simplejump_p (NEXT_INSN (last))
- || !NEXT_INSN (NEXT_INSN (last))
- || !BARRIER_P (NEXT_INSN (NEXT_INSN (last)))
- || !NEXT_INSN (NEXT_INSN (NEXT_INSN (last)))
- || !LABEL_P (NEXT_INSN (NEXT_INSN (NEXT_INSN (last))))
- || NEXT_INSN (NEXT_INSN (NEXT_INSN (NEXT_INSN (last)))))
- goto failed;
- gcc_assert (!find_reg_note (last, REG_BR_PROB, 0));
- add_reg_note (last, REG_BR_PROB,
- GEN_INT (REG_BR_PROB_BASE - probability));
- return;
- }
- if (!last || !JUMP_P (last) || !any_condjump_p (last))
- goto failed;
- gcc_assert (!find_reg_note (last, REG_BR_PROB, 0));
- add_reg_note (last, REG_BR_PROB, GEN_INT (probability));
- return;
-failed:
- if (dump_file)
- fprintf (dump_file, "Failed to add probability note\n");
-}
-
-
#ifndef STACK_ALIGNMENT_NEEDED
#define STACK_ALIGNMENT_NEEDED 1
#endif
@@ -1663,8 +1623,8 @@ expand_gimple_cond (basic_block bb, gimple stmt)
two-way jump that needs to be decomposed into two basic blocks. */
if (false_edge->dest == bb->next_bb)
{
- jumpif_1 (code, op0, op1, label_rtx_for_bb (true_edge->dest));
- add_reg_br_prob_note (last, true_edge->probability);
+ jumpif_1 (code, op0, op1, label_rtx_for_bb (true_edge->dest),
+ true_edge->probability);
maybe_dump_rtl_for_gimple_stmt (stmt, last);
if (true_edge->goto_locus)
{
@@ -1679,8 +1639,8 @@ expand_gimple_cond (basic_block bb, gimple stmt)
}
if (true_edge->dest == bb->next_bb)
{
- jumpifnot_1 (code, op0, op1, label_rtx_for_bb (false_edge->dest));
- add_reg_br_prob_note (last, false_edge->probability);
+ jumpifnot_1 (code, op0, op1, label_rtx_for_bb (false_edge->dest),
+ false_edge->probability);
maybe_dump_rtl_for_gimple_stmt (stmt, last);
if (false_edge->goto_locus)
{
@@ -1694,8 +1654,8 @@ expand_gimple_cond (basic_block bb, gimple stmt)
return NULL;
}
- jumpif_1 (code, op0, op1, label_rtx_for_bb (true_edge->dest));
- add_reg_br_prob_note (last, true_edge->probability);
+ jumpif_1 (code, op0, op1, label_rtx_for_bb (true_edge->dest),
+ true_edge->probability);
last = get_last_insn ();
if (false_edge->goto_locus)
{