diff mbox series

[committed] Fix ICE with -ftree-parallelize-loops=2 --param parloops-schedule=dynamic (PR tree-optimization/83957)

Message ID 20180122230305.GM2063@tucnak
State New
Headers show
Series [committed] Fix ICE with -ftree-parallelize-loops=2 --param parloops-schedule=dynamic (PR tree-optimization/83957) | expand

Commit Message

Jakub Jelinek Jan. 22, 2018, 11:03 p.m. UTC
Hi!

The ompexpssa pass will do TODO_update_ssa_only_virtuals, so don't need
to handle in detail vops.  In this case the inner_phi is NULL for the vop
and we crash on it.

Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk.

2018-01-22  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/83957
	* omp-expand.c (expand_omp_for_generic): Ignore virtual PHIs.  Remove
	semicolon after for body surrounded by braces.

	* gcc.dg/autopar/pr83957.c: New test.


	Jakub
diff mbox series

Patch

--- gcc/omp-expand.c.jj	2018-01-15 22:46:52.058226631 +0100
+++ gcc/omp-expand.c	2018-01-22 13:20:50.614656137 +0100
@@ -3156,6 +3156,9 @@  expand_omp_for_generic (struct omp_regio
 	      gphi *nphi;
 	      gphi *exit_phi = psi.phi ();
 
+	      if (virtual_operand_p (gimple_phi_result (exit_phi)))
+		continue;
+
 	      edge l2_to_l3 = find_edge (l2_bb, l3_bb);
 	      tree exit_res = PHI_ARG_DEF_FROM_EDGE (exit_phi, l2_to_l3);
 
@@ -3178,7 +3181,7 @@  expand_omp_for_generic (struct omp_regio
 	      add_phi_arg (nphi, exit_res, l2_to_l0, UNKNOWN_LOCATION);
 
 	      add_phi_arg (inner_phi, new_res, l0_to_l1, UNKNOWN_LOCATION);
-	    };
+	    }
 	}
 
       set_immediate_dominator (CDI_DOMINATORS, l2_bb,
--- gcc/testsuite/gcc.dg/autopar/pr83957.c.jj	2018-01-22 13:32:32.841783616 +0100
+++ gcc/testsuite/gcc.dg/autopar/pr83957.c	2018-01-22 13:22:49.525114497 +0100
@@ -0,0 +1,11 @@ 
+/* PR tree-optimization/83957 */
+/* { dg-do compile } */
+/* { dg-options "-O1 -ftree-parallelize-loops=2 -fno-tree-dce --param parloops-schedule=dynamic" } */
+
+void
+foo (int *x, int y)
+{
+  if (y < 0)
+    for (; y < 1; ++y)
+      x = &y;
+}