re PR tree-optimization/34063 (ICE: build2_stat, at tree.c:3115)

PR tree-optimization/34063
	* tree-chrec.c (chrec_evaluate): Put CHREC_LEFT based argument
	as first chrec_fold_plus operand rather than second.

	* g++.dg/tree-ssa/pr34063.C: New test.

From-SVN: r130151
This commit is contained in:
Jakub Jelinek 2007-11-13 19:23:03 +01:00
parent 4dd9d9db1d
commit f6ee9faefc
4 changed files with 42 additions and 6 deletions

View File

@ -1,6 +1,12 @@
2007-11-13 diego novillo <dnovillo@google.com>
2007-11-13 Jakub Jelinek <jakub@redhat.com>
pr 33870
PR tree-optimization/34063
* tree-chrec.c (chrec_evaluate): Put CHREC_LEFT based argument
as first chrec_fold_plus operand rather than second.
2007-11-13 Diego Novillo <dnovillo@google.com>
PR tree-optimization/33870
* tree.h (strcut tree_memory_tag): add field unpartitionable.
remove field in_nested_struct.
(struct tree_struct_field_tag): add field nesting_level.

View File

@ -1,6 +1,11 @@
2007-11-13 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/34063
* g++.dg/tree-ssa/pr34063.C: New test.
2007-11-13 Diego Novillo <dnovillo@google.com>
PR 33870
PR tree-optimization/33870
* gcc.c-torture/execute/pr33870-1.c: New test.
* gcc.dg/tree-ssa/alias-16.c: New test.

View File

@ -0,0 +1,25 @@
// { PR tree-optimization/34063 }
// { dg-do compile }
// { dg-options "-O2" }
struct S
{
double e[9];
double const &
operator() (int r, int c) const
{
return e[r * 3 + c];
}
};
void
foo()
{
S r;
double *p;
for (int j = 0; j < 3; j++)
for (int k = 0; k < 3; k++)
for (int l = k + 1; l < 3; l++)
*p++ = r (k, 0) * r (l, j) + r (k, j) * r (l, 0);
}

View File

@ -522,13 +522,13 @@ chrec_evaluate (unsigned var, tree chrec, tree n, unsigned int k)
if (TREE_CODE (chrec) == POLYNOMIAL_CHREC
&& CHREC_VARIABLE (chrec) == var)
{
arg0 = chrec_evaluate (var, CHREC_RIGHT (chrec), n, k + 1);
if (arg0 == chrec_dont_know)
arg1 = chrec_evaluate (var, CHREC_RIGHT (chrec), n, k + 1);
if (arg1 == chrec_dont_know)
return chrec_dont_know;
binomial_n_k = tree_fold_binomial (type, n, k);
if (!binomial_n_k)
return chrec_dont_know;
arg1 = fold_build2 (MULT_EXPR, type,
arg0 = fold_build2 (MULT_EXPR, type,
CHREC_LEFT (chrec), binomial_n_k);
return chrec_fold_plus (type, arg0, arg1);
}