On 11/10/26 4:49 AM, SOURADIPTO DAS wrote:
On Tue, Nov 10, 2026 at 7:09 AM Jeff Law
<[email protected]> wrote:
>
>
>
> On 11/8/26 9:12 AM, Souradipto Das wrote:
> > This patch removes the copy insn from the form
> >
> > (insn 9 8 11 3 (set (reg:DI 137)
> > (sign_extend:DI (plus:SI (subreg/s/u:SI (reg/v:DI 135 [ x
]) 0)
> > (const_int 1 [0x1])))) "test.c":3:24 discrim 1 6
{addsi3_extended}
> > (expr_list:REG_DEAD (reg/v:DI 135 [ x ])
> > (nil)))
> > (insn 11 9 24 3 (set (reg:DI 134 [ <retval> ])
> > (reg:DI 137)) "test.c":3:24 discrim 1 275 {*movdi_64bit}
> > (nil))
> >
> > by deleting the copy which is insn 11 in this case and
substituting the return value
> > register into insn 9 and thereby making the block simple for
noce_try_cond_arith to
> > succeed and produce the optimal code as in :
> >
> > test_05_3:
> > sgt a5,a0,zero
> > addw a0,a5,a0
> > ret
> >
> > The patch also additionally checks if the src of the else set is a
simple register
> > without which it produces branched instructions for cases where
the src is a sign
> > extend.
> >
> > This patch was bootstrapped and regtested in local
x86_64-pc-linux-gnu with no new
> > fails and cross compile tested on qemu as riscv64-linux-gnu with
no new fails.
> > Is this patch safe for trunk?
> >
> > gcc/ChangeLog:
> >
> > PR rtl-optimization/122335
> > * ifcvt.cc (*noce_process_if_block) : Added checks to safely
delete the copy insn.
> >
> > gcc/testsuite/ChangeLog:
> >
> > PR rtl-optimization/122335
> > * gcc.target/riscv/pr122335.c : New Test.
> >
> > Signed-off-by: Souradipto Das <[email protected]>
> Sashiko flagged several concerns. I haven't not looked at them in
> detail, but if you could and either spin a V2 with the real issues fixed
> or note why the Sashiko issues were false positives, it'd be
appreciated.
>
>
https://gcc.sashiko.dev/#/patchset/20261108161230.227969-1-souradiptodas6%40gmail.com
>
Thank you so much for your reply. I will send a V2 after updating this
patch as soon as possible.
> You also need to either put your contribution under the terms of the DCO
> or get a copyright assignment on file. This is large enough to trigger
> copyright interest.
Actually I read https://gcc.gnu.org/dco.html and thought a
'Signed-off-by" tag would do.
Please tell me if I am supposed to do anything else for the terms of DCO.
Ugh. I missed your Signed-off-by tag. My fault, yesterday was a long
day....
So we just need to work through the Sashiko questions.
jeff