https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67002
--- Comment #20 from Oleg Endo <olegendo at gcc dot gnu.org> --- (In reply to Kazumoto Kojima from comment #19) > (In reply to Kazumoto Kojima from comment #18) > In the problematic situation, get_max_insn_count returns the false > value after > > if (MAY_HAVE_DEBUG_INSNS) > expand_debug_locations (); > > in pass_expand::execute (function *fun). expand_debug_locations > calls sh_recog_treg_set_expr indirectly at this very early stage > to compute rtx costs. sh_recog_treg_set_expr makes some set insns > and they cause the differences of cur_insn_uid with -g. Thank you very much for tracking this down. > Oleg, how about the patch below? Yes, that looks OK. treg_set_expr-something recog matching is actually only required during combine. The simpler forms like (reg:SI T_REG) could also be required during expansion. > My first trial was --cur_insn_uid just > after make_insn_raw there but I'm afraid that it will make another > surprise. Hm ... actually it should work. The temporary rtx insn is not used for anything else, so that assigned insn uid will never appear anywhere. However, it's probably better to have one "static rtx_insn" to avoid constructing the temporary rtx over and over again. Unfortunately the gen_rtx* functions allocate rtx objects always on the GC heap.