Hi,

I don't know who coded the overly complicated exclude_component_ref.
In the graphite branch we already cleaned up all this code, but in
trunk we still have it.

Attached is a patch that fixes the problem by looking at whether the
operand contains COMPONENT_REFs before calling the data reference
analysis.

I'm testing the patch on the gcc farm, and will send it to the gcc-patches
once it finishes regstrap.

Sebastian
	* graphite.c (exclude_component_ref): Renamed contains_component_ref_p.
	(is_simple_operand): Call contains_component_ref_p before calling data
	reference analysis that would fail on COMPONENT_REFs.

Index: graphite.c
===================================================================
--- graphite.c	(revision 144893)
+++ graphite.c	(working copy)
@@ -1062,27 +1062,20 @@ loop_affine_expr (basic_block scop_entry
    is component_ref.  */
 
 static bool
-exclude_component_ref (tree op) 
+contains_component_ref_p (tree op) 
 {
   int i;
-  int len;
 
-  if (op)
-    {
-      if (TREE_CODE (op) == COMPONENT_REF)
-	return false;
-      else
-	{
-	  len = TREE_OPERAND_LENGTH (op);	  
-	  for (i = 0; i < len; ++i)
-	    {
-	      if (!exclude_component_ref (TREE_OPERAND (op, i)))
-		return false;
-	    }
-	}
-    }
+  if (!op)
+    return false;
 
-  return true;
+  if (TREE_CODE (op) == COMPONENT_REF)
+    return true;
+
+  for (i = 0; i < TREE_OPERAND_LENGTH (op); i++)
+    return contains_component_ref_p (TREE_OPERAND (op, i));
+
+  return false;
 }
 
 /* Return true if the operand OP is simple.  */
@@ -1094,13 +1087,15 @@ is_simple_operand (loop_p loop, gimple s
   if (DECL_P (op)
       /* or a structure,  */
       || AGGREGATE_TYPE_P (TREE_TYPE (op))
+      /* or a COMPONENT_REF,  */
+      || contains_component_ref_p (op)
       /* or a memory access that cannot be analyzed by the data
 	 reference analysis.  */
       || ((handled_component_p (op) || INDIRECT_REF_P (op))
 	  && !stmt_simple_memref_p (loop, stmt, op)))
     return false;
 
-  return exclude_component_ref (op);
+  return true;
 }
 
 /* Return true only when STMT is simple enough for being handled by

Reply via email to