diff mbox

Fix bugs introduced by switch-case profile propagation

Message ID 1351688011.25600.39.camel@yam-132-YW-E178-FTW
State New
Headers show

Commit Message

Oleg Endo Oct. 31, 2012, 12:53 p.m. UTC
On Fri, 2012-10-26 at 17:05 +0200, Jan Hubicka wrote:
> > Hi,
> > 
> > On Tue, Oct 23, 2012 at 3:03 AM, Jan Hubicka <hubicka@ucw.cz> wrote:
> > >> Ping.
> > >>
> > >>
> > >> On Wed, Oct 17, 2012 at 1:48 PM, Easwaran Raman <eraman@google.com> wrote:
> > >> > Hi,
> > >> >  This patch fixes bugs introduced by my previous patch to propagate
> > >> > profiles during switch expansion. Bootstrap and profiledbootstrap
> > >> > successful on x86_64. Confirmed that it fixes the crashes reported in
> > >> > PR middle-end/54957. OK for trunk?
> > >> >
> > >> > - Easwaran
> > >> >
> > >> > 2012-10-17   Easwaran Raman  <eraman@google.com>
> > >> >
> > >> >         PR target/54938
> > >> >         PR middle-end/54957
> > >> >         * optabs.c (emit_cmp_and_jump_insn_1): Add REG_BR_PROB note
> > >> >         only if it doesn't already exist.
> > >> >         * except.c (sjlj_emit_function_enter): Remove unused variable.
> > >> >         * stmt.c (get_outgoing_edge_probs): Return 0 if BB is NULL.
> > >
> > > Seems fine, but under what conditions you get NULL here?
> > Wasn't sure if this is an OK for the patch or if I need to address
> > anything else.
> 
> Actually I think you should make the except.c to setcurrent_bb when expanding
> the switch instead.
> OK with this change.

Is there any progress regarding this issue?
It makes testing on SH against current trunk difficult.  Would it be OK
to at least commit this hunk?


I've tested this on rev 192983 with
make -k check RUNTESTFLAGS="--target_board=sh-sim
\{-m2/-ml,-m2/-mb,-m2a/-mb,-m4/-ml,-m4/-mb,-m4a/-ml,-m4a/-mb}"

and it looks OK.

Cheers,
Oleg
diff mbox

Patch

Index: gcc/optabs.c
===================================================================
--- gcc/optabs.c	(revision 192963)
+++ gcc/optabs.c	(working copy)
@@ -4270,8 +4270,8 @@ 
       && JUMP_P (insn)
       && any_condjump_p (insn))
     {
-      gcc_assert (!find_reg_note (insn, REG_BR_PROB, 0));
-      add_reg_note (insn, REG_BR_PROB, GEN_INT (prob));
+      if (!find_reg_note (insn, REG_BR_PROB, 0))
+        add_reg_note (insn, REG_BR_PROB, GEN_INT (prob));
     }
 }