public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] s390: Check for ADDR_REGS in s390_decompose_addrstyle_without_index
@ 2024-06-26 12:15 Stefan Schulze Frielinghaus
  2024-06-26 13:15 ` Richard Sandiford
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Stefan Schulze Frielinghaus @ 2024-06-26 12:15 UTC (permalink / raw)
  To: krebbel, gcc-patches; +Cc: rsandifo, Stefan Schulze Frielinghaus

An explicit check for address registers was not required so far since
during register allocation the processing of address constraints was
sufficient.  However, address constraints themself do not check for
REGNO_OK_FOR_{BASE,INDEX}_P.  Thus, with the newly introduced
late-combine pass in r15-1579-g792f97b44ffc5e we generate new insns with
invalid address registers which aren't fixed up afterwards.

Fixed by explicitly checking for address registers in
s390_decompose_addrstyle_without_index such that those new insns are
rejected.

gcc/ChangeLog:

	target/PR115634
	* config/s390/s390.cc (s390_decompose_addrstyle_without_index):
	Check for ADDR_REGS in s390_decompose_addrstyle_without_index.
---
 This restores bootstrap on s390.  I ran the testsuite against mainline
 and of course there is some fallout which is most likely coming from
 the new pass or other changes.  I have another job running comparing
 pre r15-1579-g792f97b44ffc5e with and without this patch.  Assuming
 this goes well, ok for mainline?

 gcc/config/s390/s390.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/config/s390/s390.cc b/gcc/config/s390/s390.cc
index c65421de831..05a0fde7fb0 100644
--- a/gcc/config/s390/s390.cc
+++ b/gcc/config/s390/s390.cc
@@ -3347,7 +3347,9 @@ s390_decompose_addrstyle_without_index (rtx op, rtx *base,
   while (op && GET_CODE (op) == SUBREG)
     op = SUBREG_REG (op);
 
-  if (op && GET_CODE (op) != REG)
+  if (op && (!REG_P (op)
+	     || (reload_completed
+		 && !REGNO_OK_FOR_BASE_P (REGNO (op)))))
     return false;
 
   if (offset)
-- 
2.45.1


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

* Re: [PATCH] s390: Check for ADDR_REGS in s390_decompose_addrstyle_without_index
  2024-06-26 12:15 [PATCH] s390: Check for ADDR_REGS in s390_decompose_addrstyle_without_index Stefan Schulze Frielinghaus
@ 2024-06-26 13:15 ` Richard Sandiford
  2024-06-26 17:10 ` Stefan Schulze Frielinghaus
  2024-06-27 13:12 ` Andreas Krebbel
  2 siblings, 0 replies; 4+ messages in thread
From: Richard Sandiford @ 2024-06-26 13:15 UTC (permalink / raw)
  To: Stefan Schulze Frielinghaus; +Cc: krebbel, gcc-patches

Stefan Schulze Frielinghaus <stefansf@gcc.gnu.org> writes:
> An explicit check for address registers was not required so far since
> during register allocation the processing of address constraints was
> sufficient.  However, address constraints themself do not check for
> REGNO_OK_FOR_{BASE,INDEX}_P.  Thus, with the newly introduced
> late-combine pass in r15-1579-g792f97b44ffc5e we generate new insns with
> invalid address registers which aren't fixed up afterwards.
>
> Fixed by explicitly checking for address registers in
> s390_decompose_addrstyle_without_index such that those new insns are
> rejected.

Thanks for fixing this.  LGTM FWIW.

Richard

> gcc/ChangeLog:
>
> 	target/PR115634
> 	* config/s390/s390.cc (s390_decompose_addrstyle_without_index):
> 	Check for ADDR_REGS in s390_decompose_addrstyle_without_index.
> ---
>  This restores bootstrap on s390.  I ran the testsuite against mainline
>  and of course there is some fallout which is most likely coming from
>  the new pass or other changes.  I have another job running comparing
>  pre r15-1579-g792f97b44ffc5e with and without this patch.  Assuming
>  this goes well, ok for mainline?
>
>  gcc/config/s390/s390.cc | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/config/s390/s390.cc b/gcc/config/s390/s390.cc
> index c65421de831..05a0fde7fb0 100644
> --- a/gcc/config/s390/s390.cc
> +++ b/gcc/config/s390/s390.cc
> @@ -3347,7 +3347,9 @@ s390_decompose_addrstyle_without_index (rtx op, rtx *base,
>    while (op && GET_CODE (op) == SUBREG)
>      op = SUBREG_REG (op);
>  
> -  if (op && GET_CODE (op) != REG)
> +  if (op && (!REG_P (op)
> +	     || (reload_completed
> +		 && !REGNO_OK_FOR_BASE_P (REGNO (op)))))
>      return false;
>  
>    if (offset)

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

* Re: [PATCH] s390: Check for ADDR_REGS in s390_decompose_addrstyle_without_index
  2024-06-26 12:15 [PATCH] s390: Check for ADDR_REGS in s390_decompose_addrstyle_without_index Stefan Schulze Frielinghaus
  2024-06-26 13:15 ` Richard Sandiford
@ 2024-06-26 17:10 ` Stefan Schulze Frielinghaus
  2024-06-27 13:12 ` Andreas Krebbel
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Schulze Frielinghaus @ 2024-06-26 17:10 UTC (permalink / raw)
  To: Stefan Schulze Frielinghaus; +Cc: krebbel, gcc-patches, rsandifo

On Wed, Jun 26, 2024 at 02:15:18PM +0200, Stefan Schulze Frielinghaus wrote:
> An explicit check for address registers was not required so far since
> during register allocation the processing of address constraints was
> sufficient.  However, address constraints themself do not check for
> REGNO_OK_FOR_{BASE,INDEX}_P.  Thus, with the newly introduced
> late-combine pass in r15-1579-g792f97b44ffc5e we generate new insns with
> invalid address registers which aren't fixed up afterwards.
> 
> Fixed by explicitly checking for address registers in
> s390_decompose_addrstyle_without_index such that those new insns are
> rejected.
> 
> gcc/ChangeLog:
> 
> 	target/PR115634
> 	* config/s390/s390.cc (s390_decompose_addrstyle_without_index):
> 	Check for ADDR_REGS in s390_decompose_addrstyle_without_index.
> ---
>  This restores bootstrap on s390.  I ran the testsuite against mainline
>  and of course there is some fallout which is most likely coming from
>  the new pass or other changes.  I have another job running comparing
>  pre r15-1579-g792f97b44ffc5e with and without this patch.  Assuming
>  this goes well, ok for mainline?

Bootstrap and regtest of this test went also fine.

> 
>  gcc/config/s390/s390.cc | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/gcc/config/s390/s390.cc b/gcc/config/s390/s390.cc
> index c65421de831..05a0fde7fb0 100644
> --- a/gcc/config/s390/s390.cc
> +++ b/gcc/config/s390/s390.cc
> @@ -3347,7 +3347,9 @@ s390_decompose_addrstyle_without_index (rtx op, rtx *base,
>    while (op && GET_CODE (op) == SUBREG)
>      op = SUBREG_REG (op);
>  
> -  if (op && GET_CODE (op) != REG)
> +  if (op && (!REG_P (op)
> +	     || (reload_completed
> +		 && !REGNO_OK_FOR_BASE_P (REGNO (op)))))
>      return false;
>  
>    if (offset)
> -- 
> 2.45.1
> 

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

* Re: [PATCH] s390: Check for ADDR_REGS in s390_decompose_addrstyle_without_index
  2024-06-26 12:15 [PATCH] s390: Check for ADDR_REGS in s390_decompose_addrstyle_without_index Stefan Schulze Frielinghaus
  2024-06-26 13:15 ` Richard Sandiford
  2024-06-26 17:10 ` Stefan Schulze Frielinghaus
@ 2024-06-27 13:12 ` Andreas Krebbel
  2 siblings, 0 replies; 4+ messages in thread
From: Andreas Krebbel @ 2024-06-27 13:12 UTC (permalink / raw)
  To: Stefan Schulze Frielinghaus, gcc-patches; +Cc: rsandifo

On 6/26/24 14:15, Stefan Schulze Frielinghaus wrote:
> An explicit check for address registers was not required so far since
> during register allocation the processing of address constraints was
> sufficient.  However, address constraints themself do not check for
> REGNO_OK_FOR_{BASE,INDEX}_P.  Thus, with the newly introduced
> late-combine pass in r15-1579-g792f97b44ffc5e we generate new insns with
> invalid address registers which aren't fixed up afterwards.
>
> Fixed by explicitly checking for address registers in
> s390_decompose_addrstyle_without_index such that those new insns are
> rejected.
>
> gcc/ChangeLog:
>
> 	target/PR115634
> 	* config/s390/s390.cc (s390_decompose_addrstyle_without_index):
> 	Check for ADDR_REGS in s390_decompose_addrstyle_without_index.

Ok. Thanks!


Andreas



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

end of thread, other threads:[~2024-06-27 13:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-26 12:15 [PATCH] s390: Check for ADDR_REGS in s390_decompose_addrstyle_without_index Stefan Schulze Frielinghaus
2024-06-26 13:15 ` Richard Sandiford
2024-06-26 17:10 ` Stefan Schulze Frielinghaus
2024-06-27 13:12 ` Andreas Krebbel

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