[PATCH] Fix another parloops reduction ICE (PR tree-optimization/90385)

Jakub Jelinek jakub@redhat.com
Fri May 10 07:30:00 GMT 2019


Hi!

Based on the single testcase we had I thought the rest of parloops will
handle the exit PHIs with non-SSA_NAME arguments just fine, but this patch
shows that is not the case and doesn't seem trivial to fix (just punting
on the other ICE spot doesn't work).  As both the testcases are about
massive -fno-* disabling of optimizations, I don't see a sufficient use case
to actually support that, so this patch modifies the last change to punt
instead of trying to support it.  If we find an important use case, anyone
with sufficient motivaction can change this again and add full support for
that.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk and
after a while for 9.2?

2019-05-10  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/90385
	* tree-parloops.c (try_create_reduction_list): Punt on non-SSA_NAME
	arguments of the exit phis.

	* gfortran.dg/pr90385.f90: New test.

--- gcc/tree-parloops.c.jj	2019-05-03 15:22:07.000000000 +0200
+++ gcc/tree-parloops.c	2019-05-09 11:33:19.238730902 +0200
@@ -2794,8 +2794,16 @@ try_create_reduction_list (loop_p loop,
       gimple *reduc_phi;
       tree val = PHI_ARG_DEF_FROM_EDGE (phi, exit);
 
-      if (TREE_CODE (val) == SSA_NAME && !virtual_operand_p (val))
+      if (!virtual_operand_p (val))
 	{
+	  if (TREE_CODE (val) != SSA_NAME)
+	    {
+	      if (dump_file && (dump_flags & TDF_DETAILS))
+		fprintf (dump_file,
+			 "  FAILED: exit PHI argument invariant.\n");
+	      return false;
+	    }
+
 	  if (dump_file && (dump_flags & TDF_DETAILS))
 	    {
 	      fprintf (dump_file, "phi is ");
--- gcc/testsuite/gfortran.dg/pr90385.f90.jj	2019-05-09 11:42:21.463573092 +0200
+++ gcc/testsuite/gfortran.dg/pr90385.f90	2019-05-09 11:42:14.622688340 +0200
@@ -0,0 +1,6 @@
+! PR tree-optimization/90385
+! { dg-do compile }
+! { dg-require-effective-target pthread }
+! { dg-options "-O1 -ftree-parallelize-loops=2 -fno-tree-ccp -fno-tree-ch -fno-tree-copy-prop -fno-tree-forwprop -fno-tree-sink --param parloops-min-per-thread=5" }
+
+include 'array_constructor_47.f90'

	Jakub



More information about the Gcc-patches mailing list