On Fri, Apr 04, 2025 at 07:51:54PM +0200, Jakub Jelinek wrote:
> On Fri, Apr 04, 2025 at 03:06:52PM +0100, Richard Sandiford wrote:
> > > 2025-04-04 Jakub Jelinek <[email protected]>
> > >
> > > PR rtl-optimization/119594
> > > * cse.cc (count_reg_usage): If INCR is 0, increment by 1 counts
> > > of encountered REGs equal to dest rather than incrementing by INCR
> > > counts of REGs not equal to dest.
> > > (delete_trivially_dead_insns): For kept non-DEBUG instructions
> > > call count_reg_usage with INCR 0.
> > >
> > > * gcc.dg/pr119594.c: New test.
>
> This bootstrapped/regtested successfully on x86_64-linux and i686-linux.
>
> > ...this looks ok to me as well. The reason for suggesting DF_INSN_USES
> > was that I thought it might be faster, and since it would be ok in that
> > context to err on the side of counting, without the precision needed
> > by count_reg_usage.
> >
> > On the PARALLEL thing: maybe at this stage it would be better to do the
> > minimum. Not a strong opinion though.
> >
> > So OK from my POV, but please give others time to comment.
>
> Though, Eric's version (slightly tweaked) seems to work on the testcase fine
> as well and is cheaper. Shall we go with that (if it passes
> bootstrap/regtest)?
>
> 2025-04-04 Eric Botcazou <[email protected]>
> Jakub Jelinek <[email protected]>
>
> PR rtl-optimization/119594
> * cse.cc (count_reg_usage): Count even x == dest regs if they have
> non-zero counts already and incr is positive.
>
> * gcc.dg/pr119594.c: New test.
That one passed bootstrap/regtest on x86_64-linux and i686-linux
successfully as well.
Jakub