public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/94248] New: [amdgcn] Doesn't build with RTL checking
@ 2020-03-21 11:27 tschwinge at gcc dot gnu.org
  2020-03-21 14:39 ` [Bug target/94248] " jakub at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: tschwinge at gcc dot gnu.org @ 2020-03-21 11:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94248

            Bug ID: 94248
           Summary: [amdgcn] Doesn't build with RTL checking
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: ice-checking
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tschwinge at gcc dot gnu.org
                CC: ams at gcc dot gnu.org, jules at gcc dot gnu.org
  Target Milestone: ---
            Target: amdgcn

Building (for offloading) a '--target=amdgcn-amdhsa' GCC with
'--enable-checking=yes,extra,rtl' fails:

    during RTL pass: split2
    [...]/source-gcc/libgcc/libgcc2.c: In function '__absvdi2':
    [...]/source-gcc/libgcc/libgcc2.c:271:1: internal compiler error: RTL
check: expected code 'reg', have 'const_int' in rhs_regno, at rtl.h:1923
      271 | }
          | ^
    0x565847 ???
            [...]/source-gcc/gcc/rtl.c:881
    0x59a8a4 ???
            [...]/source-gcc/gcc/rtl.h:1923
    0x12e3a5c ???
            [...]/source-gcc/gcc/config/gcn/gcn.md:631
    [...]
    Makefile:501: recipe for target '_absvdi2.o' failed
    make[4]: *** [_absvdi2.o] Error 1
    make[4]: Leaving directory
'[...]/build-gcc-offload-amdgcn-amdhsa/amdgcn-amdhsa/gfx900/libgcc'

I haven't made a real attempt to understand the gibberish ;-) in
'gcc/config/gcn/gcn.md', but supposedly that means we're using 'REGNO' on
something that's not a 'reg' (but a 'const_int', here) -- wrongly
entering/using (this part of?) the 'define_insn_and_split "*mov<mode>_insn"'?

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

* [Bug target/94248] [amdgcn] Doesn't build with RTL checking
  2020-03-21 11:27 [Bug target/94248] New: [amdgcn] Doesn't build with RTL checking tschwinge at gcc dot gnu.org
@ 2020-03-21 14:39 ` jakub at gcc dot gnu.org
  2020-03-23 10:43 ` tschwinge at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-21 14:39 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94248

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2020-03-21
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Either:
--- gcc/config/gcn/gcn.md.jj    2020-03-03 07:57:42.363827602 +0100
+++ gcc/config/gcn/gcn.md       2020-03-21 15:35:22.395639196 +0100
@@ -625,7 +625,7 @@ (define_insn_and_split "*mov<mode>_insn"
     rtx outhi = gen_highpart_mode (SImode, <MODE>mode, operands[0]);

     /* Ensure that overlapping registers aren't corrupted.  */
-    if (REGNO (outlo) == REGNO (inhi))
+    if (REG_P (inhi) && REGNO (outlo) == REGNO (inhi))
       {
        operands[0] = outhi;
        operands[1] = inhi;
or:
--- gcc/config/gcn/gcn.md.jj    2020-03-03 07:57:42.363827602 +0100
+++ gcc/config/gcn/gcn.md       2020-03-21 15:37:45.337552515 +0100
@@ -625,7 +625,7 @@ (define_insn_and_split "*mov<mode>_insn"
     rtx outhi = gen_highpart_mode (SImode, <MODE>mode, operands[0]);

     /* Ensure that overlapping registers aren't corrupted.  */
-    if (REGNO (outlo) == REGNO (inhi))
+    if (reg_overlap_mentioned_p (outlo, inhi))
       {
        operands[0] = outhi;
        operands[1] = inhi;
ought to fix this, but I don't yet have setup where I can sufficiently test it.
I think the latter is better and is in line what other backends are using.

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

* [Bug target/94248] [amdgcn] Doesn't build with RTL checking
  2020-03-21 11:27 [Bug target/94248] New: [amdgcn] Doesn't build with RTL checking tschwinge at gcc dot gnu.org
  2020-03-21 14:39 ` [Bug target/94248] " jakub at gcc dot gnu.org
@ 2020-03-23 10:43 ` tschwinge at gcc dot gnu.org
  2020-03-23 10:49 ` ams at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: tschwinge at gcc dot gnu.org @ 2020-03-23 10:43 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94248

--- Comment #2 from Thomas Schwinge <tschwinge at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #1)
> --- gcc/config/gcn/gcn.md.jj	2020-03-03 07:57:42.363827602 +0100
> +++ gcc/config/gcn/gcn.md	2020-03-21 15:37:45.337552515 +0100
> @@ -625,7 +625,7 @@ (define_insn_and_split "*mov<mode>_insn"
>      rtx outhi = gen_highpart_mode (SImode, <MODE>mode, operands[0]);
>  
>      /* Ensure that overlapping registers aren't corrupted.  */
> -    if (REGNO (outlo) == REGNO (inhi))
> +    if (reg_overlap_mentioned_p (outlo, inhi))
>        {
>  	operands[0] = outhi;
>  	operands[1] = inhi;
> ought to fix this

I've tested that one; no more ICE, and bit-identical code for all target
libraries, so I suppose this is good to commit (Andrew, Julian)?  If approving
this patch, please respond with "Reviewed-by: NAME <EMAIL>" so that your effort
will be recorded in the commit log, see <https://gcc.gnu.org/wiki/Reviewed-by>.

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

* [Bug target/94248] [amdgcn] Doesn't build with RTL checking
  2020-03-21 11:27 [Bug target/94248] New: [amdgcn] Doesn't build with RTL checking tschwinge at gcc dot gnu.org
  2020-03-21 14:39 ` [Bug target/94248] " jakub at gcc dot gnu.org
  2020-03-23 10:43 ` tschwinge at gcc dot gnu.org
@ 2020-03-23 10:49 ` ams at gcc dot gnu.org
  2020-04-21 12:59 ` tschwinge at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ams at gcc dot gnu.org @ 2020-03-23 10:49 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94248

--- Comment #3 from Andrew Stubbs <ams at gcc dot gnu.org> ---
Actually, I think that recent changes to the register alignment mean that this
can't happen any more, so the whole check is probably obsolete.

I thought that --enable-checking=yes was already covering this. :-(

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

* [Bug target/94248] [amdgcn] Doesn't build with RTL checking
  2020-03-21 11:27 [Bug target/94248] New: [amdgcn] Doesn't build with RTL checking tschwinge at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2020-03-23 10:49 ` ams at gcc dot gnu.org
@ 2020-04-21 12:59 ` tschwinge at gcc dot gnu.org
  2020-04-21 13:14 ` ams at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: tschwinge at gcc dot gnu.org @ 2020-04-21 12:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94248

Thomas Schwinge <tschwinge at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2020-03-21 00:00:00         |2020-4-21
           Keywords|                            |patch

--- Comment #4 from Thomas Schwinge <tschwinge at gcc dot gnu.org> ---
(In reply to Andrew Stubbs from comment #3)
> Actually, I think that recent changes to the register alignment mean that
> this can't happen any more, so the whole check is probably obsolete.

I don't know exactly what "this" and "the whole check" relate to, but I do
reconfirm that without Jakub's 'reg_overlap_mentioned_p' patch, I'm still
running into the ICE.


> I thought that --enable-checking=yes was already covering this. :-(

Nope.  :-|


Thus, again:

(In reply to Thomas Schwinge from comment #2)
> (In reply to Jakub Jelinek from comment #1)
> > --- gcc/config/gcn/gcn.md.jj	2020-03-03 07:57:42.363827602 +0100
> > +++ gcc/config/gcn/gcn.md	2020-03-21 15:37:45.337552515 +0100
> > @@ -625,7 +625,7 @@ (define_insn_and_split "*mov<mode>_insn"
> >      rtx outhi = gen_highpart_mode (SImode, <MODE>mode, operands[0]);
> >  
> >      /* Ensure that overlapping registers aren't corrupted.  */
> > -    if (REGNO (outlo) == REGNO (inhi))
> > +    if (reg_overlap_mentioned_p (outlo, inhi))
> >        {
> >  	operands[0] = outhi;
> >  	operands[1] = inhi;
> > ought to fix this
> 
> I've tested that one; no more ICE, and bit-identical code for all target
> libraries, so I suppose this is good to commit (Andrew, Julian)?  If
> approving this patch, please respond with "Reviewed-by: NAME <EMAIL>" so
> that your effort will be recorded in the commit log, see
> <https://gcc.gnu.org/wiki/Reviewed-by>.

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

* [Bug target/94248] [amdgcn] Doesn't build with RTL checking
  2020-03-21 11:27 [Bug target/94248] New: [amdgcn] Doesn't build with RTL checking tschwinge at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2020-04-21 12:59 ` tschwinge at gcc dot gnu.org
@ 2020-04-21 13:14 ` ams at gcc dot gnu.org
  2020-04-22  9:47 ` tschwinge at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ams at gcc dot gnu.org @ 2020-04-21 13:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94248

--- Comment #5 from Andrew Stubbs <ams at gcc dot gnu.org> ---
(In reply to Thomas Schwinge from comment #4)
> (In reply to Andrew Stubbs from comment #3)
> > Actually, I think that recent changes to the register alignment mean that
> > this can't happen any more, so the whole check is probably obsolete.
> 
> I don't know exactly what "this" and "the whole check" relate to, but I do
> reconfirm that without Jakub's 'reg_overlap_mentioned_p' patch, I'm still
> running into the ICE.

I meant that I don't believe that overlapping registers can happen, thus the
condition will always be false.

Yes, the REG_P can still ICE with the additional checking enabled.

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

* [Bug target/94248] [amdgcn] Doesn't build with RTL checking
  2020-03-21 11:27 [Bug target/94248] New: [amdgcn] Doesn't build with RTL checking tschwinge at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2020-04-21 13:14 ` ams at gcc dot gnu.org
@ 2020-04-22  9:47 ` tschwinge at gcc dot gnu.org
  2020-04-22 12:10 ` ams at gcc dot gnu.org
  2020-04-29  7:58 ` cvs-commit at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: tschwinge at gcc dot gnu.org @ 2020-04-22  9:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94248

Thomas Schwinge <tschwinge at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2020-04-21 00:00:00         |2020-4-22

--- Comment #6 from Thomas Schwinge <tschwinge at gcc dot gnu.org> ---
(In reply to Andrew Stubbs from comment #5)
> Yes, the REG_P can still ICE with the additional checking enabled.

So are you fine with me installing Jakub's patch?

(In reply to Thomas Schwinge from comment #4)
> Thus, again:
> 
> (In reply to Thomas Schwinge from comment #2)
> > (In reply to Jakub Jelinek from comment #1)
> > > --- gcc/config/gcn/gcn.md.jj	2020-03-03 07:57:42.363827602 +0100
> > > +++ gcc/config/gcn/gcn.md	2020-03-21 15:37:45.337552515 +0100
> > > @@ -625,7 +625,7 @@ (define_insn_and_split "*mov<mode>_insn"
> > >      rtx outhi = gen_highpart_mode (SImode, <MODE>mode, operands[0]);
> > >  
> > >      /* Ensure that overlapping registers aren't corrupted.  */
> > > -    if (REGNO (outlo) == REGNO (inhi))
> > > +    if (reg_overlap_mentioned_p (outlo, inhi))
> > >        {
> > >  	operands[0] = outhi;
> > >  	operands[1] = inhi;
> > > ought to fix this
> > 
> > I've tested that one; no more ICE, and bit-identical code for all target
> > libraries, so I suppose this is good to commit (Andrew, Julian)?  If
> > approving this patch, please respond with "Reviewed-by: NAME <EMAIL>" so
> > that your effort will be recorded in the commit log, see
> > <https://gcc.gnu.org/wiki/Reviewed-by>.

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

* [Bug target/94248] [amdgcn] Doesn't build with RTL checking
  2020-03-21 11:27 [Bug target/94248] New: [amdgcn] Doesn't build with RTL checking tschwinge at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2020-04-22  9:47 ` tschwinge at gcc dot gnu.org
@ 2020-04-22 12:10 ` ams at gcc dot gnu.org
  2020-04-29  7:58 ` cvs-commit at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: ams at gcc dot gnu.org @ 2020-04-22 12:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94248

--- Comment #7 from Andrew Stubbs <ams at gcc dot gnu.org> ---
I'd rather remove the whole if branch, but given you've tested this already
then it's probably the best short term fix. Please go ahead.

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

* [Bug target/94248] [amdgcn] Doesn't build with RTL checking
  2020-03-21 11:27 [Bug target/94248] New: [amdgcn] Doesn't build with RTL checking tschwinge at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2020-04-22 12:10 ` ams at gcc dot gnu.org
@ 2020-04-29  7:58 ` cvs-commit at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-29  7:58 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94248

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Thomas Schwinge <tschwinge@gcc.gnu.org>:

https://gcc.gnu.org/g:ccf93cd0b21e9c0ff0a1d4ace59899fca25ac157

commit r10-8032-gccf93cd0b21e9c0ff0a1d4ace59899fca25ac157
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Sat Mar 21 14:39:56 2020 +0000

    [gcn] Fix build with RTL checking [PR94248]

    Building (for offloading) a '--target=amdgcn-amdhsa' GCC with
    '--enable-checking=yes,extra,rtl' fails:

        during RTL pass: split2
        [...]/source-gcc/libgcc/libgcc2.c: In function '__absvdi2':
        [...]/source-gcc/libgcc/libgcc2.c:271:1: internal compiler error: RTL
check: expected code 'reg', have 'const_int' in rhs_regno, at rtl.h:1923
          271 | }
              | ^
        0x565847 ???
                [...]/source-gcc/gcc/rtl.c:881
        0x59a8a4 ???
                [...]/source-gcc/gcc/rtl.h:1923
        0x12e3a5c ???
                [...]/source-gcc/gcc/config/gcn/gcn.md:631
        [...]
        Makefile:501: recipe for target '_absvdi2.o' failed
        make[4]: *** [_absvdi2.o] Error 1
        make[4]: Leaving directory
'[...]/build-gcc-offload-amdgcn-amdhsa/amdgcn-amdhsa/gfx900/libgcc'

            gcc/
            PR target/94248
            * config/gcn/gcn.md (*mov<mode>_insn): Use
            'reg_overlap_mentioned_p' to check for overlap.

    Tested-by: Thomas Schwinge <thomas@codesourcery.com>

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

end of thread, other threads:[~2020-04-29  7:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-21 11:27 [Bug target/94248] New: [amdgcn] Doesn't build with RTL checking tschwinge at gcc dot gnu.org
2020-03-21 14:39 ` [Bug target/94248] " jakub at gcc dot gnu.org
2020-03-23 10:43 ` tschwinge at gcc dot gnu.org
2020-03-23 10:49 ` ams at gcc dot gnu.org
2020-04-21 12:59 ` tschwinge at gcc dot gnu.org
2020-04-21 13:14 ` ams at gcc dot gnu.org
2020-04-22  9:47 ` tschwinge at gcc dot gnu.org
2020-04-22 12:10 ` ams at gcc dot gnu.org
2020-04-29  7:58 ` cvs-commit at gcc dot gnu.org

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