- Apr 19, 2004
-
-
Misha Brukman authored
llvm-svn: 13060
-
Chris Lattner authored
* Remove #include * Add some methods to update loop/loopinfo * Stop explicitly holding the loop depth in the Loop class. Instead, just dynamically calculate it. This makes it easier to update LoopInfo as a result of transformations. llvm-svn: 13059
-
Chris Lattner authored
llvm-svn: 13058
-
Chris Lattner authored
llvm-svn: 13057
-
Misha Brukman authored
llvm-svn: 13056
-
Misha Brukman authored
llvm-svn: 13055
-
Misha Brukman authored
by creating an internal wrapper function with same signature as the external function, and use it instead of the "real" function. The wrapper then calls the external function using the same JIT function resolution API that has been used before for rewriting instructions, since the wrapper has an explicit call instruction which we can rewrite. llvm-svn: 13054
-
Chris Lattner authored
in a loop. llvm-svn: 13052
-
Chris Lattner authored
llvm-svn: 13051
-
Chris Lattner authored
llvm-svn: 13050
-
Chris Lattner authored
llvm-svn: 13049
-
Chris Lattner authored
llvm-svn: 13048
-
Chris Lattner authored
llvm-svn: 13047
-
Chris Lattner authored
llvm-svn: 13046
-
Chris Lattner authored
structure to being dynamically computed on demand. This makes updating loop information MUCH easier. llvm-svn: 13045
-
- Apr 18, 2004
-
-
Chris Lattner authored
llvm-svn: 13041
-
Chris Lattner authored
llvm-svn: 13040
-
Chris Lattner authored
that the exit block of the loop becomes the new entry block of the function. This was causing a verifier assertion on 252.eon. llvm-svn: 13039
-
Chris Lattner authored
using instructions inside of the loop. This should fix the MishaTest failure from last night. llvm-svn: 13038
-
Chris Lattner authored
llvm-svn: 13037
-
Chris Lattner authored
llvm-svn: 13036
-
Chris Lattner authored
llvm-svn: 13035
-
Chris Lattner authored
block. The primary motivation for doing this is that we can now unroll nested loops. This makes a pretty big difference in some cases. For example, in 183.equake, we are now beating the native compiler with the CBE, and we are a lot closer with LLC. I'm now going to play around a bit with the unroll factor and see what effect it really has. llvm-svn: 13034
-
Chris Lattner authored
While we're at it, add support for updating loop information correctly. llvm-svn: 13033
-
Chris Lattner authored
have a canonical indvar llvm-svn: 13032
-
Chris Lattner authored
llvm-svn: 13031
-
Chris Lattner authored
llvm-svn: 13030
-
Chris Lattner authored
llvm-svn: 13029
-
Chris Lattner authored
limited. Even in it's extremely simple state (it can only *fully* unroll single basic block loops that execute a constant number of times), it already helps improve performance a LOT on some benchmarks, particularly with the native code generators. llvm-svn: 13028
-
Chris Lattner authored
llvm-svn: 13025
-
Chris Lattner authored
llvm-svn: 13023
-
Chris Lattner authored
llvm-svn: 13020
-
Chris Lattner authored
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
-
- Apr 17, 2004
-
-
Chris Lattner authored
exit values. llvm-svn: 13018
-
Chris Lattner authored
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
-
Chris Lattner authored
(familiar) function: int _strlen(const char *str) { int len = 0; while (*str++) len++; return len; } And transforming it to use a ulong induction variable, because the type of the pointer index was left as a constant long. This is obviously very bad. The fix is to shrink long constants in getelementptr instructions to intptr_t, making the indvars pass insert a uint induction variable, which is much more efficient. Here's the before code for this function: int %_strlen(sbyte* %str) { entry: %tmp.13 = load sbyte* %str ; <sbyte> [#uses=1] %tmp.24 = seteq sbyte %tmp.13, 0 ; <bool> [#uses=1] br bool %tmp.24, label %loopexit, label %no_exit no_exit: ; preds = %entry, %no_exit *** %indvar = phi uint [ %indvar.next, %no_exit ], [ 0, %entry ] ; <uint> [#uses=2] *** %indvar = phi ulong [ %indvar.next, %no_exit ], [ 0, %entry ] ; <ulong> [#uses=2] %indvar1 = cast ulong %indvar to uint ; <uint> [#uses=1] %inc.02.sum = add uint %indvar1, 1 ; <uint> [#uses=1] %inc.0.0 = getelementptr sbyte* %str, uint %inc.02.sum ; <sbyte*> [#uses=1] %tmp.1 = load sbyte* %inc.0.0 ; <sbyte> [#uses=1] %tmp.2 = seteq sbyte %tmp.1, 0 ; <bool> [#uses=1] %indvar.next = add ulong %indvar, 1 ; <ulong> [#uses=1] %indvar.next = add uint %indvar, 1 ; <uint> [#uses=1] br bool %tmp.2, label %loopexit.loopexit, label %no_exit loopexit.loopexit: ; preds = %no_exit %indvar = cast uint %indvar to int ; <int> [#uses=1] %inc.1 = add int %indvar, 1 ; <int> [#uses=1] ret int %inc.1 loopexit: ; preds = %entry ret int 0 } Here's the after code: int %_strlen(sbyte* %str) { entry: %inc.02 = getelementptr sbyte* %str, uint 1 ; <sbyte*> [#uses=1] %tmp.13 = load sbyte* %str ; <sbyte> [#uses=1] %tmp.24 = seteq sbyte %tmp.13, 0 ; <bool> [#uses=1] br bool %tmp.24, label %loopexit, label %no_exit no_exit: ; preds = %entry, %no_exit *** %indvar = phi uint [ %indvar.next, %no_exit ], [ 0, %entry ] ; <uint> [#uses=3] %indvar = cast uint %indvar to int ; <int> [#uses=1] %inc.0.0 = getelementptr sbyte* %inc.02, uint %indvar ; <sbyte*> [#uses=1] %inc.1 = add int %indvar, 1 ; <int> [#uses=1] %tmp.1 = load sbyte* %inc.0.0 ; <sbyte> [#uses=1] %tmp.2 = seteq sbyte %tmp.1, 0 ; <bool> [#uses=1] %indvar.next = add uint %indvar, 1 ; <uint> [#uses=1] br bool %tmp.2, label %loopexit, label %no_exit loopexit: ; preds = %entry, %no_exit %len.0.1 = phi int [ 0, %entry ], [ %inc.1, %no_exit ] ; <int> [#uses=1] ret int %len.0.1 } llvm-svn: 13016
-
Chris Lattner authored
the trip count for the loop, insert one so that we can canonicalize the exit condition. llvm-svn: 13015
-
Chris Lattner authored
llvm-svn: 13011
-
- Apr 16, 2004
-
-
Chris Lattner authored
make the verifier more strict. This fixes building zlib llvm-svn: 13002
-
Misha Brukman authored
llvm-svn: 13001
-