aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Add the ability to compute trip counts that are only controlled by constantsChris Lattner2004-04-171-5/+174
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix a HUGE pessimization on X86. The indvars pass was taking thisChris Lattner2004-04-171-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (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 } git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13016 91177308-0d34-0410-b5e6-96231b3b80d8
* Even if there are not any induction variables in the loop, if we can computeChris Lattner2004-04-171-1/+11
| | | | | | | | the trip count for the loop, insert one so that we can canonicalize the exit condition. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13015 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for evaluation of exp/log/log10/powChris Lattner2004-04-161-1/+25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13011 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix some really nasty dominance bugs that were exposed by my patch toChris Lattner2004-04-161-29/+12
| | | | | | | make the verifier more strict. This fixes building zlib git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13002 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix retriving parent Function.Misha Brukman2004-04-161-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13001 91177308-0d34-0410-b5e6-96231b3b80d8
* Fit comment into 80 cols.Misha Brukman2004-04-161-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12996 91177308-0d34-0410-b5e6-96231b3b80d8
* Regenerated using autoconf-2.57.Brian Gaeke2004-04-161-66/+97
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12995 91177308-0d34-0410-b5e6-96231b3b80d8
* Refactor external benchmark checking stuff into one hairyBrian Gaeke2004-04-161-69/+32
| | | | | | | macro-to-bind-them-all, called EXTERNAL_BENCHMARK(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12994 91177308-0d34-0410-b5e6-96231b3b80d8
* Add idea about a disassembler.Misha Brukman2004-04-161-0/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12993 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch to including <iostream> for compatibility with gcc-3.0.x (Debian).Brian Gaeke2004-04-162-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12990 91177308-0d34-0410-b5e6-96231b3b80d8
* * Fix capitalization of PICkMisha Brukman2004-04-161-11/+11
| | | | | | | * Wrap long lines to 80 cols git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12988 91177308-0d34-0410-b5e6-96231b3b80d8
* Include <cmath> for compatibility with gcc 3.0.x (the system compiler onBrian Gaeke2004-04-162-0/+2
| | | | | | | Debian.) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12986 91177308-0d34-0410-b5e6-96231b3b80d8
* Include <string> for compatibility with gcc 3.0.x (the system compiler onBrian Gaeke2004-04-161-0/+1
| | | | | | | Debian.) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12985 91177308-0d34-0410-b5e6-96231b3b80d8
* As a part of the bootstrapping process, the top-level tools-only targetBrian Gaeke2004-04-161-1/+1
| | | | | | | should not build projects. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12984 91177308-0d34-0410-b5e6-96231b3b80d8
* Assert if deleting BasicBlock before removing it from Function.Misha Brukman2004-04-161-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12983 91177308-0d34-0410-b5e6-96231b3b80d8
* Assert if Instruction is being deleted before being removed from BasicBlock.Misha Brukman2004-04-161-0/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12982 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove libraries that have no reason to be here, and keep breaking the ↵Chris Lattner2004-04-161-1/+1
| | | | | | nightly tester because their makefiles do not have the right dependencies!! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12981 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix some of the strange CBE-only failures that happened last night.Chris Lattner2004-04-161-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12980 91177308-0d34-0410-b5e6-96231b3b80d8
* Make sure to check for a very bad class of errors: an instructionChris Lattner2004-04-161-0/+6
| | | | | | | | | that does not dominate all of its users, but is in the same basic block as its users. This class of error is what caused the mysterious CBE only failures last night. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12979 91177308-0d34-0410-b5e6-96231b3b80d8
* Bugpoint was not correctly capturing stderr! This caused it to "find" bugsChris Lattner2004-04-161-1/+4
| | | | | | | that didn't exist, missing the ones that do :( git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12978 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix Inline/2004-04-15-InlineDeletesCall.llChris Lattner2004-04-161-12/+20
| | | | | | | | | Basically we were using SimplifyCFG as a huge sledgehammer for a simple optimization. Because simplifycfg does so many things, we can't use it for this purpose. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12977 91177308-0d34-0410-b5e6-96231b3b80d8
* Add note about easier way to debug tests in the llvm tree.Misha Brukman2004-04-151-0/+10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12972 91177308-0d34-0410-b5e6-96231b3b80d8
* Add note about passing arguments to program being debugged.Misha Brukman2004-04-152-35/+44
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12970 91177308-0d34-0410-b5e6-96231b3b80d8
* New testcase that Brian provided which crashes the inlinerChris Lattner2004-04-151-0/+21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12969 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a bug in the previous checkin: if the exit block is not the same asChris Lattner2004-04-151-7/+23
| | | | | | | the back-edge block, we must check the preincremented value. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12968 91177308-0d34-0410-b5e6-96231b3b80d8
* Give SparcV9CodeEmitter a head-of-file comment and a PassName.Brian Gaeke2004-04-151-1/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12967 91177308-0d34-0410-b5e6-96231b3b80d8
* If we're going to use tabs, use them consistently. Maybe doxygen will find theMisha Brukman2004-04-151-2/+2
| | | | | | | @parameter line documentation that way, too. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12966 91177308-0d34-0410-b5e6-96231b3b80d8
* Removed obsolete doxygen options (they were blank anyway).Misha Brukman2004-04-152-70/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12965 91177308-0d34-0410-b5e6-96231b3b80d8
* The "best" of both worlds: readable C++ comments and valid HTML For doxygen.Misha Brukman2004-04-151-4/+7
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12964 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't use invalid HTML in doxygen comments.Misha Brukman2004-04-151-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12963 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't use invalid HTML in a doxygen comment.Misha Brukman2004-04-152-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12962 91177308-0d34-0410-b5e6-96231b3b80d8
* Change the canonical induction variable that we insert.Chris Lattner2004-04-151-10/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of producing code like this: Loop: X = phi 0, X2 ... X2 = X + 1 if (X != N-1) goto Loop We now generate code that looks like this: Loop: X = phi 0, X2 ... X2 = X + 1 if (X2 != N) goto Loop This has two big advantages: 1. The trip count of the loop is now explicit in the code, allowing the direct implementation of Loop::getTripCount() 2. This reduces register pressure in the loop, and allows X and X2 to be put into the same register. As a consequence of the second point, the code we generate for loops went from: .LBB2: # no_exit.1 ... mov %EDI, %ESI inc %EDI cmp %ESI, 2 mov %ESI, %EDI jne .LBB2 # PC rel: no_exit.1 To: .LBB2: # no_exit.1 ... inc %ESI cmp %ESI, 3 jne .LBB2 # PC rel: no_exit.1 ... which has two fewer moves, and uses one less register. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12961 91177308-0d34-0410-b5e6-96231b3b80d8
* add some helpful methods. Rearrange #includes to proper orderChris Lattner2004-04-151-6/+89
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12960 91177308-0d34-0410-b5e6-96231b3b80d8
* Add some helpful methodsChris Lattner2004-04-151-5/+36
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12959 91177308-0d34-0410-b5e6-96231b3b80d8
* Factor a bunch of classes out into a public headerChris Lattner2004-04-151-553/+142
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12958 91177308-0d34-0410-b5e6-96231b3b80d8
* Publically export all of these classes from the ScalarEvolutions.cpp fileChris Lattner2004-04-151-0/+461
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12957 91177308-0d34-0410-b5e6-96231b3b80d8
* Unbreak the buildChris Lattner2004-04-151-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12956 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement a FIXME: if we're going to insert a cast, we might as well onlyChris Lattner2004-04-141-1/+15
| | | | | | | insert it once! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12955 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove code to adjust the iterator for llvm.readio and llvm.writeio.John Criswell2004-04-142-20/+0
| | | | | | | | The iterator is pointing at the next instruction which should not disappear when doing the load/store replacement. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12954 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix typo.Brian Gaeke2004-04-141-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12953 91177308-0d34-0410-b5e6-96231b3b80d8
* This is a trivial tweak to the addrec insertion code: insert the incrementChris Lattner2004-04-141-7/+12
| | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12952 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a TargetData to the PassManager regardless of the TargetMachine.Brian Gaeke2004-04-141-0/+3
| | | | | | | This should unbreak the Sparc JIT again. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12949 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a copy constructor for TargetData.Brian Gaeke2004-04-141-0/+16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12948 91177308-0d34-0410-b5e6-96231b3b80d8
* We are now on LLVM 1.3Chris Lattner2004-04-141-3/+3
| | | | | | | Make autoconf default to checking to look to see if our funny directory exists git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12947 91177308-0d34-0410-b5e6-96231b3b80d8
* RegeneratedChris Lattner2004-04-141-11/+11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12946 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove the return type check for llvm.readio. This check is done for allJohn Criswell2004-04-141-4/+3
| | | | | | | | functions and is not needed here. Simplify the pointer type check per Chris's suggestions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12945 91177308-0d34-0410-b5e6-96231b3b80d8
* Added code to verify that llvm.readio's pointer argument returns somethingJohn Criswell2004-04-141-3/+8
| | | | | | | that matches its return type. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12944 91177308-0d34-0410-b5e6-96231b3b80d8
* Test for memory mapped I/O intrinsics.John Criswell2004-04-141-0/+21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12943 91177308-0d34-0410-b5e6-96231b3b80d8
* Finish adding the llvm.readio and llvm.writeio intrinsics.John Criswell2004-04-142-0/+24
| | | | | | | Sorry these didn't get in yesterday. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12942 91177308-0d34-0410-b5e6-96231b3b80d8