From: Sebastian Pop Date: Sat, 13 Mar 2010 17:34:59 +0000 (+0000) Subject: Fix PR43306: correct evolution_function_right_is_integer_cst. X-Git-Tag: releases/gcc-4.5.0~392 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1f3803148ffa5702cb86f43a6bf2ecaeacb1b1bd;p=thirdparty%2Fgcc.git Fix PR43306: correct evolution_function_right_is_integer_cst. 2010-03-09 Sebastian Pop 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. From-SVN: r157434 --- diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite index 3a94ee184595..837e4bc8e205 100644 --- a/gcc/ChangeLog.graphite +++ b/gcc/ChangeLog.graphite @@ -1,3 +1,10 @@ +2010-03-09 Sebastian Pop + + 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 * graphite.c (graphite_initialize): To bound the number of bbs per diff --git a/gcc/testsuite/gcc.dg/graphite/pr43306.c b/gcc/testsuite/gcc.dg/graphite/pr43306.c new file mode 100644 index 000000000000..43195e489168 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr43306.c @@ -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]; +} diff --git a/gcc/tree-chrec.c b/gcc/tree-chrec.c index c945f93190e9..929bbc08e02f 100644 --- a/gcc/tree-chrec.c +++ b/gcc/tree-chrec.c @@ -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;