llvm/lib
Chris Lattner 7980fb9007 Add the ability to compute trip counts that are only controlled by constants
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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13017 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-17 18:36:24 +00:00
..
Analysis Add the ability to compute trip counts that are only controlled by constants 2004-04-17 18:36:24 +00:00
Archive Use the true, decoded name of the archive member in getObjectType. 2004-03-31 19:51:00 +00:00
AsmParser Support getelementptr instructions which use uint's to index into structure 2004-04-05 01:30:04 +00:00
Bytecode Implement support for a new LLVM 1.3 bytecode format, which uses uint's 2004-04-05 01:27:26 +00:00
CodeGen Fix bug introduced in previous commit. 2004-04-12 20:26:39 +00:00
Debugger "fix" a nasty race condition 2004-01-14 21:18:03 +00:00
ExecutionEngine Add a TargetData to the PassManager regardless of the TargetMachine. 2004-04-14 17:45:52 +00:00
Linker Don't use invalid HTML in a doxygen comment. 2004-04-15 15:23:45 +00:00
Support Bugpoint was not correctly capturing stderr! This caused it to "find" bugs 2004-04-16 05:35:58 +00:00
Target Give SparcV9CodeEmitter a head-of-file comment and a PassName. 2004-04-15 20:23:13 +00:00
Transforms Fix a HUGE pessimization on X86. The indvars pass was taking this 2004-04-17 18:16:10 +00:00
VMCore Fix retriving parent Function. 2004-04-16 17:37:12 +00:00
Makefile CBackend is no longer here 2004-02-13 23:29:37 +00:00