diff mbox

Fix PR80304

Message ID alpine.LSU.2.20.1704101100580.30715@zhemvz.fhfr.qr
State New
Headers show

Commit Message

Richard Biener April 10, 2017, 9:02 a.m. UTC
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.
diff mbox

Patch

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
     {