From 1f3803148ffa5702cb86f43a6bf2ecaeacb1b1bd Mon Sep 17 00:00:00 2001 From: Sebastian Pop Date: Sat, 13 Mar 2010 17:34:59 +0000 Subject: [PATCH] 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 --- gcc/ChangeLog.graphite | 7 +++++++ gcc/testsuite/gcc.dg/graphite/pr43306.c | 9 +++++++++ gcc/tree-chrec.c | 12 +++++------- 3 files changed, 21 insertions(+), 7 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/graphite/pr43306.c diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite index 3a94ee18459..837e4bc8e20 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 00000000000..43195e48916 --- /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 c945f93190e..929bbc08e02 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; -- 2.43.5