Fix PR42326: Handle more carefully convert expressions in chrec_fold_plus and chrec_fold_mult.

2010-03-05  Sebastian Pop  <sebastian.pop@amd.com>

	PR middle-end/42326
	* tree-chrec.c (chrec_fold_plus_1): Do not handle convert expressions
	that contain scevs.
	(chrec_fold_multiply): Same.

	* gfortran.dg/graphite/pr42326.f90: New.
	* gfortran.dg/graphite/pr42326-1.f90: New.

From-SVN: r157244
This commit is contained in:
Sebastian Pop 2010-03-05 20:37:44 +00:00 committed by Sebastian Pop
parent 576e4d8266
commit ccc5b64063
5 changed files with 90 additions and 0 deletions

View File

@ -1,3 +1,10 @@
2010-03-05 Sebastian Pop <sebastian.pop@amd.com>
PR middle-end/42326
* tree-chrec.c (chrec_fold_plus_1): Do not handle convert expressions
that contain scevs.
(chrec_fold_multiply): Same.
2010-03-04 Andrew Pinski <andrew_pinski@caviumnetworks.com>
PR c/43248

View File

@ -1,3 +1,9 @@
2010-03-05 Sebastian Pop <sebastian.pop@amd.com>
PR middle-end/42326
* gfortran.dg/graphite/pr42326.f90: New.
* gfortran.dg/graphite/pr42326-1.f90: New.
2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* lib/gnat.exp (gnat_init): Remove GNAT_UNDER_TEST_ORIG.

View File

@ -0,0 +1,18 @@
! { dg-do compile { target i?86-*-* x86_64-*-* } }
! { dg-require-effective-target ilp32 }
! { dg-options "-O2 -floop-parallelize-all -fprefetch-loop-arrays -msse2" }
subroutine phasad(t,i,ium)
implicit none
real t(5,4)
integer i,l,ll,ium
do l=1,2
ll=2*l
do i=1,ium
t(i,ll-1)=t(i,ll-1)+t(i,ll)
enddo
enddo
return
end subroutine phasad

View File

@ -0,0 +1,35 @@
! { dg-do compile { target i?86-*-* x86_64-*-* } }
! { dg-require-effective-target ilp32 }
! { dg-options "-O2 -floop-strip-mine -fprefetch-loop-arrays -msse2" }
subroutine blts ( ldmx, ldmy, v, tmp1, i, j, k)
implicit none
integer ldmx, ldmy, i, j, k, ip, m, l
real*8 tmp, tmp1, v( 5, ldmx, ldmy, *), tmat(5,5)
do ip = 1, 4
do m = ip+1, 5
tmp = tmp1 * tmat( m, ip )
do l = ip+1, 5
tmat( m, l ) = tmat( m, l ) - tmat( ip, l )
end do
v( m, i, j, k ) = tmp
end do
end do
return
end subroutine blts
subroutine phasad(t,i,ium)
implicit none
real t(5,4)
integer i,l,ll,ium
do l=1,2
ll=2*l
do i=1,ium
t(i,ll-1)=t(i,ll-1)+t(i,ll)
enddo
enddo
return
end subroutine phasad

View File

@ -283,6 +283,10 @@ chrec_fold_plus_1 (enum tree_code code, tree type,
case POLYNOMIAL_CHREC:
return chrec_fold_plus_poly_poly (code, type, op0, op1);
CASE_CONVERT:
if (tree_contains_chrecs (op1, NULL))
return chrec_dont_know;
default:
if (code == PLUS_EXPR || code == POINTER_PLUS_EXPR)
return build_polynomial_chrec
@ -296,6 +300,10 @@ chrec_fold_plus_1 (enum tree_code code, tree type,
CHREC_RIGHT (op0));
}
CASE_CONVERT:
if (tree_contains_chrecs (op0, NULL))
return chrec_dont_know;
default:
switch (TREE_CODE (op1))
{
@ -314,6 +322,10 @@ chrec_fold_plus_1 (enum tree_code code, tree type,
? build_real (type, dconstm1)
: build_int_cst_type (type, -1)));
CASE_CONVERT:
if (tree_contains_chrecs (op1, NULL))
return chrec_dont_know;
default:
{
int size = 0;
@ -393,6 +405,10 @@ chrec_fold_multiply (tree type,
case POLYNOMIAL_CHREC:
return chrec_fold_multiply_poly_poly (type, op0, op1);
CASE_CONVERT:
if (tree_contains_chrecs (op1, NULL))
return chrec_dont_know;
default:
if (integer_onep (op1))
return op0;
@ -405,6 +421,10 @@ chrec_fold_multiply (tree type,
chrec_fold_multiply (type, CHREC_RIGHT (op0), op1));
}
CASE_CONVERT:
if (tree_contains_chrecs (op0, NULL))
return chrec_dont_know;
default:
if (integer_onep (op0))
return op1;
@ -420,6 +440,10 @@ chrec_fold_multiply (tree type,
chrec_fold_multiply (type, CHREC_LEFT (op1), op0),
chrec_fold_multiply (type, CHREC_RIGHT (op1), op0));
CASE_CONVERT:
if (tree_contains_chrecs (op1, NULL))
return chrec_dont_know;
default:
if (integer_onep (op1))
return op0;