OSDN Git Service

Fix PR43306: correct evolution_function_right_is_integer_cst.
authorspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 13 Mar 2010 17:34:59 +0000 (17:34 +0000)
committerspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 13 Mar 2010 17:34:59 +0000 (17:34 +0000)
2010-03-09  Sebastian Pop  <sebastian.pop@amd.com>

PR middle-end/43306
* tree-chrec.c (evolution_function_right_is_integer_cst): CHREC_RIGHT
should be an INTEGER_CST.  Also handle CASE_CONVERT.
* gcc.dg/graphite/pr43306.c: New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157434 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog.graphite
gcc/testsuite/gcc.dg/graphite/pr43306.c [new file with mode: 0644]
gcc/tree-chrec.c

index 3a94ee1..837e4bc 100644 (file)
@@ -1,5 +1,12 @@
 2010-03-09  Sebastian Pop  <sebastian.pop@amd.com>
 
+       PR middle-end/43306
+       * tree-chrec.c (evolution_function_right_is_integer_cst): CHREC_RIGHT
+       should be an INTEGER_CST.  Also handle CASE_CONVERT.
+       * gcc.dg/graphite/pr43306.c: New.
+
+2010-03-09  Sebastian Pop  <sebastian.pop@amd.com>
+
        * graphite.c (graphite_initialize): To bound the number of bbs per
        function, use PARAM_GRAPHITE_MAX_BBS_PER_FUNCTION.
        * params.def (PARAM_GRAPHITE_MAX_BBS_PER_FUNCTION): Declared.
diff --git a/gcc/testsuite/gcc.dg/graphite/pr43306.c b/gcc/testsuite/gcc.dg/graphite/pr43306.c
new file mode 100644 (file)
index 0000000..43195e4
--- /dev/null
@@ -0,0 +1,9 @@
+/* { dg-options "-O1 -fstrict-overflow -fgraphite-identity" } */
+
+void foo(int x[])
+{
+  int i, j;
+  for (i = 0; i < 2; i++)
+    for (j = 0; j < 2; j++)
+      x[i] = x[i*j];
+}
index c945f93..929bbc0 100644 (file)
@@ -1529,14 +1529,12 @@ evolution_function_right_is_integer_cst (const_tree chrec)
       return true;
 
     case POLYNOMIAL_CHREC:
-      if (!evolution_function_right_is_integer_cst (CHREC_RIGHT (chrec)))
-       return false;
-
-      if (TREE_CODE (CHREC_LEFT (chrec)) == POLYNOMIAL_CHREC
-       && !evolution_function_right_is_integer_cst (CHREC_LEFT (chrec)))
-       return false;
+      return TREE_CODE (CHREC_RIGHT (chrec)) == INTEGER_CST
+       && (TREE_CODE (CHREC_LEFT (chrec)) != POLYNOMIAL_CHREC
+           || evolution_function_right_is_integer_cst (CHREC_LEFT (chrec)));
 
-      return true;
+    CASE_CONVERT:
+      return evolution_function_right_is_integer_cst (TREE_OPERAND (chrec, 0));
 
     default:
       return false;