public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/103837] New: [12 Regression] '-fcompare-debug' failure (length) w/ -Og -fmove-loop-invariants -fnon-call-exceptions -fno-tree-dce
@ 2021-12-26 16:45 asolokha at gmx dot com
  2021-12-26 21:10 ` [Bug debug/103837] " pinskia at gcc dot gnu.org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: asolokha at gmx dot com @ 2021-12-26 16:45 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103837
           Summary: [12 Regression] '-fcompare-debug' failure (length) w/
                    -Og -fmove-loop-invariants -fnon-call-exceptions
                    -fno-tree-dce
           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

gcc 12.0.0 20211219 snapshot (g:fcbf94a5be9e0c1ecad92da773a6632b86b7f70a) fails
-fcompare-debug check when compiling the following testcase w/ -Og
-fmove-loop-invariants -fnon-call-exceptions -fno-tree-dce:

unsigned long int
foo (int x)
{
  double a;
  int b;
  unsigned long int ret = a;

  for (;;)
    {
      b = !!((int) a);
      a = x;
    }

  return ret;
}

% x86_64-unknown-linux-gnu-gcc-12.0.0 -Og -fcompare-debug
-fmove-loop-invariants -fnon-call-exceptions -fno-tree-dce -c dbvufwcn.c
x86_64-unknown-linux-gnu-gcc-12.0.0: error: dbvufwcn.c: '-fcompare-debug'
failure (length)

--- dbvufwcn.c.gkd      2021-12-26 23:40:50.743359823 +0700
+++ dbvufwcn.gk.c.gkd   2021-12-26 23:40:50.794356341 +0700
@@ -17,16 +17,6 @@
      (expr_list:REG_DEAD (reg/v:DF 20 xmm0 [orig:84 a ] [84])
         (expr_list:REG_UNUSED (reg:CCFP 17 flags)
             (nil))))
-(insn # 0 0 2 (set (reg:V2DF 20 xmm0 [orig:84 a ] [84])
-        (const_vector:V2DF [
-                (const_double:DF 0.0 [0x0.0p+0]) repeated x2
-            ])) "dbvufwcn.c":11:9# {movv2df_internal}
-     (nil))
-(insn # 0 0 2 (set (reg:V2DF 20 xmm0 [orig:84 a ] [84])
-        (vec_merge:V2DF (vec_duplicate:V2DF (float:DF (reg:SI 5 di [94])))
-            (reg:V2DF 20 xmm0 [orig:84 a ] [84])
-            (const_int 1 [0x1]))) "dbvufwcn.c":11:9# {sse2_cvtsi2sd}
-     (nil))
 (code_label # 0 0 3 4 (nil) [1 uses])
 (note # 0 0 [bb 3] NOTE_INSN_BASIC_BLOCK)
 (jump_insn # 0 0 3 (set (pc)

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

* [Bug debug/103837] [12 Regression] '-fcompare-debug' failure (length) w/ -Og -fmove-loop-invariants -fnon-call-exceptions -fno-tree-dce
  2021-12-26 16:45 [Bug debug/103837] New: [12 Regression] '-fcompare-debug' failure (length) w/ -Og -fmove-loop-invariants -fnon-call-exceptions -fno-tree-dce asolokha at gmx dot com
@ 2021-12-26 21:10 ` pinskia at gcc dot gnu.org
  2021-12-27 11:28 ` [Bug tree-optimization/103837] [9/10/11/12 " jakub at gcc dot gnu.org
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-26 21:10 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
   Target Milestone|---                         |12.0

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

* [Bug tree-optimization/103837] [9/10/11/12 Regression] '-fcompare-debug' failure (length) w/ -Og -fmove-loop-invariants -fnon-call-exceptions -fno-tree-dce
  2021-12-26 16:45 [Bug debug/103837] New: [12 Regression] '-fcompare-debug' failure (length) w/ -Og -fmove-loop-invariants -fnon-call-exceptions -fno-tree-dce asolokha at gmx dot com
  2021-12-26 21:10 ` [Bug debug/103837] " pinskia at gcc dot gnu.org
@ 2021-12-27 11:28 ` jakub at gcc dot gnu.org
  2021-12-27 11:35 ` pinskia at gcc dot gnu.org
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-12-27 11:28 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-12-27
                 CC|                            |jakub at gcc dot gnu.org
            Summary|[12 Regression]             |[9/10/11/12 Regression]
                   |'-fcompare-debug' failure   |'-fcompare-debug' failure
                   |(length) w/ -Og             |(length) w/ -Og
                   |-fmove-loop-invariants      |-fmove-loop-invariants
                   |-fnon-call-exceptions       |-fnon-call-exceptions
                   |-fno-tree-dce               |-fno-tree-dce
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
With the above options it started with
r12-3221-g1313111fdec0d0de4228b5e839ca728b3e4b106e
If I add -fexceptions, it started with
r12-2307-gb15e301748f0e042379909e32b3ade439dd8f8f9
With additional -fdelete-dead-exceptions it started with
r6-701-gaa953e2fc52e2196d62b9669a69c9e82de43dc3c

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

* [Bug tree-optimization/103837] [9/10/11/12 Regression] '-fcompare-debug' failure (length) w/ -Og -fmove-loop-invariants -fnon-call-exceptions -fno-tree-dce
  2021-12-26 16:45 [Bug debug/103837] New: [12 Regression] '-fcompare-debug' failure (length) w/ -Og -fmove-loop-invariants -fnon-call-exceptions -fno-tree-dce asolokha at gmx dot com
  2021-12-26 21:10 ` [Bug debug/103837] " pinskia at gcc dot gnu.org
  2021-12-27 11:28 ` [Bug tree-optimization/103837] [9/10/11/12 " jakub at gcc dot gnu.org
@ 2021-12-27 11:35 ` pinskia at gcc dot gnu.org
  2021-12-27 11:40 ` jakub at gcc dot gnu.org
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-27 11:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
It looks like can_move_invariant_reg is not ignoring debug insns.

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

* [Bug tree-optimization/103837] [9/10/11/12 Regression] '-fcompare-debug' failure (length) w/ -Og -fmove-loop-invariants -fnon-call-exceptions -fno-tree-dce
  2021-12-26 16:45 [Bug debug/103837] New: [12 Regression] '-fcompare-debug' failure (length) w/ -Og -fmove-loop-invariants -fnon-call-exceptions -fno-tree-dce asolokha at gmx dot com
                   ` (2 preceding siblings ...)
  2021-12-27 11:35 ` pinskia at gcc dot gnu.org
@ 2021-12-27 11:40 ` jakub at gcc dot gnu.org
  2021-12-27 12:19 ` jakub at gcc dot gnu.org
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-12-27 11:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Yeah, exactly, looking into that now.

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

* [Bug tree-optimization/103837] [9/10/11/12 Regression] '-fcompare-debug' failure (length) w/ -Og -fmove-loop-invariants -fnon-call-exceptions -fno-tree-dce
  2021-12-26 16:45 [Bug debug/103837] New: [12 Regression] '-fcompare-debug' failure (length) w/ -Og -fmove-loop-invariants -fnon-call-exceptions -fno-tree-dce asolokha at gmx dot com
                   ` (3 preceding siblings ...)
  2021-12-27 11:40 ` jakub at gcc dot gnu.org
@ 2021-12-27 12:19 ` jakub at gcc dot gnu.org
  2021-12-27 12:50 ` [Bug rtl-optimization/103837] " jakub at gcc dot gnu.org
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-12-27 12:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The loop body is:
(code_label 10026 4 10019 3 4 (nil) [0 uses])
(note 10019 10026 5 3 [bb 3] NOTE_INSN_BASIC_BLOCK)
(debug_insn 5 10019 6 3 (var_location:DF a (reg/v:DF 84 [ a ])) -1
     (nil))
(debug_insn 6 5 7 3 (debug_marker) "pr103837.c":8:3 -1
     (nil))
(debug_insn 7 6 17 3 (debug_marker) "pr103837.c":10:7 -1
     (nil))
(debug_insn 17 7 16 3 (var_location:SI D#6 (fix:SI (reg/v:DF 84 [ a ]))) -1
     (nil))
(debug_insn 16 17 15 3 (var_location:SI D#5 (debug_expr:SI D#6)) -1
     (nil))
(debug_insn 15 16 14 3 (var_location:CCZ D#4 (compare:CCZ (debug_expr:SI D#5)
        (const_int 0 [0]))) -1
     (nil))
(debug_insn 14 15 13 3 (var_location:QI D#3 (ne:QI (debug_expr:CCZ D#4)
        (const_int 0 [0]))) -1
     (nil))
(debug_insn 13 14 12 3 (var_location:QI D#2 (debug_expr:QI D#3)) -1
     (nil))
(debug_insn 12 13 8 3 (var_location:SI D#1 (zero_extend:SI (debug_expr:QI
D#2))) -1
     (nil))
(debug_insn 8 12 9 3 (var_location:SI b (debug_expr:SI D#1)) "pr103837.c":10:9
-1
     (nil))
(debug_insn 9 8 10025 3 (debug_marker) "pr103837.c":11:7 -1
     (nil))
(insn 10025 9 10 3 (set (reg/v:DF 84 [ a ])
        (float:DF (reg/v:SI 88 [ x ]))) "pr103837.c":11:9 207 {*floatsidf2}
     (nil))
(debug_insn 10 10025 11 3 (var_location:DF a (reg/v:DF 84 [ a ]))
"pr103837.c":11:9 -1
     (nil))
(debug_insn 11 10 0 3 (debug_marker) "pr103837.c":8:3 -1
     (nil))

and because of the uninitialized a there is a DEBUG_INSN use of pseudo 84 e.g.
in insns 5 and 17 before it is actually initialized in insn 10025.
Ignoring DEBUG_INSNs in can_move_invariant_reg in the for (use =
DF_REG_USE_CHAIN (dest_regno); use; use = DF_REF_NEXT_REG (use)) loop is
trivial, the big question is what shall we do with those debug insns.
For this particular case where it is uninitialized, I bet either resetting or
keeping them as is would be fine.
But my understanding of can_move_invariant_reg is that we could have:
  pseudo = whatever1;
  loop_header
    debug_insn use pseudo;
    pseudo = whatever2;
    use pseudo;
  loop_end
and in that case moving the invariant without resetting the debug insns would
be wrong:
  pseudo = whatever1;
  pseudo = whatever2;
  loop_header
    debug_insn use pseudo;
    use pseudo;
  loop_end

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

* [Bug rtl-optimization/103837] [9/10/11/12 Regression] '-fcompare-debug' failure (length) w/ -Og -fmove-loop-invariants -fnon-call-exceptions -fno-tree-dce
  2021-12-26 16:45 [Bug debug/103837] New: [12 Regression] '-fcompare-debug' failure (length) w/ -Og -fmove-loop-invariants -fnon-call-exceptions -fno-tree-dce asolokha at gmx dot com
                   ` (4 preceding siblings ...)
  2021-12-27 12:19 ` jakub at gcc dot gnu.org
@ 2021-12-27 12:50 ` jakub at gcc dot gnu.org
  2021-12-28 16:40 ` cvs-commit at gcc dot gnu.org
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-12-27 12:50 UTC (permalink / raw)
  To: gcc-bugs

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

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 #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 52069
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52069&action=edit
gcc12-pr103837.patch

Untested fix.

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

* [Bug rtl-optimization/103837] [9/10/11/12 Regression] '-fcompare-debug' failure (length) w/ -Og -fmove-loop-invariants -fnon-call-exceptions -fno-tree-dce
  2021-12-26 16:45 [Bug debug/103837] New: [12 Regression] '-fcompare-debug' failure (length) w/ -Og -fmove-loop-invariants -fnon-call-exceptions -fno-tree-dce asolokha at gmx dot com
                   ` (5 preceding siblings ...)
  2021-12-27 12:50 ` [Bug rtl-optimization/103837] " jakub at gcc dot gnu.org
@ 2021-12-28 16:40 ` cvs-commit at gcc dot gnu.org
  2021-12-28 16:43 ` [Bug rtl-optimization/103837] [9/10/11 " jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-12-28 16:40 UTC (permalink / raw)
  To: gcc-bugs

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

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

commit r12-6134-g3c5fd3616f73fbcd241cc3a5e09275c2b0c49bd4
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Dec 28 17:40:17 2021 +0100

    loop-invariant: Fix -fcompare-debug failure [PR103837]

    In the following testcase we have a -fcompare-debug failure, because
    can_move_invariant_reg doesn't ignore DEBUG_INSNs in its decisions.
    In the testcase we have due to uninitialized variable:
      loop_header
        debug_insn using pseudo84
        pseudo84 = invariant
        insn using pseudo84
      end loop
    and with -g decide not to move the pseudo84 = invariant before the
    loop header; in this case not resetting the debug insns might be fine.
    But, we could have also:
      pseudo84 = whatever
      loop_header
        debug_insn using pseudo84
        pseudo84 = invariant
        insn using pseudo84
      end loop
    and in that case not resetting the debug insns would result in wrong-debug.
    And, we don't really have generally a good substitution on what pseudo84
    contains, it could inherit various values from different paths.
    So, the following patch ignores DEBUG_INSNs in the decisions, and if there
    are any that previously prevented the optimization, resets them before
    return true.

    2021-12-28  Jakub Jelinek  <jakub@redhat.com>

            PR rtl-optimization/103837
            * loop-invariant.c (can_move_invariant_reg): Ignore DEBUG_INSNs in
            the decisions whether to return false or continue and right before
            returning true reset those debug insns that previously caused
            returning false.

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

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

* [Bug rtl-optimization/103837] [9/10/11 Regression] '-fcompare-debug' failure (length) w/ -Og -fmove-loop-invariants -fnon-call-exceptions -fno-tree-dce
  2021-12-26 16:45 [Bug debug/103837] New: [12 Regression] '-fcompare-debug' failure (length) w/ -Og -fmove-loop-invariants -fnon-call-exceptions -fno-tree-dce asolokha at gmx dot com
                   ` (6 preceding siblings ...)
  2021-12-28 16:40 ` cvs-commit at gcc dot gnu.org
@ 2021-12-28 16:43 ` jakub at gcc dot gnu.org
  2022-01-04 13:37 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-12-28 16:43 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[9/10/11/12 Regression]     |[9/10/11 Regression]
                   |'-fcompare-debug' failure   |'-fcompare-debug' failure
                   |(length) w/ -Og             |(length) w/ -Og
                   |-fmove-loop-invariants      |-fmove-loop-invariants
                   |-fnon-call-exceptions       |-fnon-call-exceptions
                   |-fno-tree-dce               |-fno-tree-dce
   Target Milestone|12.0                        |9.5

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

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

* [Bug rtl-optimization/103837] [9/10/11 Regression] '-fcompare-debug' failure (length) w/ -Og -fmove-loop-invariants -fnon-call-exceptions -fno-tree-dce
  2021-12-26 16:45 [Bug debug/103837] New: [12 Regression] '-fcompare-debug' failure (length) w/ -Og -fmove-loop-invariants -fnon-call-exceptions -fno-tree-dce asolokha at gmx dot com
                   ` (7 preceding siblings ...)
  2021-12-28 16:43 ` [Bug rtl-optimization/103837] [9/10/11 " jakub at gcc dot gnu.org
@ 2022-01-04 13:37 ` rguenth at gcc dot gnu.org
  2022-01-24  9:20 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-04 13:37 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

* [Bug rtl-optimization/103837] [9/10/11 Regression] '-fcompare-debug' failure (length) w/ -Og -fmove-loop-invariants -fnon-call-exceptions -fno-tree-dce
  2021-12-26 16:45 [Bug debug/103837] New: [12 Regression] '-fcompare-debug' failure (length) w/ -Og -fmove-loop-invariants -fnon-call-exceptions -fno-tree-dce asolokha at gmx dot com
                   ` (8 preceding siblings ...)
  2022-01-04 13:37 ` rguenth at gcc dot gnu.org
@ 2022-01-24  9:20 ` cvs-commit at gcc dot gnu.org
  2022-01-24  9:30 ` [Bug rtl-optimization/103837] [9/10 " jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-24  9:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 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:06142a317a4e71e509d9e009615adec2fdfa9c67

commit r11-9492-g06142a317a4e71e509d9e009615adec2fdfa9c67
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Dec 28 17:40:17 2021 +0100

    loop-invariant: Fix -fcompare-debug failure [PR103837]

    In the following testcase we have a -fcompare-debug failure, because
    can_move_invariant_reg doesn't ignore DEBUG_INSNs in its decisions.
    In the testcase we have due to uninitialized variable:
      loop_header
        debug_insn using pseudo84
        pseudo84 = invariant
        insn using pseudo84
      end loop
    and with -g decide not to move the pseudo84 = invariant before the
    loop header; in this case not resetting the debug insns might be fine.
    But, we could have also:
      pseudo84 = whatever
      loop_header
        debug_insn using pseudo84
        pseudo84 = invariant
        insn using pseudo84
      end loop
    and in that case not resetting the debug insns would result in wrong-debug.
    And, we don't really have generally a good substitution on what pseudo84
    contains, it could inherit various values from different paths.
    So, the following patch ignores DEBUG_INSNs in the decisions, and if there
    are any that previously prevented the optimization, resets them before
    return true.

    2021-12-28  Jakub Jelinek  <jakub@redhat.com>

            PR rtl-optimization/103837
            * loop-invariant.c (can_move_invariant_reg): Ignore DEBUG_INSNs in
            the decisions whether to return false or continue and right before
            returning true reset those debug insns that previously caused
            returning false.

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

    (cherry picked from commit 3c5fd3616f73fbcd241cc3a5e09275c2b0c49bd4)

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

* [Bug rtl-optimization/103837] [9/10 Regression] '-fcompare-debug' failure (length) w/ -Og -fmove-loop-invariants -fnon-call-exceptions -fno-tree-dce
  2021-12-26 16:45 [Bug debug/103837] New: [12 Regression] '-fcompare-debug' failure (length) w/ -Og -fmove-loop-invariants -fnon-call-exceptions -fno-tree-dce asolokha at gmx dot com
                   ` (9 preceding siblings ...)
  2022-01-24  9:20 ` cvs-commit at gcc dot gnu.org
@ 2022-01-24  9:30 ` jakub at gcc dot gnu.org
  2022-05-10  8:22 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-01-24  9:30 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[9/10/11 Regression]        |[9/10 Regression]
                   |'-fcompare-debug' failure   |'-fcompare-debug' failure
                   |(length) w/ -Og             |(length) w/ -Og
                   |-fmove-loop-invariants      |-fmove-loop-invariants
                   |-fnon-call-exceptions       |-fnon-call-exceptions
                   |-fno-tree-dce               |-fno-tree-dce

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

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

* [Bug rtl-optimization/103837] [9/10 Regression] '-fcompare-debug' failure (length) w/ -Og -fmove-loop-invariants -fnon-call-exceptions -fno-tree-dce
  2021-12-26 16:45 [Bug debug/103837] New: [12 Regression] '-fcompare-debug' failure (length) w/ -Og -fmove-loop-invariants -fnon-call-exceptions -fno-tree-dce asolokha at gmx dot com
                   ` (10 preceding siblings ...)
  2022-01-24  9:30 ` [Bug rtl-optimization/103837] [9/10 " jakub at gcc dot gnu.org
@ 2022-05-10  8:22 ` cvs-commit at gcc dot gnu.org
  2022-05-11  6:23 ` cvs-commit at gcc dot gnu.org
  2022-05-11  6:36 ` jakub at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-10  8:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 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:aa998156c69fcb70ed637f34fd86e47020254ce5

commit r10-10661-gaa998156c69fcb70ed637f34fd86e47020254ce5
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Dec 28 17:40:17 2021 +0100

    loop-invariant: Fix -fcompare-debug failure [PR103837]

    In the following testcase we have a -fcompare-debug failure, because
    can_move_invariant_reg doesn't ignore DEBUG_INSNs in its decisions.
    In the testcase we have due to uninitialized variable:
      loop_header
        debug_insn using pseudo84
        pseudo84 = invariant
        insn using pseudo84
      end loop
    and with -g decide not to move the pseudo84 = invariant before the
    loop header; in this case not resetting the debug insns might be fine.
    But, we could have also:
      pseudo84 = whatever
      loop_header
        debug_insn using pseudo84
        pseudo84 = invariant
        insn using pseudo84
      end loop
    and in that case not resetting the debug insns would result in wrong-debug.
    And, we don't really have generally a good substitution on what pseudo84
    contains, it could inherit various values from different paths.
    So, the following patch ignores DEBUG_INSNs in the decisions, and if there
    are any that previously prevented the optimization, resets them before
    return true.

    2021-12-28  Jakub Jelinek  <jakub@redhat.com>

            PR rtl-optimization/103837
            * loop-invariant.c (can_move_invariant_reg): Ignore DEBUG_INSNs in
            the decisions whether to return false or continue and right before
            returning true reset those debug insns that previously caused
            returning false.

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

    (cherry picked from commit 3c5fd3616f73fbcd241cc3a5e09275c2b0c49bd4)

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

* [Bug rtl-optimization/103837] [9/10 Regression] '-fcompare-debug' failure (length) w/ -Og -fmove-loop-invariants -fnon-call-exceptions -fno-tree-dce
  2021-12-26 16:45 [Bug debug/103837] New: [12 Regression] '-fcompare-debug' failure (length) w/ -Og -fmove-loop-invariants -fnon-call-exceptions -fno-tree-dce asolokha at gmx dot com
                   ` (11 preceding siblings ...)
  2022-05-10  8:22 ` cvs-commit at gcc dot gnu.org
@ 2022-05-11  6:23 ` cvs-commit at gcc dot gnu.org
  2022-05-11  6:36 ` jakub at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-11  6:23 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

commit r9-10114-gd7dbfed37a3622f72a6c2607343fa62ed579fb40
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Dec 28 17:40:17 2021 +0100

    loop-invariant: Fix -fcompare-debug failure [PR103837]

    In the following testcase we have a -fcompare-debug failure, because
    can_move_invariant_reg doesn't ignore DEBUG_INSNs in its decisions.
    In the testcase we have due to uninitialized variable:
      loop_header
        debug_insn using pseudo84
        pseudo84 = invariant
        insn using pseudo84
      end loop
    and with -g decide not to move the pseudo84 = invariant before the
    loop header; in this case not resetting the debug insns might be fine.
    But, we could have also:
      pseudo84 = whatever
      loop_header
        debug_insn using pseudo84
        pseudo84 = invariant
        insn using pseudo84
      end loop
    and in that case not resetting the debug insns would result in wrong-debug.
    And, we don't really have generally a good substitution on what pseudo84
    contains, it could inherit various values from different paths.
    So, the following patch ignores DEBUG_INSNs in the decisions, and if there
    are any that previously prevented the optimization, resets them before
    return true.

    2021-12-28  Jakub Jelinek  <jakub@redhat.com>

            PR rtl-optimization/103837
            * loop-invariant.c (can_move_invariant_reg): Ignore DEBUG_INSNs in
            the decisions whether to return false or continue and right before
            returning true reset those debug insns that previously caused
            returning false.

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

    (cherry picked from commit 3c5fd3616f73fbcd241cc3a5e09275c2b0c49bd4)

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

* [Bug rtl-optimization/103837] [9/10 Regression] '-fcompare-debug' failure (length) w/ -Og -fmove-loop-invariants -fnon-call-exceptions -fno-tree-dce
  2021-12-26 16:45 [Bug debug/103837] New: [12 Regression] '-fcompare-debug' failure (length) w/ -Og -fmove-loop-invariants -fnon-call-exceptions -fno-tree-dce asolokha at gmx dot com
                   ` (12 preceding siblings ...)
  2022-05-11  6:23 ` cvs-commit at gcc dot gnu.org
@ 2022-05-11  6:36 ` jakub at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-05-11  6:36 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #12 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2022-05-11  6:36 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-26 16:45 [Bug debug/103837] New: [12 Regression] '-fcompare-debug' failure (length) w/ -Og -fmove-loop-invariants -fnon-call-exceptions -fno-tree-dce asolokha at gmx dot com
2021-12-26 21:10 ` [Bug debug/103837] " pinskia at gcc dot gnu.org
2021-12-27 11:28 ` [Bug tree-optimization/103837] [9/10/11/12 " jakub at gcc dot gnu.org
2021-12-27 11:35 ` pinskia at gcc dot gnu.org
2021-12-27 11:40 ` jakub at gcc dot gnu.org
2021-12-27 12:19 ` jakub at gcc dot gnu.org
2021-12-27 12:50 ` [Bug rtl-optimization/103837] " jakub at gcc dot gnu.org
2021-12-28 16:40 ` cvs-commit at gcc dot gnu.org
2021-12-28 16:43 ` [Bug rtl-optimization/103837] [9/10/11 " jakub at gcc dot gnu.org
2022-01-04 13:37 ` rguenth at gcc dot gnu.org
2022-01-24  9:20 ` cvs-commit at gcc dot gnu.org
2022-01-24  9:30 ` [Bug rtl-optimization/103837] [9/10 " jakub at gcc dot gnu.org
2022-05-10  8:22 ` cvs-commit at gcc dot gnu.org
2022-05-11  6:23 ` cvs-commit at gcc dot gnu.org
2022-05-11  6:36 ` jakub 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).