Commit Graph

871 Commits

Author SHA1 Message Date
Chris Lattner 05ef97f994 Eliminate all of the SCEV Expansion code which is really part of the
IndVars pass, not part of SCEV *analysis*.

llvm-svn: 13134
2004-04-23 21:29:03 +00:00
Chris Lattner 99504890b7 Pass the callgraph not the module
llvm-svn: 13087
2004-04-20 21:52:26 +00:00
Chris Lattner 8d0838130c Add the ability for SCC passes to initialize and finalize themselves
llvm-svn: 13084
2004-04-20 21:30:06 +00:00
Chris Lattner 663ebc3ec6 It's not just a printer, it's actually an analysis too
llvm-svn: 13064
2004-04-19 03:42:32 +00:00
Chris Lattner 32447c55fe Remove code to update loop depths
llvm-svn: 13058
2004-04-19 03:02:09 +00:00
Chris Lattner 26ba2f5fe8 Add new method
llvm-svn: 13050
2004-04-18 22:45:27 +00:00
Chris Lattner d6ce359d3b Fix computation of exit blocks
llvm-svn: 13047
2004-04-18 22:21:41 +00:00
Chris Lattner d72c3eb54e Change the ExitBlocks list from being explicitly contained in the Loop
structure to being dynamically computed on demand.  This makes updating
loop information MUCH easier.

llvm-svn: 13045
2004-04-18 22:14:10 +00:00
Chris Lattner e375a4fdc2 Implement method
llvm-svn: 13036
2004-04-18 06:54:48 +00:00
Chris Lattner 1472c63fb9 Add a new method, add a check missing that caused a segfault if a loop didn't
have a canonical indvar

llvm-svn: 13032
2004-04-18 05:38:05 +00:00
Chris Lattner dd73047673 Add the ability to compute exit values for complex loop using unanalyzable
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
2004-04-17 22:58:41 +00:00
Chris Lattner 4021d1af5a 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.

llvm-svn: 13017
2004-04-17 18:36:24 +00:00
Brian Gaeke 174633b078 Include <cmath> for compatibility with gcc 3.0.x (the system compiler on
Debian.)

llvm-svn: 12986
2004-04-16 15:57:32 +00:00
Chris Lattner d9dc425376 add some helpful methods. Rearrange #includes to proper order
llvm-svn: 12960
2004-04-15 15:16:02 +00:00
Chris Lattner b4f681b42b Factor a bunch of classes out into a public header
llvm-svn: 12958
2004-04-15 15:07:24 +00:00
Chris Lattner a4e4a63856 Unbreak the build
llvm-svn: 12956
2004-04-15 14:17:43 +00:00
Chris Lattner d420fe63ea Implement a FIXME: if we're going to insert a cast, we might as well only
insert it once!

llvm-svn: 12955
2004-04-14 22:01:22 +00:00
Chris Lattner 8a9fd94cfe This is a trivial tweak to the addrec insertion code: insert the increment
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
2004-04-14 21:11:25 +00:00
Chris Lattner 55b7ef5a81 Add some methods that are useful for updating loop information.
llvm-svn: 12871
2004-04-12 20:26:17 +00:00
Chris Lattner 8b6db18ac3 Change the call graph class to have TWO external nodes, making call graph
SCC passes much more useful.  In particular, this should fix the incredibly
stupid missed inlining opportunities that the inliner suffered from.

llvm-svn: 12860
2004-04-12 05:36:32 +00:00
Chris Lattner c9e37d7cc9 Hrm, operator new and new[] do not belong here. We should not CSE them! :)
llvm-svn: 12859
2004-04-12 05:16:42 +00:00
Chris Lattner 403abb824f operator new & operator new[] do not kill any legal memory locations.
llvm-svn: 12833
2004-04-11 18:16:34 +00:00
Chris Lattner c5fad355f8 Allow clients to be more efficient.
llvm-svn: 12831
2004-04-11 16:43:07 +00:00
Chris Lattner 4a1b03c773 Add a couple of more functions that cannot access memory (the intrinsics) and
don't write to memory

llvm-svn: 12808
2004-04-10 06:55:27 +00:00
Chris Lattner 74498e1066 Fix a bug Brian found.
llvm-svn: 12754
2004-04-07 16:16:11 +00:00
Chris Lattner d4f78f270b Sparc don't got not "sqrtl", bum bum bum
llvm-svn: 12670
2004-04-05 19:05:15 +00:00
Misha Brukman 5ebc25c818 Kill warnings during an optimized compile where assert() disappears.
llvm-svn: 12669
2004-04-05 19:00:46 +00:00
Chris Lattner 29153fc2e5 Fix PR312 and IndVarsSimplify/2004-04-05-InvokeCastCrash.llx
llvm-svn: 12668
2004-04-05 18:46:55 +00:00
Chris Lattner 69193f93b6 Support getelementptr instructions which use uint's to index into structure
types and can have arbitrary 32- and 64-bit integer types indexing into
sequential types.

llvm-svn: 12653
2004-04-05 01:30:19 +00:00
Chris Lattner 8ed3c8aa13 Implement test/Regression/Transforms/GCSE/undefined_load.ll
llvm-svn: 12641
2004-04-03 00:45:16 +00:00
Chris Lattner 0defaa1cbc Add a break in the default case
llvm-svn: 12639
2004-04-03 00:43:03 +00:00
Chris Lattner 6748cca268 Remove obsolete files
llvm-svn: 12633
2004-04-02 20:56:24 +00:00
Chris Lattner 0916921332 Comment out debugging printouts
llvm-svn: 12623
2004-04-02 20:26:46 +00:00
Chris Lattner d934c70cf8 Add a new analysis
llvm-svn: 12619
2004-04-02 20:23:17 +00:00
Chris Lattner 82d34eb470 Minor efficiency improvement, finegrainify namespacification
llvm-svn: 12517
2004-03-25 22:56:03 +00:00
Chris Lattner 3022b1bc2c Fix a HORRIBLY NASTY bug that caused siod to stop working last night.
llvm-svn: 12479
2004-03-17 23:22:04 +00:00
Chris Lattner 8ad948ddbd Add some missing functions. Make sure to handle calls together in case the
client has another VN implementation that can VN calls.

llvm-svn: 12427
2004-03-16 03:41:35 +00:00
Chris Lattner 7f04ebc858 Ok, the assertion was bogus. Calls that do not read/write memory should not
have an alias set, just like adds and subtracts don't.

llvm-svn: 12422
2004-03-15 06:28:07 +00:00
Chris Lattner f5c8f4cea6 This assertion is bogus now that calls do not necessarily read/write memory
llvm-svn: 12421
2004-03-15 06:24:15 +00:00
Chris Lattner 53a3587997 Implement CSE of call instructions in the most trivial case. This implements
GCSE/call_cse.ll

llvm-svn: 12419
2004-03-15 05:44:59 +00:00
Chris Lattner ea42c857d6 Fix a minor bug, implementing GCSE/call_pure_function.ll
Also, add some stuff I missed before.

llvm-svn: 12417
2004-03-15 04:18:28 +00:00
Chris Lattner 21c60f1549 Don't be COMPLETELY pessimistic in the face of function calls
llvm-svn: 12413
2004-03-15 04:08:36 +00:00
Chris Lattner a67dbd02cf Deinline some virtual methods, provide better mod/ref answers through the
use of the boolean queries

llvm-svn: 12410
2004-03-15 04:07:29 +00:00
Chris Lattner d441444234 Pass through the boolean queries
llvm-svn: 12409
2004-03-15 04:06:46 +00:00
Chris Lattner d82256a7a1 Teach basicaa about some stdc functions.
llvm-svn: 12408
2004-03-15 03:36:49 +00:00
Chris Lattner 652eb53dad Fix a tiny bug that caused an incorrect assertion failure poolallocating
boxed-sim.

llvm-svn: 12358
2004-03-13 01:14:23 +00:00
Chris Lattner 071a5e5649 Rename the intrinsic enum values for llvm.va_* from Intrinsic::va_* to
Intrinsic::va*.  This avoid conflicting with macros in the stdlib.h file.

llvm-svn: 12356
2004-03-13 00:24:00 +00:00
Chris Lattner f9e69b4553 Fix a couple of minor problems. Because PHI nodes can use themselves, this
could cause infinite loops.  Also, getUnderlyingObject can return null

llvm-svn: 12351
2004-03-12 23:12:55 +00:00
Chris Lattner a036253872 Implement mod/ref analysis for a trivial case where locals don't escape.
This comes up when you have a local array on the stack and you never pass
the address of elements around.

llvm-svn: 12349
2004-03-12 22:39:00 +00:00
Misha Brukman 4483c9b864 Simplify code to process CallSites (thanks to Chris).
llvm-svn: 12334
2004-03-12 16:20:49 +00:00