Re: [PATCH] cse: Fix up delete_trivially_dead_insns [PR119594]

2025-04-04 Thread Richard Sandiford
Jakub Jelinek writes: > Hi! > > The following testcase is miscompiled by delete_trivially_dead_insns, > latently since r0-6313, actually since r15-1575. > > The problem is in that r0-6313 change, which made count_reg_usage not > count uses of the pseudo which the containing SET sets. That is need

Re: [PATCH] cse: Fix up delete_trivially_dead_insns [PR119594]

2025-04-04 Thread Richard Sandiford
Jakub Jelinek writes: > On Fri, Apr 04, 2025 at 01:56:31PM +0100, Richard Sandiford wrote: >> My suggestion isn't elegant, but: once we've decided not to delete >> an instruction, we need to keep all definitions of all registers used >> by the instruction (given the way that the algorithm works).

Re: [PATCH] cse: Fix up delete_trivially_dead_insns [PR119594]

2025-04-04 Thread Jakub Jelinek
On Fri, Apr 04, 2025 at 01:56:31PM +0100, Richard Sandiford wrote: > My suggestion isn't elegant, but: once we've decided not to delete > an instruction, we need to keep all definitions of all registers used > by the instruction (given the way that the algorithm works). So how > about instead just

Re: [PATCH] cse: Fix up delete_trivially_dead_insns [PR119594]

2025-04-04 Thread Eric Botcazou
> The problem is in that r0-6313 change, which made count_reg_usage not > count uses of the pseudo which the containing SET sets. That is needed > so we can delete those instructions as trivially dead if they are really > dead, but has the following problem. After fwprop proper we have: > (insn 7

Re: [PATCH] cse: Fix up delete_trivially_dead_insns [PR119594]

2025-04-04 Thread Eric Botcazou
> I'm afraid having different behavior for incr > 0 and incr < 0 could be a > problem, then we would not decrease it even if we've increased it > previously, so this would make setters of that REGNO effectively > undeletable. Yes, the setters that are before it in the RTL stream, which is precisel

Re: [PATCH] cse: Fix up delete_trivially_dead_insns [PR119594]

2025-04-04 Thread Jakub Jelinek
On Fri, Apr 04, 2025 at 01:08:31PM +0200, Eric Botcazou wrote: > I guess the question is: how much do we pessimize if we tweak r0-6313 change? > For example, we could say that a use of REG in the SET_SRC does not count if > REG is also set in the SET_DEST *only* if there is no previous use of REG: