re PR tree-optimization/59817 (ICE in extract_affine_chrec with -O2 -ftree-loop-linear)

2014-04-14  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/59817
	PR tree-optimization/60453
	* graphite-scop-detection.c (graphite_can_represent_scev): Complete
	recursion to catch all CHRECs in the scalar evolution and restrict
	the predicate for the remains appropriately.

	* gfortran.dg/graphite/pr59817.f: New testcase.
	* gcc.dg/graphite/pr59817-1.c: Likewise.
	* gcc.dg/graphite/pr59817-2.c: Likewise.

From-SVN: r209355
This commit is contained in:
Richard Biener 2014-04-14 08:09:06 +00:00 committed by Richard Biener
parent b82b06487e
commit 033aa406ca
6 changed files with 71 additions and 1 deletions

View File

@ -1,3 +1,11 @@
2014-04-14 Richard Biener <rguenther@suse.de>
PR tree-optimization/59817
PR tree-optimization/60453
* graphite-scop-detection.c (graphite_can_represent_scev): Complete
recursion to catch all CHRECs in the scalar evolution and restrict
the predicate for the remains appropriately.
2014-04-12 Catherine Moore <clm@codesourcery.com>
* config/mips/constraints.md: Add new register constraint "kb".

View File

@ -219,7 +219,14 @@ graphite_can_represent_scev (tree scev)
switch (TREE_CODE (scev))
{
case NEGATE_EXPR:
case BIT_NOT_EXPR:
CASE_CONVERT:
case NON_LVALUE_EXPR:
return graphite_can_represent_scev (TREE_OPERAND (scev, 0));
case PLUS_EXPR:
case POINTER_PLUS_EXPR:
case MINUS_EXPR:
return graphite_can_represent_scev (TREE_OPERAND (scev, 0))
&& graphite_can_represent_scev (TREE_OPERAND (scev, 1));
@ -241,13 +248,15 @@ graphite_can_represent_scev (tree scev)
if (!evolution_function_right_is_integer_cst (scev)
|| !graphite_can_represent_init (scev))
return false;
return graphite_can_represent_scev (CHREC_LEFT (scev));
default:
break;
}
/* Only affine functions can be represented. */
if (!scev_is_linear_expression (scev))
if (tree_contains_chrecs (scev, NULL)
|| !scev_is_linear_expression (scev))
return false;
return true;

View File

@ -1,3 +1,11 @@
2014-04-14 Richard Biener <rguenther@suse.de>
PR tree-optimization/59817
PR tree-optimization/60453
* gfortran.dg/graphite/pr59817.f: New testcase.
* gcc.dg/graphite/pr59817-1.c: Likewise.
* gcc.dg/graphite/pr59817-2.c: Likewise.
2014-04-14 Jason Merrill <jason@redhat.com>
Revert:

View File

@ -0,0 +1,16 @@
/* { dg-do compile } */
/* { dg-options "-O2 -floop-interchange" } */
int kd;
void
n2(void)
{
static int so;
static short int i5;
int wj;
int *il;
int *nk = &so;
for (wj = 0; wj < 2; ++wj)
*nk = ((i5 += *il) || kd );
}

View File

@ -0,0 +1,15 @@
/* { dg-do compile } */
/* { dg-options "-O2 -floop-interchange" } */
void
xl(void)
{
static int j3;
for (j3 = 0; j3 < 1; ++j3) {
static int f2;
static int w7;
short int b5;
int ok;
f2 = (b5 += ok) ? (w7 = 0): (w7 ? 0 : (f2 = ok));
}
}

View File

@ -0,0 +1,14 @@
! { dg-do compile }
! { dg-options "-O2 -floop-interchange" }
SUBROUTINE PREPD(ICAST,ICAS,ICASX,ICAS1,ICAS2,NDET,NM,III,IMP,
* CASMIN)
LOGICAL CASMIN
DIMENSION ICAST(NDET,NM),IMP(NM)
IF(CASMIN) THEN
DO K=1,NDET
DO L=1,NM
IF(L.EQ.K-1) ICAST(K,L) = 1
END DO
END DO
END IF
END SUBROUTINE