public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] PR rtl-optimization/100263: Ensure register can change mode
@ 2021-05-05  7:20 Stefan Schulze Frielinghaus
  2021-05-05 10:29 ` Eric Botcazou
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Schulze Frielinghaus @ 2021-05-05  7:20 UTC (permalink / raw)
  To: gcc-patches, ebotcazou

For move2add_valid_value_p we also have to ask the target whether a
register can be accessed in a different mode than it was set before.

gcc/ChangeLog:

	PR rtl-optimization/100263
	* postreload.c (move2add_valid_value_p): Ensure register can
	change mode.

Bootstrapped and regtested releases/gcc-{8,9,10,11} and master on IBM Z.
Ok for those branches?

---
 gcc/postreload.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/postreload.c b/gcc/postreload.c
index dc67643384d..60a622dbaf3 100644
--- a/gcc/postreload.c
+++ b/gcc/postreload.c
@@ -1725,7 +1725,8 @@ move2add_valid_value_p (int regno, scalar_int_mode mode)
     {
       scalar_int_mode old_mode;
       if (!is_a <scalar_int_mode> (reg_mode[regno], &old_mode)
-	  || !MODES_OK_FOR_MOVE2ADD (mode, old_mode))
+	  || !MODES_OK_FOR_MOVE2ADD (mode, old_mode)
+	  || !REG_CAN_CHANGE_MODE_P (regno, old_mode, mode))
 	return false;
       /* The value loaded into regno in reg_mode[regno] is also valid in
 	 mode after truncation only if (REG:mode regno) is the lowpart of
-- 
2.23.0


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

* Re: [PATCH] PR rtl-optimization/100263: Ensure register can change mode
  2021-05-05  7:20 [PATCH] PR rtl-optimization/100263: Ensure register can change mode Stefan Schulze Frielinghaus
@ 2021-05-05 10:29 ` Eric Botcazou
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Botcazou @ 2021-05-05 10:29 UTC (permalink / raw)
  To: Stefan Schulze Frielinghaus; +Cc: gcc-patches

> For move2add_valid_value_p we also have to ask the target whether a
> register can be accessed in a different mode than it was set before.
> 
> gcc/ChangeLog:
> 
> 	PR rtl-optimization/100263
> 	* postreload.c (move2add_valid_value_p): Ensure register can
> 	change mode.
> 
> Bootstrapped and regtested releases/gcc-{8,9,10,11} and master on IBM Z.
> Ok for those branches?

Yes, OK everywhere, thanks.

-- 
Eric Botcazou



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

end of thread, other threads:[~2021-05-05 10:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-05  7:20 [PATCH] PR rtl-optimization/100263: Ensure register can change mode Stefan Schulze Frielinghaus
2021-05-05 10:29 ` Eric Botcazou

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