public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <jeffreyalaw@gmail.com>
To: Fei Gao <gaofei@eswincomputing.com>, Kito Cheng <kito.cheng@gmail.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>,
	Palmer Dabbelt <palmer@dabbelt.com>
Subject: Re: [PATCH 0/2] fix RISC-V zcmp popretz [PR113715]
Date: Wed, 5 Jun 2024 07:58:30 -0600	[thread overview]
Message-ID: <7b05a5c0-ccb6-4ea4-b42a-4c74a70f483f@gmail.com> (raw)
In-Reply-To: <2024060515473154362425@eswincomputing.com>



On 6/5/24 1:47 AM, Fei Gao wrote:
> 
> On 2024-06-05 14:36  Kito Cheng <kito.cheng@gmail.com> wrote:
>>
>> Thanks for fixing this issue, and I am wondering doest it possible to
>> fix that without introduce target hook? I ask that because...GCC 14
>> also has this bug, but I am not sure it's OK to introduce new target
>> hook for release branch? or would you suggest we just revert patch to
>> fix that on GCC 14?
> 
> If hook is unacceptable in GCC14, I suggest to revert on GCC 14 the following commit.
> https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=b27d323a368033f0b37e93c57a57a35fd9997864
> 
> I started fixing this issue by adding changes in mach pass but abandoned it
> due to the following reasons:
> 1. more codes to detect location of epilogue in the whole insn list.
> 2. due to impact by scheduling pass, clear a0 and use a0 insns get reordered, resulting in more
>      codes.
> 3. data flow analysis is needed, but insn does't have bb info any more, so rescan actually does
>      nothing, which I guess there's some hidden issue in riscv_remove_unneeded_save_restore_calls
>      using dfa.
> 
> So I came up this hook based patch in prologue and epilogue pass to make the optimization
> happen as earlier as possible. It ends up with simplicity and clear logic.
But let's back up and get a good explanation of what the problem is. 
Based on patch 2/2 it looks like we have lost an assignment to the 
return register.

To someone not familiar with this code, it sounds to me like we've made 
a mistake earlier and we're now defining a hook that lets us go back and 
fix that earlier mistake.   I'm probably wrong, but so far that's what 
it sounds like.

So let's get a good explanation of the problem and perhaps we'll find a 
better way to solve it.

jeff



  reply	other threads:[~2024-06-05 13:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-05  1:50 Fei Gao
2024-06-05  1:50 ` [PATCH 1/2] target hooks: allow post processing after epilogue inserted Fei Gao
2024-06-05  1:50 ` [PATCH 2/2] [RISC-V]: fix zcmp popretz [PR113715] Fei Gao
2024-06-05  6:36 ` [PATCH 0/2] fix RISC-V " Kito Cheng
2024-06-05  7:47   ` Fei Gao
2024-06-05 13:58     ` Jeff Law [this message]
2024-06-06  2:42       ` Fei Gao
2024-06-08 20:36         ` Jeff Law
2024-06-28 10:46           ` Fei Gao
2024-06-05 13:51   ` Jeff Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7b05a5c0-ccb6-4ea4-b42a-4c74a70f483f@gmail.com \
    --to=jeffreyalaw@gmail.com \
    --cc=gaofei@eswincomputing.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=kito.cheng@gmail.com \
    --cc=palmer@dabbelt.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).