[Bug target/88861] [9 Regression] ICE in calc_dfs_tree, at dominance.c:458

2019-08-30 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88861

--- Comment #10 from Jakub Jelinek  ---
Author: jakub
Date: Fri Aug 30 11:49:11 2019
New Revision: 275106

URL: https://gcc.gnu.org/viewcvs?rev=275106&root=gcc&view=rev
Log:
Backported from mainline
2019-01-16  David Malcolm  

PR target/88861
* combine.c (delete_noop_moves): Convert to "bool" return,
returning true if any edges are eliminated.
(combine_instructions): Also return true if delete_noop_moves
returns true.

* g++.dg/opt/pr89188.C: Include ../torture/pr88861.C.

2019-01-16  David Malcolm  

PR target/88861
* g++.dg/torture/pr88861.C: New test.

Added:
branches/gcc-7-branch/gcc/testsuite/g++.dg/torture/pr88861.C
Modified:
branches/gcc-7-branch/gcc/ChangeLog
branches/gcc-7-branch/gcc/combine.c
branches/gcc-7-branch/gcc/testsuite/ChangeLog
branches/gcc-7-branch/gcc/testsuite/g++.dg/opt/pr89188.C

[Bug target/88861] [9 Regression] ICE in calc_dfs_tree, at dominance.c:458

2019-02-09 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88861

--- Comment #9 from Jakub Jelinek  ---
Author: jakub
Date: Sat Feb  9 08:51:41 2019
New Revision: 268717

URL: https://gcc.gnu.org/viewcvs?rev=268717&root=gcc&view=rev
Log:
PR middle-end/89243
* g++.dg/opt/pr89188.C: Include ../torture/pr88861.C.

Backported from mainline
2019-01-16  David Malcolm  

PR target/88861
* combine.c (delete_noop_moves): Convert to "bool" return,
returning true if any edges are eliminated.
(combine_instructions): Also return true if delete_noop_moves
returns true.

* g++.dg/torture/pr88861.C: New test.

Added:
branches/gcc-8-branch/gcc/testsuite/g++.dg/torture/pr88861.C
Modified:
branches/gcc-8-branch/gcc/ChangeLog
branches/gcc-8-branch/gcc/combine.c
branches/gcc-8-branch/gcc/testsuite/ChangeLog
branches/gcc-8-branch/gcc/testsuite/g++.dg/opt/pr89188.C

[Bug target/88861] [9 Regression] ICE in calc_dfs_tree, at dominance.c:458

2019-01-16 Thread dmalcolm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88861

David Malcolm  changed:

   What|Removed |Added

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

--- Comment #8 from David Malcolm  ---
Should be fixed by r267984.

[Bug target/88861] [9 Regression] ICE in calc_dfs_tree, at dominance.c:458

2019-01-16 Thread dmalcolm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88861

--- Comment #7 from David Malcolm  ---
Author: dmalcolm
Date: Wed Jan 16 20:13:23 2019
New Revision: 267984

URL: https://gcc.gnu.org/viewcvs?rev=267984&root=gcc&view=rev
Log:
Fix ICE due to "combine" creating unreachable EH blocks (PR target/88861)

PR target/88861 reports an ICE in "ce2" due to an unreachable
basic block.

The block becomes unreachable in "combine" when delete_noop_moves
deletes an insn with a REG_EH_REGION, deleting the EH edge, the
only edge leading to the basic block.

Normally, rest_of_handle_combine would call cleanup_cfg, deleting
unreachable blocks, if combine_instructions returns true, and
combine_instructions does return true for some cases of edge-removal,
but it doesn't for this case, leading to the ICE.

This patch updates delete_noop_moves so that it returns true if
it deletes any edges, and passes that through to combine_instructions,
so that it too will return true if any edges were deleted, ensuring that
cleanup_cfg will be called by rest_of_handle_combine for this case,
deleting the now-unreachable block, and fixing the ICE.

gcc/ChangeLog:
PR target/88861
* combine.c (delete_noop_moves): Convert to "bool" return,
returning true if any edges are eliminated.
(combine_instructions): Also return true if delete_noop_moves
returns true.

gcc/testsuite/ChangeLog:
PR target/88861
* g++.dg/torture/pr88861.C: New test.


Added:
trunk/gcc/testsuite/g++.dg/torture/pr88861.C
Modified:
trunk/gcc/ChangeLog
trunk/gcc/combine.c
trunk/gcc/testsuite/ChangeLog

[Bug target/88861] [9 Regression] ICE in calc_dfs_tree, at dominance.c:458

2019-01-16 Thread dmalcolm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88861

--- Comment #6 from David Malcolm  ---
(In reply to Segher Boessenkool from comment #5)
> Cool, thanks!  Is the plan to simply not allow something that can throw to be
> recognised as noop move?

Candidate patch: https://gcc.gnu.org/ml/gcc-patches/2019-01/msg00914.html

(caveat: I'm relatively new to this code)

[Bug target/88861] [9 Regression] ICE in calc_dfs_tree, at dominance.c:458

2019-01-16 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88861

--- Comment #5 from Segher Boessenkool  ---
Cool, thanks!  Is the plan to simply not allow something that can throw to be
recognised as noop move?

[Bug target/88861] [9 Regression] ICE in calc_dfs_tree, at dominance.c:458

2019-01-15 Thread dmalcolm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88861

David Malcolm  changed:

   What|Removed |Added

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

--- Comment #4 from David Malcolm  ---
Am testing a fix.

[Bug target/88861] [9 Regression] ICE in calc_dfs_tree, at dominance.c:458

2019-01-15 Thread dmalcolm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88861

--- Comment #3 from David Malcolm  ---
Assertion fails in dom_info::calc_dfs_tree:

457   /* This aborts e.g. when there is _no_ path from ENTRY to EXIT at
all.  */
458   gcc_assert (m_nodes == (unsigned int) m_n_basic_blocks - 1);

(gdb) p m_nodes
$8 = 9
(gdb) p m_n_basic_blocks 
$9 = 11

Block 9 in .263r.ud_dce has one in-edge from block 6 (insn 29), and no out-edge
Block 9 in .264r.combine has no in-edges or out-edges

Within .263r.ud_dce:

(note 25 69 26 6 [bb 6] NOTE_INSN_BASIC_BLOCK)
(insn 26 25 28 6 (set (reg/f:DI 142)
(mem/u/c:DI (unspec:DI [
(symbol_ref/u:DI ("*.LC1") [flags 0x2])
(reg:DI 2 2)
] UNSPEC_TOCREL) [3  S8 A8])) "/tmp/test.c":7:21 608
{*movdi_internal64}
 (expr_list:REG_EQUAL (symbol_ref:DI ("*.LANCHOR1") [flags 0x182])
(nil)))
(insn 28 26 29 6 (set (reg:SI 135 [ i ])
(mem/c:SI (plus:DI (reg/f:DI 142)
(const_int 4 [0x4])) [1 i+0 S4 A32])) "/tmp/test.c":7:21 494
{*movsi_internal1}
 (expr_list:REG_EQUAL (mem/c:SI (const:DI (plus:DI (symbol_ref:DI
("*.LANCHOR1") [flags 0x182])
(const_int 4 [0x4]))) [1 i+0 S4 A32])
(nil)))
(insn 29 28 30 6 (set (mem:SI (plus:DI (reg/f:DI 142)
(const_int 4 [0x4])) [1 s+4 S4 A32])
(reg:SI 135 [ i ])) "/tmp/test.c":7:21 494 {*movsi_internal1}
 (expr_list:REG_DEAD (reg:SI 135 [ i ])
(expr_list:REG_EH_REGION (const_int 1 [0x1])
(nil

...but within .264r.combine:

[...snip...]
allowing combination of insns 28 and 29
original costs 4 + 4 = 8
replacement cost 0
deferring deletion of insn with uid = 28.
modifying insn i329: [r142:DI+0x4]=[r142:DI+0x4]
  REG_EH_REGION 0x1
deferring rescan insn with uid = 29.
Can't combine i2 into i3
Can't combine i2 into i3
Can't combine i2 into i3
Can't combine i2 into i3
Can't combine i2 into i3
Can't combine i2 into i3
Can't combine i2 into i3
Can't combine i2 into i3
deleting noop move 29
deferring deletion of insn with uid = 29.
starting the processing of deferred insns
rescanning insn with uid = 23.
ending the processing of deferred insns

[...snip...]

(note 25 69 26 6 [bb 6] NOTE_INSN_BASIC_BLOCK)
(insn 26 25 28 6 (set (reg/f:DI 142)
(mem/u/c:DI (unspec:DI [
(symbol_ref/u:DI ("*.LC1") [flags 0x2])
(reg:DI 2 2)
] UNSPEC_TOCREL) [3  S8 A8])) "/tmp/test.c":7:21 608
{*movdi_internal64}
 (expr_list:REG_EQUAL (symbol_ref:DI ("*.LANCHOR1") [flags 0x182])
(nil)))
(note 28 26 30 6 NOTE_INSN_DELETED)

which, if I'm reading it right, seems to have deleted the usage of EH region 1,
and has left block 9 orphaned.

[Bug target/88861] [9 Regression] ICE in calc_dfs_tree, at dominance.c:458

2019-01-15 Thread dmalcolm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88861

David Malcolm  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-01-15
 CC||dmalcolm at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #2 from David Malcolm  ---
Confirmed (with target==ppc64le-redhat-linux)

[Bug target/88861] [9 Regression] ICE in calc_dfs_tree, at dominance.c:458

2019-01-15 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88861

--- Comment #1 from Richard Biener  ---
That means we have unreachable blocks.

[Bug target/88861] [9 Regression] ICE in calc_dfs_tree, at dominance.c:458

2019-01-15 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88861

Martin Liška  changed:

   What|Removed |Added

  Known to work||8.2.0
   Target Milestone|--- |9.0
  Known to fail||9.0