Hi! On Mon, Sep 10, 2018 at 12:59:19PM +0200, Ilya Leoshkevich wrote: > Consider the following RTL: > > (code_label 11 10 26 4 2 (nil) [1 uses]) > (note 26 11 12 4 [bb 4] NOTE_INSN_BASIC_BLOCK) > (insn 12 26 15 4 (set (reg:SI 65) > (if_then_else:SI (eq (reg:CCZ 33 %cc) > (const_int 0 [0])) > (const_int 1 [0x1]) > (const_int 0 [0]))) "pr80080-4.c":9 1674 {*movsicc}) > (insn 15 12 16 4 (parallel [ > (set (reg:CCZ 33 %cc) > (compare:CCZ (reg:SI 65) > (const_int 0 [0]))) > (clobber (scratch:SI)) > ]) "pr80080-4.c":9 1216 {*tstsi_cconly_extimm}) > (jump_insn 16 15 17 4 (set (pc) > (if_then_else (ne (reg:CCZ 33 %cc) > (const_int 0 [0])) > (label_ref:DI 23) > (pc))) "pr80080-4.c":9 1897 {*cjump_64}) > > Combine simplifies this into: > > (code_label 11 10 26 4 2 (nil) [1 uses]) > (note 26 11 12 4 [bb 4] NOTE_INSN_BASIC_BLOCK) > (note 12 26 15 4 NOTE_INSN_DELETED) > (note 15 12 16 4 NOTE_INSN_DELETED) > (jump_insn 16 15 17 4 (set (pc) > (if_then_else (eq (reg:CCZ 33 %cc) > (const_int 0 [0])) > (label_ref:DI 23) > (pc))) "pr80080-4.c":9 1897 {*cjump_64}) > > opening up the possibility to perform jump threading. Since this > happens infrequently, perform jump threading only when there is a > changed basic block, whose sole side effect is a trailing jump.
So this happens because now there is *only* a conditional jump in this BB? Could you please show generated code before and after this patch? I mean generated assembler code. What -S gives you. > +/* Return true iff the only side effect of BB is its trailing jump_insn. */ > + > +static bool > +is_single_jump_bb (basic_block bb) > +{ > + rtx_insn *end = BB_END (bb); > + rtx_insn *insn; > + > + if (!JUMP_P (end)) > + return false; > + > + for (insn = BB_HEAD (bb); insn != end; insn = NEXT_INSN (insn)) > + if (INSN_P (insn) && side_effects_p (PATTERN (insn))) > + return false; > + return true; > +} Hrm, so it is more than that. Why does the existing jump threading not work for you; should it happen at another time? Segher