public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] PR101260 regcprop: Add mode change check for copy reg
@ 2022-01-21 16:52 Andreas Krebbel
  2022-01-28 18:48 ` Jeff Law
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Krebbel @ 2022-01-21 16:52 UTC (permalink / raw)
  To: gcc-patches

When propagating a multi-word register into an access with a smaller
mode the can_change_mode backend hook is already consulted for the
original register.  This however is also required for the intermediate
copy in copy_regno which might use a different register class.

Bootstrapped on x86_64 and s390x. No testsuite regressions.

Ok for mainline?

gcc/ChangeLog:

	PR rtl-optimization/101260
	* regcprop.cc (maybe_mode_change): Invoke mode_change_ok also for
	copy_regno.
---
 gcc/regcprop.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/regcprop.cc b/gcc/regcprop.cc
index 1a9bcf0a1ad..8e966f2b5ac 100644
--- a/gcc/regcprop.cc
+++ b/gcc/regcprop.cc
@@ -426,7 +426,8 @@ maybe_mode_change (machine_mode orig_mode, machine_mode copy_mode,
 
   if (orig_mode == new_mode)
     return gen_raw_REG (new_mode, regno);
-  else if (mode_change_ok (orig_mode, new_mode, regno))
+  else if (mode_change_ok (orig_mode, new_mode, regno)
+	   && mode_change_ok (copy_mode, new_mode, copy_regno))
     {
       int copy_nregs = hard_regno_nregs (copy_regno, copy_mode);
       int use_nregs = hard_regno_nregs (copy_regno, new_mode);
-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] PR101260 regcprop: Add mode change check for copy reg
  2022-01-21 16:52 [PATCH] PR101260 regcprop: Add mode change check for copy reg Andreas Krebbel
@ 2022-01-28 18:48 ` Jeff Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2022-01-28 18:48 UTC (permalink / raw)
  To: Andreas Krebbel, gcc-patches



On 1/21/2022 9:52 AM, Andreas Krebbel via Gcc-patches wrote:
> When propagating a multi-word register into an access with a smaller
> mode the can_change_mode backend hook is already consulted for the
> original register.  This however is also required for the intermediate
> copy in copy_regno which might use a different register class.
>
> Bootstrapped on x86_64 and s390x. No testsuite regressions.
>
> Ok for mainline?
>
> gcc/ChangeLog:
>
> 	PR rtl-optimization/101260
> 	* regcprop.cc (maybe_mode_change): Invoke mode_change_ok also for
> 	copy_regno.
I'd been sitting on Stefan's patch because it just didn't feel right, 
but I also knew I'd need to dig further into it to either resolve my 
concerns or be able to express them clearly to Stefan.

I like this patch much better :-)  OK for the trunk.  Bonus points if 
you pick up Stefan's testcase from way back in October.

Jeff

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-28 18:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-21 16:52 [PATCH] PR101260 regcprop: Add mode change check for copy reg Andreas Krebbel
2022-01-28 18:48 ` Jeff Law

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).