On Fri, May 15, 2026 at 11:18:38AM +0200, Stefan Schulze Frielinghaus wrote:
> From: Stefan Schulze Frielinghaus <[email protected]>
> 
> For the attached test we end up during IRA with
> 
> 6: r99:DI=`s'
>   REG_EQUIV `s'
> 7: {[`b']=asm_operands;
>     [const(`s'+0x4)]=asm_operands;
>     [`a']=asm_operands;clobber flags:CC;}
>   REG_DEAD r99:DI
>   REG_UNUSED flags:CC
> 
> where r99 is used in each asm_operands
> 
> (mem/c:SI (plus:DI (reg/f:DI 99)
>                    (const_int 4 [0x4])) [2 s.d+0 S4 A32])
> 
> This in turn means that we hit multiple times the very same insn while
> iterating over all uses of r99 which in the end triggers the assert.
> 
> This patch relaxes the assert since what we want to ensure here is that
> a register is not used by multiple insns since otherwise we cannot
> trivially move or delete the definition.
> 
>       PR rtl-optimization/125173
> 
> gcc/ChangeLog:
> 
>       * ira.cc (combine_and_move_insns): Allow multiple uses within
>       an insn.
> 
> gcc/testsuite/ChangeLog:
> 
>       * gcc.dg/pr125173-1.c: New test.
> ---
> 
> Notes:
>     Bootstrapped and regtested on
>     - aarch64-unknown-linux-gnu
>     - powerpc64le-unknown-linux-gnu
>     - s390x-ibm-linux-gnu
>     - x86_64-pc-linux-gnu
>     Ok for mainline?

Forgot to ask: Ok for backporting to all open release branches?  The fix
is in trunk for two weeks, now, and it was reproducible for me until gcc
8 (probably even earlier but I stopped at 8).  Furthermore, the fix
seems innocent in the sense that its effects are local.

Cheers,
Stefan

Reply via email to