On Jul 1, 2005, at 12:06 AM, Gabriel Dos Reis wrote:

There are of course coner and pathological cases, but I don't think we
should worry too much about missing them.  Let's first cover the
structured loops, and address the contorsed ones later if they become
really important.

And I just submitted a patch for one of those corner/pathological cases
and it actually does improve code, how much I don't know because I don't
have access to any benchmark to test on.  If someone wants to test it,
they will most likely find it, it does in fact improve code.

Also knowing in let say fold if the variable is a loop index or not is
actually not trivial.

Another testcase where we will fail out at if we take the view you want
to take is:

int f(int i)
{
  return (i - 1) > i;
}

Which is always false if overflow is undefined and not considered
wrapping and this shows up in fortran code even though the person did not
write it out explicitly:
SUBROUTINE d ( a, b,n)
  IMPLICIT NONE
  INTEGER :: n
  REAL,DIMENSION(n) :: a
  REAL,DIMENSION(n) :: b
  b(n-2:n) = sqrt(a(n-2:n))
END SUBROUTINE d

And this is now done in two different places, fold and simplify-rtx
(even though fold does not catch the fortran one as we need a tree
combiner for that).
And yes I actually reduced that testcase from real fortran code (I
forgot which one right now).

-- Pinski

Reply via email to