public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/104544] New: [10/11/12 Regression] '-fcompare-debug' failure (length) w/ -O2
@ 2022-02-15  7:13 asolokha at gmx dot com
  2022-02-15  7:21 ` [Bug debug/104544] " pinskia at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: asolokha at gmx dot com @ 2022-02-15  7:13 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104544
           Summary: [10/11/12 Regression] '-fcompare-debug' failure
                    (length) w/ -O2
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: compare-debug-failure
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asolokha at gmx dot com
  Target Milestone: ---
            Target: aarch64-linux-gnu

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

gcc 12.0.1 20220213 snapshot (g:58aeb75d4097010ad9bb72b964265b18ab284f93) fails
-fcompare-debug check when compiling the following testcase w/ -O2:

int m, n;
__int128 q;

void
bar (unsigned __int128 x, int y)
{
  if (x)
    q += y;
}

void
foo (void)
{
  bar (!!q - 1, (m += m ? m : 1) < n);
}

% aarch64-linux-gnu-gcc-12.0.1 -O2 -fcompare-debug -c tod26vmj.c
aarch64-linux-gnu-gcc-12.0.1: error: tod26vmj.c: '-fcompare-debug' failure
(length)

gkd diff attached.

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

* [Bug debug/104544] [10/11/12 Regression] '-fcompare-debug' failure (length) w/ -O2
  2022-02-15  7:13 [Bug debug/104544] New: [10/11/12 Regression] '-fcompare-debug' failure (length) w/ -O2 asolokha at gmx dot com
@ 2022-02-15  7:21 ` pinskia at gcc dot gnu.org
  2022-02-15  8:28 ` [Bug rtl-optimization/104544] " rguenth at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-02-15  7:21 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-02-15
                 CC|                            |pinskia at gcc dot gnu.org
     Ever confirmed|0                           |1
   Target Milestone|---                         |10.4

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The difference starts in combine.

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

* [Bug rtl-optimization/104544] [10/11/12 Regression] '-fcompare-debug' failure (length) w/ -O2
  2022-02-15  7:13 [Bug debug/104544] New: [10/11/12 Regression] '-fcompare-debug' failure (length) w/ -O2 asolokha at gmx dot com
  2022-02-15  7:21 ` [Bug debug/104544] " pinskia at gcc dot gnu.org
@ 2022-02-15  8:28 ` rguenth at gcc dot gnu.org
  2022-02-15 13:27 ` jakub at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-02-15  8:28 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|debug                       |rtl-optimization
           Priority|P3                          |P2

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

* [Bug rtl-optimization/104544] [10/11/12 Regression] '-fcompare-debug' failure (length) w/ -O2
  2022-02-15  7:13 [Bug debug/104544] New: [10/11/12 Regression] '-fcompare-debug' failure (length) w/ -O2 asolokha at gmx dot com
  2022-02-15  7:21 ` [Bug debug/104544] " pinskia at gcc dot gnu.org
  2022-02-15  8:28 ` [Bug rtl-optimization/104544] " rguenth at gcc dot gnu.org
@ 2022-02-15 13:27 ` jakub at gcc dot gnu.org
  2022-02-15 13:34 ` jakub at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-02-15 13:27 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I think this has been introduced with the PR84169 fix.

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

* [Bug rtl-optimization/104544] [10/11/12 Regression] '-fcompare-debug' failure (length) w/ -O2
  2022-02-15  7:13 [Bug debug/104544] New: [10/11/12 Regression] '-fcompare-debug' failure (length) w/ -O2 asolokha at gmx dot com
                   ` (2 preceding siblings ...)
  2022-02-15 13:27 ` jakub at gcc dot gnu.org
@ 2022-02-15 13:34 ` jakub at gcc dot gnu.org
  2022-02-16 13:50 ` cvs-commit at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-02-15 13:34 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 52446
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52446&action=edit
gcc12-pr104544.patch

Untested fix.

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

* [Bug rtl-optimization/104544] [10/11/12 Regression] '-fcompare-debug' failure (length) w/ -O2
  2022-02-15  7:13 [Bug debug/104544] New: [10/11/12 Regression] '-fcompare-debug' failure (length) w/ -O2 asolokha at gmx dot com
                   ` (3 preceding siblings ...)
  2022-02-15 13:34 ` jakub at gcc dot gnu.org
@ 2022-02-16 13:50 ` cvs-commit at gcc dot gnu.org
  2022-02-16 13:50 ` [Bug rtl-optimization/104544] [10/11 " jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-02-16 13:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

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

commit r12-7262-gf997eef5654f782bedb985c9285862c4d76b3209
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Feb 16 14:48:30 2022 +0100

    combine: Fix up -fcompare-debug issue in the combiner [PR104544]

    On the following testcase on aarch64-linux, we behave differently
    with -g and -g0.

    The problem is that on:
    (insn 10011 10010 10012 2 (set (reg:CC 66 cc)
            (compare:CC (reg:DI 105)
                (const_int 0 [0]))) "pr104544.c":18:3 407 {cmpdi}
         (expr_list:REG_DEAD (reg:DI 105)
            (nil)))
    (insn 10012 10011 10013 2 (set (reg:SI 109)
            (eq:SI (reg:CC 66 cc)
                (const_int 0 [0]))) "pr104544.c":18:3 444 {aarch64_cstoresi}
         (expr_list:REG_DEAD (reg:CC 66 cc)
            (nil)))
    (insn 10013 10012 10016 2 (set (reg:DI 110)
            (zero_extend:DI (reg:SI 109))) "pr104544.c":18:3 111
{*zero_extendsidi2_aarch64}
         (expr_list:REG_DEAD (reg:SI 109)
            (nil)))
    (insn 10016 10013 10017 2 (parallel [
                (set (reg:CC 66 cc)
                    (compare:CC (const_int 0 [0])
                        (reg:DI 110)))
                (set (reg:DI 111)
                    (neg:DI (reg:DI 110)))
            ]) "pr104544.c":18:3 281 {negdi_carryout}
         (expr_list:REG_DEAD (reg:DI 110)
            (nil)))
    ...
    (debug_insn 6 5 7 2 (var_location:SI y (debug_expr:SI D#5))
"pr104544.c":18:3 -1
         (nil))
    (debug_insn 7 6 10033 2 (debug_marker) "pr104544.c":11:3 -1
         (nil))
    (insn 10033 7 10034 2 (set (reg:DI 117 [ _14 ])
            (ior:DI (reg:DI 111)
                (reg:DI 112))) "pr104544.c":11:6 496 {iordi3}
         (expr_list:REG_DEAD (reg:DI 112)
            (expr_list:REG_DEAD (reg:DI 111)
                (nil))))
    we successfully split 3 insns into two:

    Trying 10011, 10013 -> 10016:
     10011: cc:CC=cmp(r105:DI,0)
          REG_DEAD r105:DI
     10013: r110:DI=cc:CC==0
          REG_DEAD cc:CC
     10016: {cc:CC=cmp(0,r110:DI);r111:DI=-r110:DI;}
          REG_DEAD r110:DI
    Failed to match this instruction:
    (parallel [
            (set (reg:CC 66 cc)
                (compare:CC (reg:DI 105)
                    (const_int 0 [0])))
            (set (reg:DI 111)
                (neg:DI (eq:DI (reg:DI 105)
                        (const_int 0 [0]))))
        ])
    Failed to match this instruction:
    (parallel [
            (set (reg:CC 66 cc)
                (compare:CC (reg:DI 105)
                    (const_int 0 [0])))
            (set (reg:DI 111)
                (neg:DI (eq:DI (reg:DI 105)
                        (const_int 0 [0]))))
        ])
    Successfully matched this instruction:
    (set (reg:DI 111)
        (neg:DI (eq:DI (reg:DI 105)
                (const_int 0 [0]))))
    Successfully matched this instruction:
    (set (reg:CC 66 cc)
        (compare:CC (reg:DI 105)
            (const_int 0 [0])))
    Successfully matched this instruction:
    (set (reg:DI 112)
        (neg:DI (eq:DI (reg:CC 66 cc)
                (const_int 0 [0]))))
    allowing combination of insns 10011, 10013 and 10016
    original costs 4 + 4 + 4 = 16
    replacement costs 4 + 4 = 12
    deferring deletion of insn with uid = 10011.

    but the code that searches forward for insns to update their log
    links (before the change there is a link from insn 10033 to insn 10016
    for pseudo 111) only finds insn 10033 and updates the log link if
    -g isn't enabled, otherwise it stops earlier because there are debug insns
    in between.  So, with -g LOG_LINKS of 10033 isn't updated, points
eventually
    to NOTE_INSN_DELETED and so we do not attempt to combine 10033 with other
    insns, while with -g0 we do.

    The following patch fixes that by instead ignoring debug insns during the
    searching.  We can still check BLOCK_FOR_INSN (insn) on those, because
    if we notice DEBUG_INSN in a following basic block, necessarily there won't
    be any further normal insns in the current block after it.

    2022-02-16  Jakub Jelinek  <jakub@redhat.com>

            PR rtl-optimization/104544
            * combine.cc (try_combine): When looking for insn whose links
            should be updated from i3 to i2, don't stop on debug insns, instead
            skip over them.

            * gcc.dg/pr104544.c: New test.

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

* [Bug rtl-optimization/104544] [10/11 Regression] '-fcompare-debug' failure (length) w/ -O2
  2022-02-15  7:13 [Bug debug/104544] New: [10/11/12 Regression] '-fcompare-debug' failure (length) w/ -O2 asolokha at gmx dot com
                   ` (4 preceding siblings ...)
  2022-02-16 13:50 ` cvs-commit at gcc dot gnu.org
@ 2022-02-16 13:50 ` jakub at gcc dot gnu.org
  2022-02-19  8:03 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-02-16 13:50 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[10/11/12 Regression]       |[10/11 Regression]
                   |'-fcompare-debug' failure   |'-fcompare-debug' failure
                   |(length) w/ -O2             |(length) w/ -O2

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed on the trunk.

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

* [Bug rtl-optimization/104544] [10/11 Regression] '-fcompare-debug' failure (length) w/ -O2
  2022-02-15  7:13 [Bug debug/104544] New: [10/11/12 Regression] '-fcompare-debug' failure (length) w/ -O2 asolokha at gmx dot com
                   ` (5 preceding siblings ...)
  2022-02-16 13:50 ` [Bug rtl-optimization/104544] [10/11 " jakub at gcc dot gnu.org
@ 2022-02-19  8:03 ` cvs-commit at gcc dot gnu.org
  2022-02-19  8:09 ` [Bug rtl-optimization/104544] [10 " jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-02-19  8:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

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

commit r11-9609-gcdebe6f777a24ae4c8fe520302a7cc52ca6620c4
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Feb 16 14:48:30 2022 +0100

    combine: Fix up -fcompare-debug issue in the combiner [PR104544]

    On the following testcase on aarch64-linux, we behave differently
    with -g and -g0.

    The problem is that on:
    (insn 10011 10010 10012 2 (set (reg:CC 66 cc)
            (compare:CC (reg:DI 105)
                (const_int 0 [0]))) "pr104544.c":18:3 407 {cmpdi}
         (expr_list:REG_DEAD (reg:DI 105)
            (nil)))
    (insn 10012 10011 10013 2 (set (reg:SI 109)
            (eq:SI (reg:CC 66 cc)
                (const_int 0 [0]))) "pr104544.c":18:3 444 {aarch64_cstoresi}
         (expr_list:REG_DEAD (reg:CC 66 cc)
            (nil)))
    (insn 10013 10012 10016 2 (set (reg:DI 110)
            (zero_extend:DI (reg:SI 109))) "pr104544.c":18:3 111
{*zero_extendsidi2_aarch64}
         (expr_list:REG_DEAD (reg:SI 109)
            (nil)))
    (insn 10016 10013 10017 2 (parallel [
                (set (reg:CC 66 cc)
                    (compare:CC (const_int 0 [0])
                        (reg:DI 110)))
                (set (reg:DI 111)
                    (neg:DI (reg:DI 110)))
            ]) "pr104544.c":18:3 281 {negdi_carryout}
         (expr_list:REG_DEAD (reg:DI 110)
            (nil)))
    ...
    (debug_insn 6 5 7 2 (var_location:SI y (debug_expr:SI D#5))
"pr104544.c":18:3 -1
         (nil))
    (debug_insn 7 6 10033 2 (debug_marker) "pr104544.c":11:3 -1
         (nil))
    (insn 10033 7 10034 2 (set (reg:DI 117 [ _14 ])
            (ior:DI (reg:DI 111)
                (reg:DI 112))) "pr104544.c":11:6 496 {iordi3}
         (expr_list:REG_DEAD (reg:DI 112)
            (expr_list:REG_DEAD (reg:DI 111)
                (nil))))
    we successfully split 3 insns into two:

    Trying 10011, 10013 -> 10016:
     10011: cc:CC=cmp(r105:DI,0)
          REG_DEAD r105:DI
     10013: r110:DI=cc:CC==0
          REG_DEAD cc:CC
     10016: {cc:CC=cmp(0,r110:DI);r111:DI=-r110:DI;}
          REG_DEAD r110:DI
    Failed to match this instruction:
    (parallel [
            (set (reg:CC 66 cc)
                (compare:CC (reg:DI 105)
                    (const_int 0 [0])))
            (set (reg:DI 111)
                (neg:DI (eq:DI (reg:DI 105)
                        (const_int 0 [0]))))
        ])
    Failed to match this instruction:
    (parallel [
            (set (reg:CC 66 cc)
                (compare:CC (reg:DI 105)
                    (const_int 0 [0])))
            (set (reg:DI 111)
                (neg:DI (eq:DI (reg:DI 105)
                        (const_int 0 [0]))))
        ])
    Successfully matched this instruction:
    (set (reg:DI 111)
        (neg:DI (eq:DI (reg:DI 105)
                (const_int 0 [0]))))
    Successfully matched this instruction:
    (set (reg:CC 66 cc)
        (compare:CC (reg:DI 105)
            (const_int 0 [0])))
    Successfully matched this instruction:
    (set (reg:DI 112)
        (neg:DI (eq:DI (reg:CC 66 cc)
                (const_int 0 [0]))))
    allowing combination of insns 10011, 10013 and 10016
    original costs 4 + 4 + 4 = 16
    replacement costs 4 + 4 = 12
    deferring deletion of insn with uid = 10011.

    but the code that searches forward for insns to update their log
    links (before the change there is a link from insn 10033 to insn 10016
    for pseudo 111) only finds insn 10033 and updates the log link if
    -g isn't enabled, otherwise it stops earlier because there are debug insns
    in between.  So, with -g LOG_LINKS of 10033 isn't updated, points
eventually
    to NOTE_INSN_DELETED and so we do not attempt to combine 10033 with other
    insns, while with -g0 we do.

    The following patch fixes that by instead ignoring debug insns during the
    searching.  We can still check BLOCK_FOR_INSN (insn) on those, because
    if we notice DEBUG_INSN in a following basic block, necessarily there won't
    be any further normal insns in the current block after it.

    2022-02-16  Jakub Jelinek  <jakub@redhat.com>

            PR rtl-optimization/104544
            * combine.c (try_combine): When looking for insn whose links
            should be updated from i3 to i2, don't stop on debug insns, instead
            skip over them.

            * gcc.dg/pr104544.c: New test.

    (cherry picked from commit f997eef5654f782bedb985c9285862c4d76b3209)

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

* [Bug rtl-optimization/104544] [10 Regression] '-fcompare-debug' failure (length) w/ -O2
  2022-02-15  7:13 [Bug debug/104544] New: [10/11/12 Regression] '-fcompare-debug' failure (length) w/ -O2 asolokha at gmx dot com
                   ` (6 preceding siblings ...)
  2022-02-19  8:03 ` cvs-commit at gcc dot gnu.org
@ 2022-02-19  8:09 ` jakub at gcc dot gnu.org
  2022-05-10  8:24 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-02-19  8:09 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[10/11 Regression]          |[10 Regression]
                   |'-fcompare-debug' failure   |'-fcompare-debug' failure
                   |(length) w/ -O2             |(length) w/ -O2

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed for 11.3+ too.

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

* [Bug rtl-optimization/104544] [10 Regression] '-fcompare-debug' failure (length) w/ -O2
  2022-02-15  7:13 [Bug debug/104544] New: [10/11/12 Regression] '-fcompare-debug' failure (length) w/ -O2 asolokha at gmx dot com
                   ` (7 preceding siblings ...)
  2022-02-19  8:09 ` [Bug rtl-optimization/104544] [10 " jakub at gcc dot gnu.org
@ 2022-05-10  8:24 ` cvs-commit at gcc dot gnu.org
  2022-06-28 10:48 ` jakub at gcc dot gnu.org
  2023-07-07  9:57 ` rguenth at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-10  8:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

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

commit r10-10684-gde63115b4e819ef0e3cddbeb6ef036e7971b044b
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Feb 16 14:48:30 2022 +0100

    combine: Fix up -fcompare-debug issue in the combiner [PR104544]

    On the following testcase on aarch64-linux, we behave differently
    with -g and -g0.

    The problem is that on:
    (insn 10011 10010 10012 2 (set (reg:CC 66 cc)
            (compare:CC (reg:DI 105)
                (const_int 0 [0]))) "pr104544.c":18:3 407 {cmpdi}
         (expr_list:REG_DEAD (reg:DI 105)
            (nil)))
    (insn 10012 10011 10013 2 (set (reg:SI 109)
            (eq:SI (reg:CC 66 cc)
                (const_int 0 [0]))) "pr104544.c":18:3 444 {aarch64_cstoresi}
         (expr_list:REG_DEAD (reg:CC 66 cc)
            (nil)))
    (insn 10013 10012 10016 2 (set (reg:DI 110)
            (zero_extend:DI (reg:SI 109))) "pr104544.c":18:3 111
{*zero_extendsidi2_aarch64}
         (expr_list:REG_DEAD (reg:SI 109)
            (nil)))
    (insn 10016 10013 10017 2 (parallel [
                (set (reg:CC 66 cc)
                    (compare:CC (const_int 0 [0])
                        (reg:DI 110)))
                (set (reg:DI 111)
                    (neg:DI (reg:DI 110)))
            ]) "pr104544.c":18:3 281 {negdi_carryout}
         (expr_list:REG_DEAD (reg:DI 110)
            (nil)))
    ...
    (debug_insn 6 5 7 2 (var_location:SI y (debug_expr:SI D#5))
"pr104544.c":18:3 -1
         (nil))
    (debug_insn 7 6 10033 2 (debug_marker) "pr104544.c":11:3 -1
         (nil))
    (insn 10033 7 10034 2 (set (reg:DI 117 [ _14 ])
            (ior:DI (reg:DI 111)
                (reg:DI 112))) "pr104544.c":11:6 496 {iordi3}
         (expr_list:REG_DEAD (reg:DI 112)
            (expr_list:REG_DEAD (reg:DI 111)
                (nil))))
    we successfully split 3 insns into two:

    Trying 10011, 10013 -> 10016:
     10011: cc:CC=cmp(r105:DI,0)
          REG_DEAD r105:DI
     10013: r110:DI=cc:CC==0
          REG_DEAD cc:CC
     10016: {cc:CC=cmp(0,r110:DI);r111:DI=-r110:DI;}
          REG_DEAD r110:DI
    Failed to match this instruction:
    (parallel [
            (set (reg:CC 66 cc)
                (compare:CC (reg:DI 105)
                    (const_int 0 [0])))
            (set (reg:DI 111)
                (neg:DI (eq:DI (reg:DI 105)
                        (const_int 0 [0]))))
        ])
    Failed to match this instruction:
    (parallel [
            (set (reg:CC 66 cc)
                (compare:CC (reg:DI 105)
                    (const_int 0 [0])))
            (set (reg:DI 111)
                (neg:DI (eq:DI (reg:DI 105)
                        (const_int 0 [0]))))
        ])
    Successfully matched this instruction:
    (set (reg:DI 111)
        (neg:DI (eq:DI (reg:DI 105)
                (const_int 0 [0]))))
    Successfully matched this instruction:
    (set (reg:CC 66 cc)
        (compare:CC (reg:DI 105)
            (const_int 0 [0])))
    Successfully matched this instruction:
    (set (reg:DI 112)
        (neg:DI (eq:DI (reg:CC 66 cc)
                (const_int 0 [0]))))
    allowing combination of insns 10011, 10013 and 10016
    original costs 4 + 4 + 4 = 16
    replacement costs 4 + 4 = 12
    deferring deletion of insn with uid = 10011.

    but the code that searches forward for insns to update their log
    links (before the change there is a link from insn 10033 to insn 10016
    for pseudo 111) only finds insn 10033 and updates the log link if
    -g isn't enabled, otherwise it stops earlier because there are debug insns
    in between.  So, with -g LOG_LINKS of 10033 isn't updated, points
eventually
    to NOTE_INSN_DELETED and so we do not attempt to combine 10033 with other
    insns, while with -g0 we do.

    The following patch fixes that by instead ignoring debug insns during the
    searching.  We can still check BLOCK_FOR_INSN (insn) on those, because
    if we notice DEBUG_INSN in a following basic block, necessarily there won't
    be any further normal insns in the current block after it.

    2022-02-16  Jakub Jelinek  <jakub@redhat.com>

            PR rtl-optimization/104544
            * combine.c (try_combine): When looking for insn whose links
            should be updated from i3 to i2, don't stop on debug insns, instead
            skip over them.

            * gcc.dg/pr104544.c: New test.

    (cherry picked from commit f997eef5654f782bedb985c9285862c4d76b3209)

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

* [Bug rtl-optimization/104544] [10 Regression] '-fcompare-debug' failure (length) w/ -O2
  2022-02-15  7:13 [Bug debug/104544] New: [10/11/12 Regression] '-fcompare-debug' failure (length) w/ -O2 asolokha at gmx dot com
                   ` (8 preceding siblings ...)
  2022-05-10  8:24 ` cvs-commit at gcc dot gnu.org
@ 2022-06-28 10:48 ` jakub at gcc dot gnu.org
  2023-07-07  9:57 ` rguenth at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:48 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #9 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] 12+ messages in thread

* [Bug rtl-optimization/104544] [10 Regression] '-fcompare-debug' failure (length) w/ -O2
  2022-02-15  7:13 [Bug debug/104544] New: [10/11/12 Regression] '-fcompare-debug' failure (length) w/ -O2 asolokha at gmx dot com
                   ` (9 preceding siblings ...)
  2022-06-28 10:48 ` jakub at gcc dot gnu.org
@ 2023-07-07  9:57 ` rguenth at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07  9:57 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |10.3.0
   Target Milestone|10.5                        |10.4
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
fixed.

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

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

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-15  7:13 [Bug debug/104544] New: [10/11/12 Regression] '-fcompare-debug' failure (length) w/ -O2 asolokha at gmx dot com
2022-02-15  7:21 ` [Bug debug/104544] " pinskia at gcc dot gnu.org
2022-02-15  8:28 ` [Bug rtl-optimization/104544] " rguenth at gcc dot gnu.org
2022-02-15 13:27 ` jakub at gcc dot gnu.org
2022-02-15 13:34 ` jakub at gcc dot gnu.org
2022-02-16 13:50 ` cvs-commit at gcc dot gnu.org
2022-02-16 13:50 ` [Bug rtl-optimization/104544] [10/11 " jakub at gcc dot gnu.org
2022-02-19  8:03 ` cvs-commit at gcc dot gnu.org
2022-02-19  8:09 ` [Bug rtl-optimization/104544] [10 " jakub at gcc dot gnu.org
2022-05-10  8:24 ` cvs-commit at gcc dot gnu.org
2022-06-28 10:48 ` jakub at gcc dot gnu.org
2023-07-07  9:57 ` 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).