public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/105627] New: -fcompare-debug failure at -Og for powerpc64le-unknown-linux-gnu
@ 2022-05-17 12:19 zsojka at seznam dot cz
  2022-05-18 14:53 ` [Bug debug/105627] " jakub at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: zsojka at seznam dot cz @ 2022-05-17 12:19 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105627
           Summary: -fcompare-debug failure at -Og for
                    powerpc64le-unknown-linux-gnu
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: compare-debug-failure
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz
                CC: aoliva at gcc dot gnu.org
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu
            Target: powerpc64le-unknown-linux-gnu

Created attachment 52985
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52985&action=edit
reduced testcase

Compiler output:
$ powerpc64le-unknown-linux-gnu-gcc -Og -fcompare-debug testcase.c -save-temps
testcase.c: In function 'foo':
testcase.c:10:1: warning: GCC vector returned by reference: non-standard ABI
extension with no compatibility guarantee [-Wpsabi]
   10 | {
      | ^

$ diff -u *gkd
--- a-testcase.c.gkd    2022-05-17 14:16:43.376878594 +0200
+++ a-testcase.gk.c.gkd 2022-05-17 14:16:43.433544950 +0200
@@ -93,25 +93,8 @@
      (expr_list:REG_EQUAL (symbol_ref/u:DI ("*.LC0") [flags 0x82])
         (nil)))
 (insn # 0 0 (set (reg:V16QI 69 5 [194])
-        (vec_select:V16QI (mem/u/c:V16QI (reg/f:DI 6 6 [193]) [  S16 A128])
-            (parallel [
-                    (const_int 8 [0x8])
-                    (const_int 9 [0x9])
-                    (const_int 10 [0xa])
-                    (const_int 11 [0xb])
-                    (const_int 12 [0xc])
-                    (const_int 13 [0xd])
-                    (const_int 14 [0xe])
-                    (const_int 15 [0xf])
-                    (const_int 0 [0])
-                    (const_int 1 [0x1])
-                    (const_int 2 [0x2])
-                    (const_int 3 [0x3])
-                    (const_int 4 [0x4])
-                    (const_int 5 [0x5])
-                    (const_int 6 [0x6])
-                    (const_int 7 [0x7])
-                ]))) "testcase.c":11:5# {*vsx_lxvd2x16_le_V16QI}
+        (mem/u/c:V16QI (and:DI (reg/f:DI 6 6 [193])
+                (const_int -16 [0xfffffffffffffff0])) [  S16 A128]))
"testcase.c":11:5# {vsx_movv16qi_64bit}
      (expr_list:REG_DEAD (reg/f:DI 6 6 [193])
         (nil)))
 (insn # 0 0 (set (reg:V16QI 69 5 [orig:164 _56 ] [164])
@@ -1062,26 +1045,9 @@
...


$ powerpc64le-unknown-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-powerpc64le/bin/powerpc64le-unknown-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r13-555-20220517114234-g1815462a6e5-checking-yes-rtl-df-extra-powerpc64le/bin/../libexec/gcc/powerpc64le-unknown-linux-gnu/13.0.0/lto-wrapper
Target: powerpc64le-unknown-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--with-cloog --with-ppl --with-isl
--with-sysroot=/usr/powerpc64le-unknown-linux-gnu --build=x86_64-pc-linux-gnu
--host=x86_64-pc-linux-gnu --target=powerpc64le-unknown-linux-gnu
--with-ld=/usr/bin/powerpc64le-unknown-linux-gnu-ld
--with-as=/usr/bin/powerpc64le-unknown-linux-gnu-as --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-r13-555-20220517114234-g1815462a6e5-checking-yes-rtl-df-extra-powerpc64le
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.0.0 20220517 (experimental) (GCC)

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

* [Bug debug/105627] -fcompare-debug failure at -Og for powerpc64le-unknown-linux-gnu
  2022-05-17 12:19 [Bug debug/105627] New: -fcompare-debug failure at -Og for powerpc64le-unknown-linux-gnu zsojka at seznam dot cz
@ 2022-05-18 14:53 ` jakub at gcc dot gnu.org
  2022-05-19  7:28 ` linkw at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-05-18 14:53 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-05-18
             Status|UNCONFIRMED                 |NEW
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |linkw at gcc dot gnu.org,
                   |                            |segher at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
This diverges in the swaps rs6000-specific pass.
With:
-Og -fcompare-debug pr105627.c -fdump-tree-all -da --param
min-nondebug-insn-uid=10000
one can see:
@@ -173,17 +173,17 @@ Relevant insns with their flag settings
  10359  10355  store swappable special:store 
  10360  10356  store swappable special:store 
  10361  10357  store swappable special:store 
- 10363      0  load swap 
+ 10363  10371  load swap 
  10364  10363  swap 
  10365  10363  swappable 
  10366  10363  swap 
  10367  10363  store swap 
- 10371      0  load swap 
+ 10371  10379  load swap 
  10372  10371  swap 
  10373  10371  swappable 
  10374  10371  swap 
  10375  10371  store swap 
- 10379      0  load swap 
+ 10379  10387  load swap 
  10380  10379  swap 
  10381  10379  swappable 
  10382  10379  swap 
...
@@ -456,18 +456,6 @@ deferring rescan insn with uid = 10415.
 Replacing store 10415 with permuted store
 deferring rescan insn with uid = 10416.
 Replacing store 10416 with permuted store
-deferring rescan insn with uid = 10432.
-deferring rescan insn with uid = 10432.
-Replacing swap 10018 with copy 10432
-deferring deletion of insn with uid = 10018.
-deferring rescan insn with uid = 10433.
-deferring rescan insn with uid = 10433.
-Replacing swap 10364 with copy 10433
-deferring deletion of insn with uid = 10364.
-deferring rescan insn with uid = 10434.
-deferring rescan insn with uid = 10434.
-Replacing swap 10366 with copy 10434
-deferring deletion of insn with uid = 10366.
 starting the processing of deferred insns
 verify found no changes in insn with uid = 10354.
 verify found no changes in insn with uid = 10355.
etc. changes.  DEBUG_INSNs shouldn't influence optimization decisions, but of
course might need to be adjusted or reset in some cases.

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

* [Bug debug/105627] -fcompare-debug failure at -Og for powerpc64le-unknown-linux-gnu
  2022-05-17 12:19 [Bug debug/105627] New: -fcompare-debug failure at -Og for powerpc64le-unknown-linux-gnu zsojka at seznam dot cz
  2022-05-18 14:53 ` [Bug debug/105627] " jakub at gcc dot gnu.org
@ 2022-05-19  7:28 ` linkw at gcc dot gnu.org
  2022-05-24  6:08 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: linkw at gcc dot gnu.org @ 2022-05-19  7:28 UTC (permalink / raw)
  To: gcc-bugs

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

Kewen Lin <linkw at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |linkw at gcc dot gnu.org

--- Comment #2 from Kewen Lin <linkw at gcc dot gnu.org> ---
Thanks for reporting and triaging.

Although loops in function rs6000_analyze_swaps only handles NONDEBUG_INSN_P
insns, when doing unionfind_union it's still possible to union with debug insn,
as some def reg of nondebug insn can be used in debug insn, it makes the unions
become different unexpectedly. 

The below patch can fix the issue, I don't think we need the similar handling
in union_defs as I feel it's impossible to have the case that one reg which is
defined by debug insn but used in nondebug insn.

diff --git a/gcc/config/rs6000/rs6000-p8swap.cc
b/gcc/config/rs6000/rs6000-p8swap.cc
index d301bc3fe59..3aa90034c29 100644
--- a/gcc/config/rs6000/rs6000-p8swap.cc
+++ b/gcc/config/rs6000/rs6000-p8swap.cc
@@ -242,8 +242,9 @@ union_uses (swap_web_entry *insn_entry, rtx insn, df_ref
def)
       if (DF_REF_INSN_INFO (link->ref))
         {
           rtx use_insn = DF_REF_INSN (link->ref);
-          (void)unionfind_union (insn_entry + INSN_UID (insn),
-                                 insn_entry + INSN_UID (use_insn));
+          if (NONDEBUG_INSN_P (use_insn))
+            (void) unionfind_union (insn_entry + INSN_UID (insn),
+                                    insn_entry + INSN_UID (use_insn));
         }

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

* [Bug debug/105627] -fcompare-debug failure at -Og for powerpc64le-unknown-linux-gnu
  2022-05-17 12:19 [Bug debug/105627] New: -fcompare-debug failure at -Og for powerpc64le-unknown-linux-gnu zsojka at seznam dot cz
  2022-05-18 14:53 ` [Bug debug/105627] " jakub at gcc dot gnu.org
  2022-05-19  7:28 ` linkw at gcc dot gnu.org
@ 2022-05-24  6:08 ` cvs-commit at gcc dot gnu.org
  2022-05-24  6:22 ` linkw at gcc dot gnu.org
  2022-10-27  2:25 ` [Bug target/105627] " pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-24  6:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Kewen Lin <linkw@gcc.gnu.org>:

https://gcc.gnu.org/g:149d04ccbb908b3a251485b43faf204752942b9f

commit r13-720-g149d04ccbb908b3a251485b43faf204752942b9f
Author: Kewen Lin <linkw@linux.ibm.com>
Date:   Tue May 24 01:00:22 2022 -0500

    rs6000: Skip debug insns for union [PR105627]

    As PR105627 exposes, pass analyze_swaps should skip debug
    insn when doing unionfind_union.  One debug insn can use
    several pseudos, if we take debug insn into account, we can
    union those insns defining them and generate some unexpected
    unions.

    Based on the assumption that it's impossible to have one
    pseudo which is defined by one debug insn but is used by one
    nondebug insn, we just asserts debug insn never shows up in
    function union_defs.

            PR target/105627

    gcc/ChangeLog:

            * config/rs6000/rs6000-p8swap.cc (union_defs): Assert def_insn
can't
            be a debug insn.
            (union_uses): Skip debug use_insn.

    gcc/testsuite/ChangeLog:

            * gcc.target/powerpc/pr105627.c: New test.

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

* [Bug debug/105627] -fcompare-debug failure at -Og for powerpc64le-unknown-linux-gnu
  2022-05-17 12:19 [Bug debug/105627] New: -fcompare-debug failure at -Og for powerpc64le-unknown-linux-gnu zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2022-05-24  6:08 ` cvs-commit at gcc dot gnu.org
@ 2022-05-24  6:22 ` linkw at gcc dot gnu.org
  2022-10-27  2:25 ` [Bug target/105627] " pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: linkw at gcc dot gnu.org @ 2022-05-24  6:22 UTC (permalink / raw)
  To: gcc-bugs

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

Kewen Lin <linkw at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Kewen Lin <linkw at gcc dot gnu.org> ---
Should be fixed on latest trunk.

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

* [Bug target/105627] -fcompare-debug failure at -Og for powerpc64le-unknown-linux-gnu
  2022-05-17 12:19 [Bug debug/105627] New: -fcompare-debug failure at -Og for powerpc64le-unknown-linux-gnu zsojka at seznam dot cz
                   ` (3 preceding siblings ...)
  2022-05-24  6:22 ` linkw at gcc dot gnu.org
@ 2022-10-27  2:25 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-10-27  2:25 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |13.0
          Component|debug                       |target

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

end of thread, other threads:[~2022-10-27  2:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-17 12:19 [Bug debug/105627] New: -fcompare-debug failure at -Og for powerpc64le-unknown-linux-gnu zsojka at seznam dot cz
2022-05-18 14:53 ` [Bug debug/105627] " jakub at gcc dot gnu.org
2022-05-19  7:28 ` linkw at gcc dot gnu.org
2022-05-24  6:08 ` cvs-commit at gcc dot gnu.org
2022-05-24  6:22 ` linkw at gcc dot gnu.org
2022-10-27  2:25 ` [Bug target/105627] " pinskia 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).