|  | Commit message (Collapse) | Author | Age | Files | Lines | 
|---|
| | 
| 
| 
| 
| 
| | patch was graciously contributed by Vladimir Prus.
llvm-svn: 13185 | 
| | 
| 
| 
| 
| 
| | IndVars pass, not part of SCEV *analysis*.
llvm-svn: 13134 | 
| | 
| 
| 
| | llvm-svn: 13064 | 
| | 
| 
| 
| 
| 
| 
| | structure to being dynamically computed on demand.  This makes updating
loop information MUCH easier.
llvm-svn: 13045 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | operations.  This allows us to compile this testcase:
int main() {
        int h = 1;
         do h = 3 * h + 1; while (h <= 256);
        printf("%d\n", h);
        return 0;
}
into this:
int %main() {
entry:
        call void %__main( )
        %tmp.6 = call int (sbyte*, ...)* %printf( sbyte* getelementptr ([4 x sbyte]*  %.str_1, long 0, long 0), int 364 )        ; <int> [#uses=0]
        ret int 0
}
This testcase was taken directly from 256.bzip2, believe it or not.
This code is not as general as I would like.  Next up is to refactor it
a bit to handle more cases.
llvm-svn: 13019 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | even if the loop is using expressions that we can't compute as a closed-form.
This allows us to calculate that this function always returns 55:
int test() {
  double X;
  int Count = 0;
  for (X = 100; X > 1; X = sqrt(X), ++Count)
    /*empty*/;
  return Count;
}
And allows us to compute trip counts for loops like:
        int h = 1;
         do h = 3 * h + 1; while (h <= 256);
(which occurs in bzip2), and for this function, which occurs after inlining
and other optimizations:
int popcount()
{
   int x = 666;
  int result = 0;
  while (x != 0) {
    result = result + (x & 0x1);
    x = x >> 1;
  }
  return result;
}
We still cannot compute the exit values of result or h in the two loops above,
which means we cannot delete the loop, but we are getting closer.  Being able to
compute a constant trip count for these two loops will allow us to unroll them
completely though.
llvm-svn: 13017 | 
| | 
| 
| 
| 
| 
| | Debian.)
llvm-svn: 12986 | 
| | 
| 
| 
| | llvm-svn: 12958 | 
| | 
| 
| 
| | llvm-svn: 12956 | 
| | 
| 
| 
| 
| 
| | insert it once!
llvm-svn: 12955 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | at the bottom of the loop instead of the top.  This reduces the number of
overlapping live ranges a lot, for example, eliminating a spill in an important
loop in 183.equake with linear scan.
I still need to make the exit comparison of the loop use the post-incremented
version of this variable, but this is an easy first step.
llvm-svn: 12952 | 
| | 
| 
| 
| | llvm-svn: 12754 | 
| | 
| 
| 
| | llvm-svn: 12670 | 
| | 
| 
| 
| | llvm-svn: 12669 | 
| | 
| 
| 
| | llvm-svn: 12668 | 
| | 
| 
| 
| | llvm-svn: 12639 | 
| | 
| 
| 
| | llvm-svn: 12623 | 
|  | llvm-svn: 12619 |