[Bug tree-optimization/84057] [8 Regression] ICE: Segmentation fault (in can_remove_branch_p)

2018-01-29 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84057

Richard Biener  changed:

   What|Removed |Added

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

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

[Bug tree-optimization/84057] [8 Regression] ICE: Segmentation fault (in can_remove_branch_p)

2018-01-29 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84057

--- Comment #4 from Richard Biener  ---
Author: rguenth
Date: Mon Jan 29 09:16:09 2018
New Revision: 257139

URL: https://gcc.gnu.org/viewcvs?rev=257139=gcc=rev
Log:
2018-01-29  Richard Biener  

PR tree-optimization/84057
* tree-ssa-loop-ivcanon.c (unloop_loops): Deal with already
removed paths when removing edges.

* gcc.dg/graphite/pr84057.c: New testcase.

Added:
trunk/gcc/testsuite/gcc.dg/graphite/pr84057.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-loop-ivcanon.c

[Bug tree-optimization/84057] [8 Regression] ICE: Segmentation fault (in can_remove_branch_p)

2018-01-26 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84057

--- Comment #3 from Richard Biener  ---
Sth like the following works for example.

Index: gcc/tree-ssa-loop-ivcanon.c
===
--- gcc/tree-ssa-loop-ivcanon.c (revision 257077)
+++ gcc/tree-ssa-loop-ivcanon.c (working copy)
@@ -660,14 +660,21 @@ unloop_loops (bitmap loop_closed_ssa_inv
   loops_to_unloop.release ();
   loops_to_unloop_nunroll.release ();

-  /* Remove edges in peeled copies.  */
+  /* Remove edges in peeled copies.  Given remove_path removes dominated
+ regions we need to cope with removal of already removed paths.  */
   unsigned i;
   edge e;
+  auto_vec src_bbs;
+  src_bbs.reserve_exact (20);
   FOR_EACH_VEC_ELT (edges_to_remove, i, e)
-{
-  bool ok = remove_path (e, irred_invalidated,
loop_closed_ssa_invalidated);
-  gcc_assert (ok);
-}
+src_bbs.quick_push (e->src->index);
+  FOR_EACH_VEC_ELT (edges_to_remove, i, e)
+if (BASIC_BLOCK_FOR_FN (cfun, src_bbs[i]))
+  {
+   bool ok = remove_path (e, irred_invalidated,
+  loop_closed_ssa_invalidated);
+   gcc_assert (ok);
+  }
   edges_to_remove.release ();
 }

[Bug tree-optimization/84057] [8 Regression] ICE: Segmentation fault (in can_remove_branch_p)

2018-01-26 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84057

Richard Biener  changed:

   What|Removed |Added

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

--- Comment #2 from Richard Biener  ---
A latent issue somewhere I would guess.

Program received signal SIGSEGV, Segmentation fault.
0x009eba5e in can_remove_branch_p (e=0x76a04a80)
at /space/rguenther/src/svn/early-lto-debug/gcc/cfghooks.c:389
389   if (EDGE_COUNT (e->src->succs) != 2)
(gdb) p e
$1 = (const_edge) 0x76a04a80
(gdb) p e->src
$2 = 

ok, so we end up queueing a lot of edges in edges_to_remove and then end up
removing a path disconnecting a CFG region that another edge to be removed
is queued in.

Before the rev. this all just happened in a different order which was fine.
I've patched this logic in the unroller quite some times already for similar
issues...

[Bug tree-optimization/84057] [8 Regression] ICE: Segmentation fault (in can_remove_branch_p)

2018-01-26 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84057

Jakub Jelinek  changed:

   What|Removed |Added

   Priority|P3  |P4
 CC||jakub at gcc dot gnu.org

[Bug tree-optimization/84057] [8 Regression] ICE: Segmentation fault (in can_remove_branch_p)

2018-01-25 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84057

Martin Liška  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-01-26
 CC||marxin at gcc dot gnu.org,
   ||rguenth at gcc dot gnu.org
   Target Milestone|--- |8.0
 Ever confirmed|0   |1

--- Comment #1 from Martin Liška  ---
Started with Richi's r253149.