public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/94279] New: [amdgcn] internal compiler error: RTL check: expected code 'const_int', have 'reg' in rtx_to_poly_int64, at rtl.h:2379
@ 2020-03-23 13:51 tschwinge at gcc dot gnu.org
  2020-04-22 11:52 ` [Bug target/94279] " tschwinge at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: tschwinge at gcc dot gnu.org @ 2020-03-23 13:51 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94279
           Summary: [amdgcn] internal compiler error: RTL check: expected
                    code 'const_int', have 'reg' in rtx_to_poly_int64, at
                    rtl.h:2379
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: openmp
          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, jakub at gcc dot gnu.org, jules at gcc dot gnu.org
  Target Milestone: ---
            Target: amdgcn

This is with GCC commit b73f69020f08208d2d969fcf8879bd294a6e3596 sources, with
commit b12fb08bd95d7dbb9fd6af120ee0b4c658a3deb1, and commit
65858e1869be4a54f8e0e2073a4aa99b15471273 cherry-picked, and PR94248 fixed with
Jakub's 'reg_overlap_mentioned_p' patch.

Relative to a GCC nvptx offloading configuration, when adding amdgcn offloading
(with '--enable-checking=yes,extra,rtl'), I see the following regression:

    [-PASS:-]{+FAIL: libgomp.c/../libgomp.c-c++-common/for-5.c (internal
compiler error)+}
    {+FAIL:+} libgomp.c/../libgomp.c-c++-common/for-5.c (test for excess
errors)
    [-PASS:-]{+UNRESOLVED:+} libgomp.c/../libgomp.c-c++-common/for-5.c
[-execution test-]{+compilation failed to produce executable+}

    during RTL pass: split2
   
[...]/source-gcc/libgomp/testsuite/libgomp.c/../libgomp.c-c++-common/for-2.h:69:9:
internal compiler error: RTL check: expected code 'const_int', have 'reg' in
rtx_to_poly_int64, at rtl.h:2379
    0x54e115 ???
            [...]/source-gcc/gcc/rtl.c:881
    0xb0a5c4 ???
            [...]/source-gcc/gcc/rtl.h:2379
    0xabf9ad ???
            [...]/source-gcc/gcc/recog.c:2974
    0xabfb48 ???
            [...]/source-gcc/gcc/recog.c:4026
    [...]
    mkoffload: fatal error:
[...]/build-gcc/./gcc/x86_64-pc-linux-gnu-accel-amdgcn-amdhsa-gcc returned 1
exit status
    compilation terminated.
    [...]

Same for 'libgomp.c++' variant.

Supposedly same problem for:

    [-PASS:-]{+FAIL: libgomp.c/../libgomp.c-c++-common/pr66199-2.c (internal
compiler error)+}
    {+FAIL:+} libgomp.c/../libgomp.c-c++-common/pr66199-2.c (test for excess
errors)
    [-PASS:-]{+UNRESOLVED:+} libgomp.c/../libgomp.c-c++-common/pr66199-2.c
[-execution test-]{+compilation failed to produce executable+}

Same for 'libgomp.c++' variant.

    [-PASS:-]{+FAIL: libgomp.c/../libgomp.c-c++-common/pr66199-5.c (internal
compiler error)+}
    {+FAIL:+} libgomp.c/../libgomp.c-c++-common/pr66199-5.c (test for excess
errors)
    [-PASS:-]{+UNRESOLVED:+} libgomp.c/../libgomp.c-c++-common/pr66199-5.c
[-execution test-]{+compilation failed to produce executable+}

Same for 'libgomp.c++' variant.

    [-PASS:-]{+FAIL: libgomp.c/../libgomp.c-c++-common/pr66199-7.c (internal
compiler error)+}
    {+FAIL:+} libgomp.c/../libgomp.c-c++-common/pr66199-7.c (test for excess
errors)
    [-PASS:-]{+UNRESOLVED:+} libgomp.c/../libgomp.c-c++-common/pr66199-7.c
[-execution test-]{+compilation failed to produce executable+}

Same for 'libgomp.c++' variant.

    [-PASS:-]{+FAIL: libgomp.c/../libgomp.c-c++-common/pr66199-8.c (internal
compiler error)+}
    {+FAIL:+} libgomp.c/../libgomp.c-c++-common/pr66199-8.c (test for excess
errors)
    [-PASS:-]{+UNRESOLVED:+} libgomp.c/../libgomp.c-c++-common/pr66199-8.c
[-execution test-]{+compilation failed to produce executable+}

Same for 'libgomp.c++' variant.

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

* [Bug target/94279] [amdgcn] internal compiler error: RTL check: expected code 'const_int', have 'reg' in rtx_to_poly_int64, at rtl.h:2379
  2020-03-23 13:51 [Bug target/94279] New: [amdgcn] internal compiler error: RTL check: expected code 'const_int', have 'reg' in rtx_to_poly_int64, at rtl.h:2379 tschwinge at gcc dot gnu.org
@ 2020-04-22 11:52 ` tschwinge at gcc dot gnu.org
  2020-04-22 12:39 ` rguenth at gcc dot gnu.org
  2020-04-29  7:58 ` cvs-commit at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: tschwinge at gcc dot gnu.org @ 2020-04-22 11:52 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-04-22
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Thomas Schwinge <tschwinge at gcc dot gnu.org> ---
With '#pragma GCC optimize "-O0"' added to the top of 'gcc/recog.c',
'gcc/rtlanal.c', and courtesy of GDB, here is a better backtrace of
'build-gcc-offload-amdgcn-amdhsa/gcc/lto1', and more information:

    during RTL pass: split2
    [...]/libgomp.c-c++-common/for-2.h: In function
‘f4_tpf_simd_guided32._omp_fn.1’:
    [...]/libgomp.c-c++-common/for-2.h:69:9: internal compiler error: RTL
check: expected code 'const_int', have 'reg' in rtx_to_poly_int64, at
rtl.h:2380

    (gdb) bt
    #0  internal_error (gmsgid=0x15dcf70 "RTL check: expected code '%s', have
'%s' in %s, at %s:%d") at [...]/gcc/diagnostic.c:1706
    #1  0x0000000000553aa6 in rtl_check_failed_code1 (r=0x7ffff64960a8,
code=<optimized out>, file=<optimized out>, line=<optimized out>,
func=<optimized out>) at [...]/gcc/rtl.c:881
    #2  0x0000000000b4500c in rtx_to_poly_int64 (x=0x7ffff64960a8) at
[...]/gcc/rtl.h:2380
    #3  0x0000000000b252b4 in set_noop_p (set=0x7ffff6496120) at
[...]/gcc/rtlanal.c:1635
    #4  0x0000000000ad741b in split_all_insns () at [...]/gcc/recog.c:2975
    #5  0x0000000000adac0e in (anonymous
namespace)::pass_split_before_regstack::execute (this=0x1d95fe0) at
[...]/gcc/recog.c:4027
    #6  0x0000000000a7f090 in execute_one_pass (pass=pass@entry=0x1d95fe0) at
[...]/gcc/passes.c:2502
    #7  0x0000000000a7f9e8 in execute_pass_list_1 (pass=0x1d95fe0) at
[...]/gcc/passes.c:2590
    #8  0x0000000000a7f9fa in execute_pass_list_1 (pass=0x1d95ec0) at
[...]/gcc/passes.c:2591
    #9  0x0000000000a7f9fa in execute_pass_list_1 (pass=0x1d94cc0) at
[...]/gcc/passes.c:2591
    #10 0x0000000000a7fa45 in execute_pass_list (fn=<optimized out>,
pass=<optimized out>) at [...]/gcc/passes.c:2601
    #11 0x0000000000682413 in cgraph_node::expand (this=0x7ffff6642ca8) at
[...]/gcc/cgraphunit.c:2300
    #12 0x0000000000683b74 in expand_all_functions () at
[...]/gcc/cgraphunit.c:2471
    #13 symbol_table::compile (this=0x7ffff67a9000) at
[...]/gcc/cgraphunit.c:2822
    #14 0x0000000000684246 in symbol_table::compile (this=<optimized out>) at
[...]/gcc/cgraphunit.c:2856
    #15 0x00000000005b79f6 in lto_main () at [...]/gcc/lto/lto.c:653
    #16 0x0000000000b91abf in compile_file () at [...]/gcc/toplev.c:458
    #17 0x000000000059035d in do_compile () at [...]/gcc/toplev.c:2273
    #18 toplev::main (this=this@entry=0x7fffffffd220, argc=argc@entry=19,
argv=0x1d616e0, argv@entry=0x7fffffffd328) at [...]/gcc/toplev.c:2412
    #19 0x0000000000592f37 in main (argc=19, argv=0x7fffffffd328) at
[...]/gcc/main.c:39
    (gdb) frame 4
    #4  0x0000000000ad741b in split_all_insns () at [...]/gcc/recog.c:2975
    2975                  if (set && set_noop_p (set))
    (gdb) list
    2970                  rtx set = single_set (insn);
    2971
    2972                  /* Don't split no-op move insns.  These should
silently
    2973                     disappear later in final.  Splitting such insns
would
    2974                     break the code that handles LIBCALL blocks.  */
    2975                  if (set && set_noop_p (set))
    2976                    {
    2977                      /* Nops get in the way while scheduling, so
delete them
    2978                         now if register allocation has already been
done.  It
    2979                         is too risky to try to do this before register
    (gdb) call debug_rtx(insn)
    (insn 109 108 182 13 (set (reg/v:SI 2 s2 [orig:434 i ] [434])
            (vec_select:SI (reg:V64SI 163 v3 [orig:450 vect_i_22.2317 ] [450])
                (parallel [
                        (reg:SI 2 s2 [503])
                    ]))) 140 {vec_extractv64sisi}
         (nil))
    (gdb) call debug_rtx(set)
    (set (reg/v:SI 2 s2 [orig:434 i ] [434])
        (vec_select:SI (reg:V64SI 163 v3 [orig:450 vect_i_22.2317 ] [450])
            (parallel [
                    (reg:SI 2 s2 [503])
                ])))
    (gdb) down
    #3  0x0000000000b252b4 in set_noop_p (set=0x7ffff6496120) at
[...]/gcc/rtlanal.c:1635
    1635          poly_int64 c0 = rtx_to_poly_int64 (XVECEXP (par, 0, 0));
    (gdb) list 1598
    1593    ^L
    1594    /* Return nonzero if the destination of SET equals the source
    1595       and there are no side effects.  */
    1596
    1597    int
    1598    set_noop_p (const_rtx set)
    1599    {
    1600      rtx src = SET_SRC (set);
    1601      rtx dst = SET_DEST (set);
    1602
    (gdb) call debug_rtx(src)
    (vec_select:SI (reg:V64SI 163 v3 [orig:450 vect_i_22.2317 ] [450])
        (parallel [
                (reg:SI 2 s2 [503])
            ]))
    (gdb) call debug_rtx(dst)
    (reg/v:SI 2 s2 [orig:434 i ] [434])
    (gdb) list 1635
    1630          && HARD_REGISTER_P (dst))
    1631        {
    1632          int i;
    1633          rtx par = XEXP (src, 1);
    1634          rtx src0 = XEXP (src, 0);
    1635          poly_int64 c0 = rtx_to_poly_int64 (XVECEXP (par, 0, 0));
    1636          poly_int64 offset = GET_MODE_UNIT_SIZE (GET_MODE (src0)) *
c0;
    1637
    1638          for (i = 1; i < XVECLEN (par, 0); i++)
    1639            if (maybe_ne (rtx_to_poly_int64 (XVECEXP (par, 0, i)), c0 +
i))
    (gdb) call debug_rtx(par)
    (parallel [
            (reg:SI 2 s2 [503])
        ])
    (gdb) down
    #2  0x0000000000b4500c in rtx_to_poly_int64 (x=0x7ffff64960a8) at
[...]/gcc/rtl.h:2380
    2380      return INTVAL (x);
    (gdb) list 2371
    2366    }
    2367
    2368    /* Return the value of X as a poly_int64.  */
    2369
    2370    inline poly_int64
    2371    rtx_to_poly_int64 (const_rtx x)
    2372    {
    2373      if (CONST_POLY_INT_P (x))
    2374        {
    2375          poly_int64 res;
    (gdb) call debug_rtx(x)
    (reg:SI 2 s2 [503])

Sorry, I don't speak RTL, so don't know how/what to fix here.  Should we even
be getting down there?

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

* [Bug target/94279] [amdgcn] internal compiler error: RTL check: expected code 'const_int', have 'reg' in rtx_to_poly_int64, at rtl.h:2379
  2020-03-23 13:51 [Bug target/94279] New: [amdgcn] internal compiler error: RTL check: expected code 'const_int', have 'reg' in rtx_to_poly_int64, at rtl.h:2379 tschwinge at gcc dot gnu.org
  2020-04-22 11:52 ` [Bug target/94279] " tschwinge at gcc dot gnu.org
@ 2020-04-22 12:39 ` rguenth at gcc dot gnu.org
  2020-04-29  7:58 ` cvs-commit at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-04-22 12:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
set_noop_p is clearly buggy here, expecting a constant selector

  /* It is a NOOP if destination overlaps with selected src vector
     elements.  */
  if (GET_CODE (src) == VEC_SELECT
      && REG_P (XEXP (src, 0)) && REG_P (dst)
      && HARD_REGISTER_P (XEXP (src, 0))
      && HARD_REGISTER_P (dst))
    {
      int i;
      rtx par = XEXP (src, 1);
      rtx src0 = XEXP (src, 0);
      poly_int64 c0 = rtx_to_poly_int64 (XVECEXP (par, 0, 0));
      poly_int64 offset = GET_MODE_UNIT_SIZE (GET_MODE (src0)) * c0;

      for (i = 1; i < XVECLEN (par, 0); i++)
        if (maybe_ne (rtx_to_poly_int64 (XVECEXP (par, 0, i)), c0 + i))
          return 0;
      return
        REG_CAN_CHANGE_MODE_P (REGNO (dst), GET_MODE (src0), GET_MODE (dst))
        && simplify_subreg_regno (REGNO (src0), GET_MODE (src0),
                                  offset, GET_MODE (dst)) == (int) REGNO (dst);
    }

both for c0 and the XVECEXP in the loop it needs to check whether it actually
is a constant.  Like via poly_int_rtx_p.  A patch like along that line
is pre-approved.  Broken since introduction of that code
in commit 8c8952918b75

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

* [Bug target/94279] [amdgcn] internal compiler error: RTL check: expected code 'const_int', have 'reg' in rtx_to_poly_int64, at rtl.h:2379
  2020-03-23 13:51 [Bug target/94279] New: [amdgcn] internal compiler error: RTL check: expected code 'const_int', have 'reg' in rtx_to_poly_int64, at rtl.h:2379 tschwinge at gcc dot gnu.org
  2020-04-22 11:52 ` [Bug target/94279] " tschwinge at gcc dot gnu.org
  2020-04-22 12:39 ` rguenth at gcc dot gnu.org
@ 2020-04-29  7:58 ` cvs-commit at gcc dot gnu.org
  2 siblings, 0 replies; 4+ 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=94279

--- Comment #3 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:f2c2eaaf8fb5c66ae372bb526b2b2fe67a9c5c39

commit r10-8034-gf2c2eaaf8fb5c66ae372bb526b2b2fe67a9c5c39
Author: Thomas Schwinge <thomas@codesourcery.com>
Date:   Wed Apr 22 16:58:44 2020 +0200

    [rtl] Harden 'set_noop_p' for non-constant selectors [PR94279]

    ... given that the GCN target did away with the constant 'vec_select'
    restriction.

            gcc/
            PR target/94279
            * rtlanal.c (set_noop_p): Handle non-constant selectors.

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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-23 13:51 [Bug target/94279] New: [amdgcn] internal compiler error: RTL check: expected code 'const_int', have 'reg' in rtx_to_poly_int64, at rtl.h:2379 tschwinge at gcc dot gnu.org
2020-04-22 11:52 ` [Bug target/94279] " tschwinge at gcc dot gnu.org
2020-04-22 12:39 ` rguenth 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).