On Mon, Jul 25, 2016 at 02:28:28PM +0200, Georg-Johann Lay wrote: > (insn 43 31 44 2 (set (reg:QI 18 r18) > (const_int 0 [0])) bug-combin.c:29 56 {movqi_insn} > (nil))
> (insn 51 50 52 2 (set (reg:QI 16 r16) > (const_int 40 [0x28])) bug-combin.c:29 56 {movqi_insn} > (nil)) > (insn 52 51 61 2 (set (reg:DI 18 r18) > (ashiftrt:DI (reg:DI 18 r18) > (reg:QI 16 r16))) bug-combin.c:29 1417 {ashrdi3_insn} > (expr_list:REG_DEAD (reg:QI 16 r16) > (nil))) > /* An arithmetic right shift of a quantity known to be -1 or 0 > is a no-op. */ > if (code == ASHIFTRT > && (num_sign_bit_copies (varop, shift_mode) > == GET_MODE_PRECISION (shift_mode))) > { > count = 0; > break; > } > > num_sign_bit_copies() eventually calls > combine.c::reg_num_sign_bit_copies_for_combine() > > which returns const0_rtx because reg 18 is set in insn 43 to const0_rtx. > Total outcome is that the right shift of reg:DI 18 is transformed to a > no-op move and cancelled out in the remainder. Why does num_sign_bit_copies return something bigger than 8? > IIUC get_last_value should return 0 in this case? > > /* If we don't have a value, or if it isn't for this basic block and > it's either a hard register, set more than once, or it's a live > at the beginning of the function, return 0. We do have a value, and it is for this bb. Segher