public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/104054] New: '-fcompare-debug' failure (length) w/ -Os -funroll-loops
@ 2022-01-16 17:54 asolokha at gmx dot com
  2022-01-17 10:44 ` [Bug debug/104054] [9/10/11/12 Regression] '-fcompare-debug' failure (length) w/ -Os -funroll-loops since r8-3946-gfe94440235cfaa57 marxin at gcc dot gnu.org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: asolokha at gmx dot com @ 2022-01-16 17:54 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104054
           Summary: '-fcompare-debug' failure (length) w/ -Os
                    -funroll-loops
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asolokha at gmx dot com
  Target Milestone: ---
            Target: x86_64-unknown-linux-gnu

Created attachment 52207
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52207&action=edit
diff -u j2sfd9at.*.gkd

gcc 12.0.0 20220109 snapshot (g:49d73c9fb644673323845efebfe6b3106e70af8a) fails
-fcompare-debug check when compiling the following testcase w/ -Os
-funroll-loops:

short int i;
int m;
__int128 n;

void
foo (__int128 x)
{
  int a = !!n;
  __int128 b = 1;

  if (a < x)
    m = 1;

  for (i = 0; i < 4; ++i)
    {
      b <<= a || n;
      n = b;
    }
}

% x86_64-unknown-linux-gnu-gcc-12.0.0 -Os -fcompare-debug -funroll-loops -c
j2sfd9at.c
x86_64-unknown-linux-gnu-gcc-12.0.0: error: j2sfd9at.c: '-fcompare-debug'
failure (length)

gkd diff attached.

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

* [Bug debug/104054] [9/10/11/12 Regression] '-fcompare-debug' failure (length) w/ -Os -funroll-loops since r8-3946-gfe94440235cfaa57
  2022-01-16 17:54 [Bug debug/104054] New: '-fcompare-debug' failure (length) w/ -Os -funroll-loops asolokha at gmx dot com
@ 2022-01-17 10:44 ` marxin at gcc dot gnu.org
  2022-01-17 10:54 ` [Bug rtl-optimization/104054] " pinskia at gcc dot gnu.org
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-01-17 10:44 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-01-17
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
                 CC|                            |marxin at gcc dot gnu.org,
                   |                            |uros at gcc dot gnu.org
            Summary|'-fcompare-debug' failure   |[9/10/11/12 Regression]
                   |(length) w/ -Os             |'-fcompare-debug' failure
                   |-funroll-loops              |(length) w/ -Os
                   |                            |-funroll-loops since
                   |                            |r8-3946-gfe94440235cfaa57

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r8-3946-gfe94440235cfaa57.

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

* [Bug rtl-optimization/104054] [9/10/11/12 Regression] '-fcompare-debug' failure (length) w/ -Os -funroll-loops since r8-3946-gfe94440235cfaa57
  2022-01-16 17:54 [Bug debug/104054] New: '-fcompare-debug' failure (length) w/ -Os -funroll-loops asolokha at gmx dot com
  2022-01-17 10:44 ` [Bug debug/104054] [9/10/11/12 Regression] '-fcompare-debug' failure (length) w/ -Os -funroll-loops since r8-3946-gfe94440235cfaa57 marxin at gcc dot gnu.org
@ 2022-01-17 10:54 ` pinskia at gcc dot gnu.org
  2022-01-17 12:22 ` ubizjak at gmail dot com
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-17 10:54 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
          Component|debug                       |rtl-optimization
   Target Milestone|---                         |9.5

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Martin Liška from comment #1)
> Started with r8-3946-gfe94440235cfaa57.

This likely just expose the issue.

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

* [Bug rtl-optimization/104054] [9/10/11/12 Regression] '-fcompare-debug' failure (length) w/ -Os -funroll-loops since r8-3946-gfe94440235cfaa57
  2022-01-16 17:54 [Bug debug/104054] New: '-fcompare-debug' failure (length) w/ -Os -funroll-loops asolokha at gmx dot com
  2022-01-17 10:44 ` [Bug debug/104054] [9/10/11/12 Regression] '-fcompare-debug' failure (length) w/ -Os -funroll-loops since r8-3946-gfe94440235cfaa57 marxin at gcc dot gnu.org
  2022-01-17 10:54 ` [Bug rtl-optimization/104054] " pinskia at gcc dot gnu.org
@ 2022-01-17 12:22 ` ubizjak at gmail dot com
  2022-01-17 12:24 ` ubizjak at gmail dot com
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: ubizjak at gmail dot com @ 2022-01-17 12:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Uroš Bizjak <ubizjak at gmail dot com> ---
The first difference is in rnreg pass, w/o -g:

   28: L28:
   29: NOTE_INSN_BASIC_BLOCK 4
   30: [`i']=0
   63: di:DI=r9:DI       <--- here
   64: dx:DI=r10:DI
    9: r8:HI=0x5
      REG_EQUAL 0x5
   98: {cx:DI=0;clobber flags:CC;}
      REG_UNUSED flags:CC
   84: si:DI=0x1
   99: {r11:DI=0;clobber flags:CC;}
      REG_UNUSED flags:CC
   79: pc=L41


and w/ -g:

   34: L34:
   35: NOTE_INSN_BASIC_BLOCK 4
   36: debug begin stmt marker
   37: [`i']=0
   77: ax:DI=r9:DI
   78: dx:DI=r10:DI
    9: r8:HI=0x5
      REG_EQUAL 0x5
  112: {cx:DI=0;clobber flags:CC;}
      REG_UNUSED flags:CC
   98: si:DI=0x1
  113: {di:DI=0;clobber flags:CC;}
      REG_UNUSED flags:CC
   93: pc=L53

And indeed, the -fcompare-debug test succeeds with -fno-rename-registers

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

* [Bug rtl-optimization/104054] [9/10/11/12 Regression] '-fcompare-debug' failure (length) w/ -Os -funroll-loops since r8-3946-gfe94440235cfaa57
  2022-01-16 17:54 [Bug debug/104054] New: '-fcompare-debug' failure (length) w/ -Os -funroll-loops asolokha at gmx dot com
                   ` (2 preceding siblings ...)
  2022-01-17 12:22 ` ubizjak at gmail dot com
@ 2022-01-17 12:24 ` ubizjak at gmail dot com
  2022-01-17 12:38 ` ubizjak at gmail dot com
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: ubizjak at gmail dot com @ 2022-01-17 12:24 UTC (permalink / raw)
  To: gcc-bugs

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

Uroš Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|wrong-code                  |

--- Comment #4 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Andrew Pinski from comment #2)
> This likely just expose the issue.

Indeed, not wrong-code bug.

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

* [Bug rtl-optimization/104054] [9/10/11/12 Regression] '-fcompare-debug' failure (length) w/ -Os -funroll-loops since r8-3946-gfe94440235cfaa57
  2022-01-16 17:54 [Bug debug/104054] New: '-fcompare-debug' failure (length) w/ -Os -funroll-loops asolokha at gmx dot com
                   ` (3 preceding siblings ...)
  2022-01-17 12:24 ` ubizjak at gmail dot com
@ 2022-01-17 12:38 ` ubizjak at gmail dot com
  2022-01-17 17:45 ` jakub at gcc dot gnu.org
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: ubizjak at gmail dot com @ 2022-01-17 12:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Uroš Bizjak <ubizjak at gmail dot com> ---
Could be a red herring, but in _.rnreg dump:

Register r9 (1): 75 [GENERAL_REGS] 18 [ALL_REGS] 97 [GENERAL_REGS]
Register r10 (1): 76 [GENERAL_REGS] 18 [ALL_REGS] 23 [GENERAL_REGS]
...
Register di (1): 55 [ALL_REGS]

the pass w/ -g also records hard registers in debug insns. Probably this drives
some decisions to make different choices with respect to register renaming.

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

* [Bug rtl-optimization/104054] [9/10/11/12 Regression] '-fcompare-debug' failure (length) w/ -Os -funroll-loops since r8-3946-gfe94440235cfaa57
  2022-01-16 17:54 [Bug debug/104054] New: '-fcompare-debug' failure (length) w/ -Os -funroll-loops asolokha at gmx dot com
                   ` (4 preceding siblings ...)
  2022-01-17 12:38 ` ubizjak at gmail dot com
@ 2022-01-17 17:45 ` jakub at gcc dot gnu.org
  2022-01-18 13:47 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-01-17 17:45 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The toplevel comment in the pass says:
  DEBUG_INSNs are treated specially, in particular registers occurring inside
  them are treated as requiring ALL_REGS as a class.

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

* [Bug rtl-optimization/104054] [9/10/11/12 Regression] '-fcompare-debug' failure (length) w/ -Os -funroll-loops since r8-3946-gfe94440235cfaa57
  2022-01-16 17:54 [Bug debug/104054] New: '-fcompare-debug' failure (length) w/ -Os -funroll-loops asolokha at gmx dot com
                   ` (5 preceding siblings ...)
  2022-01-17 17:45 ` jakub at gcc dot gnu.org
@ 2022-01-18 13:47 ` rguenth at gcc dot gnu.org
  2022-01-19 10:56 ` ubizjak at gmail dot com
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-18 13:47 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2

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

* [Bug rtl-optimization/104054] [9/10/11/12 Regression] '-fcompare-debug' failure (length) w/ -Os -funroll-loops since r8-3946-gfe94440235cfaa57
  2022-01-16 17:54 [Bug debug/104054] New: '-fcompare-debug' failure (length) w/ -Os -funroll-loops asolokha at gmx dot com
                   ` (6 preceding siblings ...)
  2022-01-18 13:47 ` rguenth at gcc dot gnu.org
@ 2022-01-19 10:56 ` ubizjak at gmail dot com
  2022-01-19 12:52 ` ubizjak at gmail dot com
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: ubizjak at gmail dot com @ 2022-01-19 10:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Uroš Bizjak <ubizjak at gmail dot com> ---
For some reason the pass does not detect usage of Register si in (insn 55):

(debug_insn 55 54 56 6 (var_location:TI b (reg/v:TI 4 si [orig:86 b ] [86])) -1
     (nil))

Register ax (1):
Register dx (1):
Register cx (1):
Register si (1):
Register di (1): 55 [ALL_REGS]
Register r8 (1): 59 [GENERAL_REGS] 59 [GENERAL_REGS] 59 [GENERAL_REGS]
Register r9 (1):
Register r10 (1):

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

* [Bug rtl-optimization/104054] [9/10/11/12 Regression] '-fcompare-debug' failure (length) w/ -Os -funroll-loops since r8-3946-gfe94440235cfaa57
  2022-01-16 17:54 [Bug debug/104054] New: '-fcompare-debug' failure (length) w/ -Os -funroll-loops asolokha at gmx dot com
                   ` (7 preceding siblings ...)
  2022-01-19 10:56 ` ubizjak at gmail dot com
@ 2022-01-19 12:52 ` ubizjak at gmail dot com
  2022-05-27  9:47 ` [Bug rtl-optimization/104054] [10/11/12/13 " rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: ubizjak at gmail dot com @ 2022-01-19 12:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Uroš Bizjak <ubizjak at gmail dot com> ---
Without debug instructions, the compiler is able to rename insns to:

   65: di:DI=si:DI
   66: dx:DI=r11:DI
   74: cx:QI=0x1
      REG_EQUAL 0x1
   41: L41:
   42: NOTE_INSN_BASIC_BLOCK 6
   43: NOTE_INSN_DELETED

but with debug instructions, the same sequence reads as:

   50: debug b => si:TI
   51: debug begin stmt marker
   52: debug begin stmt marker
   79: ax:DI=si:DI
   80: dx:DI=di:DI
   88: cx:QI=0x1
      REG_EQUAL 0x1
   53: L53:
   54: NOTE_INSN_BASIC_BLOCK 6
   55: debug b => si:TI
   56: debug begin stmt marker
   57: NOTE_INSN_DELETED

In the later case, the compiler is not able to rename ax:DI register in (insn
79) to di:DI, because debug insn 55 is still accessing di:DI in the register 
si:TI - that is really formed from (si:DI,di:DI) register pair.

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

* [Bug rtl-optimization/104054] [10/11/12/13 Regression] '-fcompare-debug' failure (length) w/ -Os -funroll-loops since r8-3946-gfe94440235cfaa57
  2022-01-16 17:54 [Bug debug/104054] New: '-fcompare-debug' failure (length) w/ -Os -funroll-loops asolokha at gmx dot com
                   ` (8 preceding siblings ...)
  2022-01-19 12:52 ` ubizjak at gmail dot com
@ 2022-05-27  9:47 ` rguenth at gcc dot gnu.org
  2022-06-28 10:47 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-27  9:47 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|9.5                         |10.4

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9 branch is being closed

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

* [Bug rtl-optimization/104054] [10/11/12/13 Regression] '-fcompare-debug' failure (length) w/ -Os -funroll-loops since r8-3946-gfe94440235cfaa57
  2022-01-16 17:54 [Bug debug/104054] New: '-fcompare-debug' failure (length) w/ -Os -funroll-loops asolokha at gmx dot com
                   ` (9 preceding siblings ...)
  2022-05-27  9:47 ` [Bug rtl-optimization/104054] [10/11/12/13 " rguenth at gcc dot gnu.org
@ 2022-06-28 10:47 ` jakub at gcc dot gnu.org
  2023-02-03  9:44 ` ubizjak at gmail dot com
  2023-07-07 10:42 ` [Bug rtl-optimization/104054] [11/12/13/14 " rguenth at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:47 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.4                        |10.5

--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.4 is being released, retargeting bugs to GCC 10.5.

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

* [Bug rtl-optimization/104054] [10/11/12/13 Regression] '-fcompare-debug' failure (length) w/ -Os -funroll-loops since r8-3946-gfe94440235cfaa57
  2022-01-16 17:54 [Bug debug/104054] New: '-fcompare-debug' failure (length) w/ -Os -funroll-loops asolokha at gmx dot com
                   ` (10 preceding siblings ...)
  2022-06-28 10:47 ` jakub at gcc dot gnu.org
@ 2023-02-03  9:44 ` ubizjak at gmail dot com
  2023-07-07 10:42 ` [Bug rtl-optimization/104054] [11/12/13/14 " rguenth at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: ubizjak at gmail dot com @ 2023-02-03  9:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Uroš Bizjak <ubizjak at gmail dot com> ---
The testcase now PASSes compare-debug with:

gcc version 13.0.1 20230203 (experimental) [master r13-5678-g167b04b9b8a] (GCC)

... but passes due to different register allocation, where regrename is not
triggered. The core of the problem (See Comment #8) remains unfixed, and it
will require some deep surgery into regrename pass.

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

* [Bug rtl-optimization/104054] [11/12/13/14 Regression] '-fcompare-debug' failure (length) w/ -Os -funroll-loops since r8-3946-gfe94440235cfaa57
  2022-01-16 17:54 [Bug debug/104054] New: '-fcompare-debug' failure (length) w/ -Os -funroll-loops asolokha at gmx dot com
                   ` (11 preceding siblings ...)
  2023-02-03  9:44 ` ubizjak at gmail dot com
@ 2023-07-07 10:42 ` rguenth at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 10:42 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.5                        |11.5

--- Comment #12 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10 branch is being closed.

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

end of thread, other threads:[~2023-07-07 10:42 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-16 17:54 [Bug debug/104054] New: '-fcompare-debug' failure (length) w/ -Os -funroll-loops asolokha at gmx dot com
2022-01-17 10:44 ` [Bug debug/104054] [9/10/11/12 Regression] '-fcompare-debug' failure (length) w/ -Os -funroll-loops since r8-3946-gfe94440235cfaa57 marxin at gcc dot gnu.org
2022-01-17 10:54 ` [Bug rtl-optimization/104054] " pinskia at gcc dot gnu.org
2022-01-17 12:22 ` ubizjak at gmail dot com
2022-01-17 12:24 ` ubizjak at gmail dot com
2022-01-17 12:38 ` ubizjak at gmail dot com
2022-01-17 17:45 ` jakub at gcc dot gnu.org
2022-01-18 13:47 ` rguenth at gcc dot gnu.org
2022-01-19 10:56 ` ubizjak at gmail dot com
2022-01-19 12:52 ` ubizjak at gmail dot com
2022-05-27  9:47 ` [Bug rtl-optimization/104054] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:47 ` jakub at gcc dot gnu.org
2023-02-03  9:44 ` ubizjak at gmail dot com
2023-07-07 10:42 ` [Bug rtl-optimization/104054] [11/12/13/14 " rguenth 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).