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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2017-06-14
                 CC|                            |amker at gcc dot gnu.org,
                   |                            |hubicka at gcc dot gnu.org
   Target Milestone|---                         |8.0
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
#6  0x0000000000de6e8e in is_comparison_with_loop_invariant_p (
    stmt=0x7ffff69d7460, loop=0x7ffff69d8210, loop_invariant=0x7fffffffd800, 
    compare_code=0x7fffffffd814, loop_step=0x7fffffffd808, 
    loop_iv_base=0x7fffffffd7f8)
    at /space/rguenther/src/svn/early-lto-debug/gcc/predict.c:1397
1397      if (!simple_iv (loop, loop_containing_stmt (stmt), op0, &iv0, true))
(gdb) p stmt
$1 = (gcond *) 0x7ffff69d7460
(gdb) p debug_gimple_stmt (stmt)
if (0 != 0)
$2 = void
(gdb) p gimple_bb (stmt)
$3 = <basic_block 0x0>

hum.  Ok, so it looks like loop->bounds got invalid and we have stale
nb_iter->stmt pointers.

Caused by moving of IVCANON pass as well.  Testcase works with
-fdisable-tree-ivcanon.

But sth is fishy, I suppose ivcanon fails to invalidate recorded niters.
Honza?  Like the following which fixes the ICE:

Index: gcc/tree-ssa-loop-ivcanon.c
===================================================================
--- gcc/tree-ssa-loop-ivcanon.c (revision 249185)
+++ gcc/tree-ssa-loop-ivcanon.c (working copy)
@@ -1216,11 +1216,13 @@ canonicalize_induction_variables (void)
   estimate_numbers_of_iterations ();

   FOR_EACH_LOOP (loop, LI_FROM_INNERMOST)
-    {
-      changed |= canonicalize_loop_induction_variables (loop,
-                                                       true, UL_SINGLE_ITER,
-                                                       true);
-    }
+    if (canonicalize_loop_induction_variables (loop,
+                                              true, UL_SINGLE_ITER,
+                                              true))
+      {
+       changed = true;
+       free_numbers_of_iterations_estimates_loop (loop);
+      }
   gcc_assert (!need_ssa_update_p (cfun));

   unloop_loops (loop_closed_ssa_invalidated, &irred_invalidated);

but I can't see where ivcanon builds a new exit condition stmt, it just
updates the existing one...

Reply via email to