https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67061
--- Comment #4 from Oleg Endo <olegendo at gcc dot gnu.org> --- (In reply to Kazumoto Kojima from comment #2) > > where reg is r2 and curr_insn is the insn 31. sh_find_set_of_reg is > stepping backward from the insn 31 but the call_insn 29 is missed. > > Does the patch below work? > > Oleg, it's the same one we've discussed, I think. Thought? Same function, different problem, and all are true :) The previous issue was that sh_find_set_of_reg does not check if an insn clobbers the searched reg. Usually set_of will find a regular clobber in the insn. For calls that clobber some hardregs it doesn't work. This requires additional calls to 'modified_in_p'. This issue here is that it doesn't understand that the call_insn sets the searched reg. Your patch works for this particular case, but I think the better fix for this would be to just use INSN_P instead of NONJUMP_INSN_P. Then we don't need the REGNO check. I've planted the assert (which got us here) to catch inconsistencies of the return value. Even if sh_find_set_of_reg skips over the the call_insn because of the !NONJUMP_INSN_P, the return value should be consistent. So there is another problem. I'll work on a patch for that.