[Bug tree-optimization/83126] [8 Regression] ICE in transform_to_exit_first_loop_alt, at tree-parloops.c:1713

vries at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Feb 12 15:25:00 GMT 2018


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

--- Comment #5 from Tom de Vries <vries at gcc dot gnu.org> ---
This more of a stage4 fix: instead of ICE-ing, abort transformation:
...
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
index e44ad5e..11f773f 100644
--- a/gcc/tree-parloops.c
+++ b/gcc/tree-parloops.c
@@ -2371,6 +2371,23 @@ gen_parallel_loop (struct loop *loop,
   /* Base all the induction variables in LOOP on a single control one.  */
   canonicalize_loop_ivs (loop, &nit, true);

+  unsigned nr_phis = 0;
+  for (gphi_iterator gsi = gsi_start_phis (loop->header); !gsi_end_p (gsi);
+       gsi_next (&gsi))
+    {
+      gphi *phi = gsi.phi ();
+      tree def = PHI_RESULT (phi);
+      affine_iv iv;
+
+      if (virtual_operand_p (def))
+       continue;
+
+      nr_phis++;
+    }
+
+  if (nr_phis != reduction_list->elements () + 1)
+    return;
+
   /* Ensure that the exit condition is the first statement in the loop.
      The common case is that latch of the loop is empty (apart from the
      increment) and immediately follows the loop exit test.  Attempt to move
the
...


More information about the Gcc-bugs mailing list