* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130151
138bc75d-0d04-0410-961f-
82ee72b054a4
-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.
+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.
--- /dev/null
+// { 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);
+}
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);
}