Hi! On Wed, Feb 16, 2022 at 09:53:34AM +0100, Jakub Jelinek wrote: > On the following testcase on aarch64-linux, we behave differently > with -g and -g0.
[ huge snip ] > The following patch fixes that by instead ignoring debug insns during the > searching. We can still check BLOCK_FOR_INSN (insn) on those, because > if we notice DEBUG_INSN in a following basic block, necessarily there won't > be any further normal insns in the current block after it. > --- gcc/combine.cc.jj 2022-02-11 13:51:56.294928090 +0100 > +++ gcc/combine.cc 2022-02-15 14:15:41.663012950 +0100 > @@ -4223,10 +4223,12 @@ try_combine (rtx_insn *i3, rtx_insn *i2, > for (rtx_insn *insn = NEXT_INSN (i3); > !done > && insn > - && NONDEBUG_INSN_P (insn) > + && INSN_P (insn) > && BLOCK_FOR_INSN (insn) == this_basic_block; > insn = NEXT_INSN (insn)) > { > + if (DEBUG_INSN_P (insn)) > + continue; > struct insn_link *link; > FOR_EACH_LOG_LINK (link, insn) > if (link->insn == i3 && link->regno == regno) About half of the similar loops in combine.c are still broken this way, from a quick sampling :-( Okay for trunk and all backports you may want. Thanks! Segher