This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [lno] 50% runtime performance regression since yesterday
FYI the following patch does not improve runtime performance. I will
bootstrap it then I will include it on LNO. I'm beginning to think
that the intervals are the only thing that could justify the
optimization regression. Let's see...
*** tree-chrec.c.~1.1.2.29.~ Tue Jun 22 12:39:28 2004
--- tree-chrec.c Wed Jun 23 12:48:14 2004
*************** chrec_fold_multiply (tree type,
*** 391,396 ****
--- 391,419 ----
/* Operations. */
+ /* Helper function. Use the formula "{a, +, b} (x)" -> "a + b*x".
+ for evaluating the value of the evolution function. */
+
+ static tree
+ chrec_evaluate_affine_multivariate (unsigned var, tree chrec, tree n)
+ {
+ tree type = chrec_type (chrec);
+
+ if (TREE_CODE (chrec) == POLYNOMIAL_CHREC)
+ {
+ if (CHREC_VARIABLE (chrec) > var)
+ return chrec_evaluate_affine_multivariate (var, CHREC_LEFT (chrec), n);
+
+ if (CHREC_VARIABLE (chrec) == var)
+ return chrec_fold_plus
+ (type,
+ CHREC_LEFT (chrec),
+ fold (build (MULT_EXPR, n, CHREC_RIGHT (chrec))));
+ }
+
+ return chrec;
+ }
+
/* Evaluates "CHREC (X)" when the varying variable is VAR.
Example: Given the following parameters,
*************** chrec_apply (unsigned var,
*** 407,413 ****
tree chrec,
tree x)
{
- tree type = chrec_type (chrec);
tree res = chrec_dont_know;
if (automatically_generated_chrec_p (chrec)
--- 430,435 ----
*************** chrec_apply (unsigned var,
*** 423,441 ****
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "(chrec_apply \n");
! if (evolution_function_is_affine_p (chrec))
! {
! /* "{a, +, b} (x)" -> "a + b*x". */
! if (TREE_CODE (CHREC_LEFT (chrec)) == INTEGER_CST
! && integer_zerop (CHREC_LEFT (chrec)))
! res = chrec_fold_multiply (type, CHREC_RIGHT (chrec), x);
!
! else
! res = chrec_fold_plus (type, CHREC_LEFT (chrec),
! chrec_fold_multiply (type,
! CHREC_RIGHT (chrec), x));
! }
!
else
res = chrec_dont_know;
--- 445,456 ----
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "(chrec_apply \n");
! if (evolution_function_is_affine_multivariate_p (chrec))
! res = chrec_evaluate_affine_multivariate (var, chrec, x);
!
! else if (TREE_CODE (chrec) != POLYNOMIAL_CHREC)
! res = chrec;
!
else
res = chrec_dont_know;