[v2] regrename: Skip renaming if instruction is noop move.

Message ID 20211203042635.5547-1-rjiejie@linux.alibaba.com
State Committed
Commit a888259a71fbbb7f14923751251e056829d76342
Headers
Series [v2] regrename: Skip renaming if instruction is noop move. |

Commit Message

Jojo R Dec. 3, 2021, 4:26 a.m. UTC
  Skip renaming if instruction is noop move, and it will
been removed for performance.

gcc/
	* regrename.c (find_rename_reg): Return satisfied regno
	if instruction is noop move.
---
 gcc/regrename.c | 5 +++++
 1 file changed, 5 insertions(+)
  

Comments

Jeff Law Dec. 3, 2021, 2:57 p.m. UTC | #1
On 12/2/2021 9:26 PM, Jojo R wrote:
> Skip renaming if instruction is noop move, and it will
> been removed for performance.
>
> gcc/
> 	* regrename.c (find_rename_reg): Return satisfied regno
> 	if instruction is noop move.
OK
jeff
  
Jojo R Dec. 14, 2021, 1:40 a.m. UTC | #2
Hi,

	Thank you for your review & help.

	I could not fetch the merged patch from gcc master of git.

	Is there any problem for this ?

Thanks.

— Jojo
在 2021年12月3日 +0800 PM10:57,Jeff Law <jeffreyalaw@gmail.com>,写道:
>
>
> On 12/2/2021 9:26 PM, Jojo R wrote:
> > Skip renaming if instruction is noop move, and it will
> > been removed for performance.
> >
> > gcc/
> > * regrename.c (find_rename_reg): Return satisfied regno
> > if instruction is noop move.
> OK
> jeff
  
Jeff Law Dec. 14, 2021, 9:56 p.m. UTC | #3
On 12/13/2021 6:40 PM, Jojo R wrote:
> Hi,
>
> Thank you for your review & help.
>
> I could not fetch the merged patch from gcc master of git.
>
> Is there any problem for this ?
I assumed you'd commit the change.  I thought you had commit 
privileges.   I'll go ahead and push it momentarily.

Thanks for following up.

Jeff
  

Patch

diff --git a/gcc/regrename.c b/gcc/regrename.c
index b8a9ca36f22..fe72fcc3624 100644
--- a/gcc/regrename.c
+++ b/gcc/regrename.c
@@ -394,6 +394,11 @@  find_rename_reg (du_head_p this_head, enum reg_class super_class,
 			  this_head, *unavailable))
     return this_head->tied_chain->regno;
 
+  /* If this insn is a noop move, then do not rename in this chain as doing so
+     would inhibit removal of the noop move.  */
+  if (noop_move_p (this_head->first->insn))
+    return best_new_reg;
+
   /* If PREFERRED_CLASS is not NO_REGS, we iterate in the first pass
      over registers that belong to PREFERRED_CLASS and try to find the
      best register within the class.  If that failed, we iterate in