[Bug debug/105158] ftree-ccp (CFG cleanup) drops DWARF const value attribute at -Og/-O1/-O2/-O3

2022-11-14 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105158

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|--- |13.0

[Bug debug/105158] ftree-ccp (CFG cleanup) drops DWARF const value attribute at -Og/-O1/-O2/-O3

2022-05-04 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105158

Richard Biener  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #6 from Richard Biener  ---
Fixed.

[Bug debug/105158] ftree-ccp (CFG cleanup) drops DWARF const value attribute at -Og/-O1/-O2/-O3

2022-05-04 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105158

--- Comment #5 from CVS Commits  ---
The master branch has been updated by Richard Biener :

https://gcc.gnu.org/g:1ba68f78c9d2510eb095f7d8a90c87cd5fd4183d

commit r13-99-g1ba68f78c9d2510eb095f7d8a90c87cd5fd4183d
Author: Richard Biener 
Date:   Tue Apr 5 15:23:54 2022 +0200

debug/105158 - improve debug stmt retaining for forwarder removal

Currently when we cannot move debug stmt from a forwarder to the
destination block we drop/reset them.  But in some cases as for
the testcase we can move them to the predecessor when that has
a single successor and we can insert after the last stmt of the
block.  That allows us to preserve debug info here.

2022-04-05  Richard Biener  

PR debug/105158
* tree-cfgcleanup.cc (move_debug_stmts_from_forwarder):
Move debug stmts to the predecessor if moving to the
destination is not possible.
(remove_forwarder_block): Adjust.
(remove_forwarder_block_with_phi): Likewise.

[Bug debug/105158] ftree-ccp (CFG cleanup) drops DWARF const value attribute at -Og/-O1/-O2/-O3

2022-04-07 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105158

--- Comment #4 from Richard Biener  ---
*** Bug 105194 has been marked as a duplicate of this bug. ***

[Bug debug/105158] ftree-ccp (CFG cleanup) drops DWARF const value attribute at -Og/-O1/-O2/-O3

2022-04-05 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105158

--- Comment #3 from Richard Biener  ---
Created attachment 52748
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52748=edit
patch

[Bug debug/105158] ftree-ccp (CFG cleanup) drops DWARF const value attribute at -Og/-O1/-O2/-O3

2022-04-05 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105158

Richard Biener  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |rguenth at gcc dot 
gnu.org
 Status|NEW |ASSIGNED

--- Comment #2 from Richard Biener  ---
I have a patch.

[Bug debug/105158] ftree-ccp (CFG cleanup) drops DWARF const value attribute at -Og/-O1/-O2/-O3

2022-04-05 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105158

Richard Biener  changed:

   What|Removed |Added

 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW
Summary|ftree-ccp drops DWARF const |ftree-ccp (CFG cleanup)
   |value attribute at  |drops DWARF const value
   |-Og/-O1/-O2/-O3 |attribute at
   ||-Og/-O1/-O2/-O3
   Severity|normal  |enhancement
   Last reconfirmed||2022-04-05

--- Comment #1 from Richard Biener  ---
The issue is that the definition we put the debug stmt into is in

 :
[t.c:4:5] # DEBUG BEGIN_STMT
[t.c:4:16] # DEBUG l_174 => 0
[t.c:4:27] # DEBUG l_188 => 0
[t.c:4:38] # DEBUG l_191 => 0
[t.c:4:49] # DEBUG l_240 => 1
[t.c:5:5] # DEBUG BEGIN_STMT
[t.c:6:5] # DEBUG BEGIN_STMT
[t.c:6:20] # DEBUG l_169 => 0
[t.c:6:25] if (0 != 0)
  goto ; [INV]
else
  goto ; [INV]

 :

 :
[t.c:6:11] # DEBUG l_171 => 0
[t.c:7:5] # DEBUG BEGIN_STMT
[t.c:7:5] goto ; [INV]

 :
# l_169_3 = PHI <[t.c:6:20] 0(6), [t.c:7:30] l_169_19(7)>
# DEBUG l_169 => l_169_3
[t.c:7:18] # DEBUG BEGIN_STMT
[t.c:7:18] if (l_169_3 <= 9)
  goto ; [INV]
else
  goto ; [INV]

and when CFG cleanup merges all the forwarders it finds no location to
put the debug stmt to - it tries to move the debug stmts to the
successor but that doesn't have a single predecessor so that's not a
valid thing to do.  Moving to the predecessor would be valid if that
has a single successor though but that's not implemented.  In this
case the predecessor is block 2 at the point in question and it has
a single successor plus the last stmt in it doesn't end the BB.