On Sun, Apr 18, 2021 at 12:03:39PM -0500, Segher Boessenkool wrote:
> On Sun, Apr 18, 2021 at 05:24:50PM +0200, Jakub Jelinek wrote:
> > On Sun, Apr 18, 2021 at 03:03:07PM +0000, Segher Boessenkool wrote:
> > > If the register named in an existing REG_UNUSED note dies somewhere
> > > between where the note used to be and I3, we should just drop it.

> > And, shouldn't the
> >   record_value_for_reg (XEXP (note, 0), NULL, NULL_RTX);
> > be called in some cases?
> 
> I don't see why?  We don't remove any clobber or set, just the REG_UNUSED
> note?
> 
> > To me it would make more sense to add the if (reg_set_between_p (...)) 
> > break;
> > to the individual cases later, so before
> >               if (! (REG_P (XEXP (note, 0))
> >                      ? find_regno_note (i3, REG_UNUSED, REGNO (XEXP (note, 
> > 0)))
> >                      : find_reg_note (i3, REG_UNUSED, XEXP (note, 0))))
> >                 place = i3;
> > and before
> >               PUT_REG_NOTE_KIND (note, REG_DEAD);
> >               place = i3;
> > and into the
> >               if (from_insn != i3 && i2 && INSN_P (i2)
> >                   && reg_referenced_p (XEXP (note, 0), PATTERN (i2)))
> > but there just checking if it isn't set in between from_insn and i2
> 
> But the REG_UNUSED note should just be dropped in all these cases, so it
> is much simpler code to do it like this.  Or am I missing something?

I have now tested this on kernel builds on all supported archs (and
variations; 31 builds, mostly defconfigs, some bigger).  The patch
changed generated code in no single place, so we're good probably :-)


Segher

Reply via email to