diff options
author | Sebastian Pop <sebastian.pop@amd.com> | 2009-12-23 07:50:00 +0000 |
---|---|---|
committer | Sebastian Pop <spop@gcc.gnu.org> | 2009-12-23 07:50:00 +0000 |
commit | 4b216ab08a5f433c4c1ceae18953e14c88f25bd1 (patch) | |
tree | 77aae9e220ccba498af701a1b8b9a38e715f711c /gcc | |
parent | 58326a562079d2a2a732fb869767c0611694ba96 (diff) | |
download | gcc-4b216ab08a5f433c4c1ceae18953e14c88f25bd1.zip gcc-4b216ab08a5f433c4c1ceae18953e14c88f25bd1.tar.gz gcc-4b216ab08a5f433c4c1ceae18953e14c88f25bd1.tar.bz2 |
re PR middle-end/42181 ([graphite] -fgraphite-identity miscompiles air.f90)
Fix PR42181.
2009-12-14 Sebastian Pop <sebastian.pop@amd.com>
PR middle-end/42181
* graphite-scop-detection.c (graphite_can_represent_scev): Handle more
carefully PLUS_EXPR, MINUS_EXPR, and MULT_EXPR.
* testsuite/gfortran.dg/graphite/pr42181.f90: New.
From-SVN: r155417
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog.graphite | 8 | ||||
-rw-r--r-- | gcc/graphite-scop-detection.c | 30 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/graphite/pr42181.f90 | 19 |
3 files changed, 51 insertions, 6 deletions
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite index 9974d19..b17f3d4 100644 --- a/gcc/ChangeLog.graphite +++ b/gcc/ChangeLog.graphite @@ -1,3 +1,11 @@ +2009-12-14 Sebastian Pop <sebastian.pop@amd.com> + + PR middle-end/42181 + * graphite-scop-detection.c (graphite_can_represent_scev): Handle more + carefully PLUS_EXPR, MINUS_EXPR, and MULT_EXPR. + + * testsuite/gfortran.dg/graphite/pr42181.f90: New. + 2009-12-12 Sebastian Pop <sebpop@gmail.com> PR middle-end/42284 diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c index a24420e..e30554f 100644 --- a/gcc/graphite-scop-detection.c +++ b/gcc/graphite-scop-detection.c @@ -213,15 +213,33 @@ graphite_can_represent_scev (tree scev, int outermost_loop) if (chrec_contains_undetermined (scev)) return false; - if (TREE_CODE (scev) == POLYNOMIAL_CHREC + switch (TREE_CODE (scev)) + { + case PLUS_EXPR: + case MINUS_EXPR: + return graphite_can_represent_scev (TREE_OPERAND (scev, 0), outermost_loop) + && graphite_can_represent_scev (TREE_OPERAND (scev, 1), outermost_loop); + + case MULT_EXPR: + return !CONVERT_EXPR_CODE_P (TREE_CODE (TREE_OPERAND (scev, 0))) + && !CONVERT_EXPR_CODE_P (TREE_CODE (TREE_OPERAND (scev, 1))) + && !(chrec_contains_symbols (TREE_OPERAND (scev, 0)) + && chrec_contains_symbols (TREE_OPERAND (scev, 1))) + && graphite_can_represent_scev (TREE_OPERAND (scev, 0), outermost_loop) + && graphite_can_represent_scev (TREE_OPERAND (scev, 1), outermost_loop); + case POLYNOMIAL_CHREC: /* Check for constant strides. With a non constant stride of - 'n' we would have a value of 'iv * n'. */ - && (!evolution_function_right_is_integer_cst (scev) + 'n' we would have a value of 'iv * n'. Also check that the + initial value can represented: for example 'n * m' cannot be + represented. */ + if (!evolution_function_right_is_integer_cst (scev) + || !graphite_can_represent_init (scev)) + return false; - /* Check the initial value: 'n * m' cannot be represented. */ - || !graphite_can_represent_init (scev))) - return false; + default: + break; + } /* Only affine functions can be represented. */ if (!scev_is_linear_expression (scev)) diff --git a/gcc/testsuite/gfortran.dg/graphite/pr42181.f90 b/gcc/testsuite/gfortran.dg/graphite/pr42181.f90 new file mode 100644 index 0000000..dafb63f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/graphite/pr42181.f90 @@ -0,0 +1,19 @@ +! { dg-options "-O1 -fgraphite" } + +MODULE powell + INTEGER, PARAMETER :: dp=8 +CONTAINS + SUBROUTINE newuob (n,npt,x,rhobeg,rhoend,maxfun,xbase,& + xopt,xnew,xpt,fval,gq,hq,pq,bmat,zmat,ndim,d,vlag,w,opt) + REAL(dp), DIMENSION(npt, *), & + INTENT(inout) :: xpt + REAL(dp), DIMENSION(*), INTENT(inout) :: fval, gq, hq, pq +120 IF (dsq <= 1.0e-3_dp*xoptsq) THEN + DO k=1,npt + DO i=1,n + gq(i)=gq(i)+temp*xpt(k,i) + END DO + END DO + END IF + END SUBROUTINE newuob +END MODULE powell |