This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR80304


The following fixes a fortran testcase involving safelen where
store motion needs to be disabled for unanalyzable refs (we don't
know how to transform them).  But the safelen case missed to recurse
(because that's only necessary for unanalyzable mems).

Bootstrap / regtest on x86_64-unknown-linux-gnu.

I'll try to come up with a testcase later.

Richard.

2017-04-10  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/80304
	* tree-ssa-loop-im.c (ref_indep_loop_p_1): Also recurse
	for safelen.

Index: gcc/tree-ssa-loop-im.c
===================================================================
--- gcc/tree-ssa-loop-im.c	(revision 246797)
+++ gcc/tree-ssa-loop-im.c	(working copy)
@@ -2145,9 +2145,21 @@ ref_indep_loop_p_1 (int safelen, struct
 	  fprintf (dump_file, "\n");
 	}
 
+      /* We need to recurse to properly handle UNANALYZABLE_MEM_ID.  */
+      struct loop *inner = loop->inner;
+      while (inner)
+	{
+	  if (!ref_indep_loop_p_1 (safelen, inner, ref, stored_p, ref_loop))
+	    {
+	      indep_p = false;
+	      break;
+	    }
+	  inner = inner->next;
+	}
+
       /* Avoid caching here as safelen depends on context and refs
          are shared between different contexts.  */
-      return true;
+      return indep_p;
     }
   else
     {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]