summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* Implement Transforms/SimplifyCFG/switch_thread.llChris Lattner2005-02-241-4/+190
| | | | | | | | This does a simple form of "jump threading", which eliminates CFG edges that are provably dead. This triggers 90 times in the external tests, and eliminating CFG edges is always always a good thing! :) llvm-svn: 20300
* make this more efficient. Scan up to 16 nodes, not the whole list.Chris Lattner2005-02-231-1/+1
| | | | llvm-svn: 20289
* Remove use of bind_objChris Lattner2005-02-221-2/+3
| | | | llvm-svn: 20276
* Do not mark obviously unreachable blocks live when processing PHI nodes,Chris Lattner2005-02-171-40/+61
| | | | | | | | | | | | and handle incomplete control dependences correctly. This fixes: Regression/Transforms/ADCE/dead-phi-edge.ll -> a missed optimization Regression/Transforms/ADCE/dead-phi-edge.ll -> a compiler crash distilled from QT4 llvm-svn: 20227
* Fix the second bug attached to PR504.Chris Lattner2005-02-141-1/+1
| | | | llvm-svn: 20181
* Fix for testcase Transforms/IndVarsSimplify/2005-02-11-InvokeCrash.llChris Lattner2005-02-121-0/+2
| | | | | | and PR504. llvm-svn: 20129
* Localize globals if they are only used in main(). This replaces theAlkis Evlogimenos2005-02-101-0/+40
| | | | | | | global with an alloca, which eventually gets promoted into a register. This enables a lot of other optimizations later on. llvm-svn: 20109
* Fix crash on MallocInsts of unsized types.Alkis Evlogimenos2005-02-021-1/+2
| | | | llvm-svn: 19988
* API change.Chris Lattner2005-02-011-1/+1
| | | | llvm-svn: 19959
* Adjust to changes in APIsChris Lattner2005-02-012-16/+10
| | | | llvm-svn: 19958
* Hacks to make this ugly ugly code work with the new use lists.Chris Lattner2005-02-011-17/+12
| | | | llvm-svn: 19957
* Implement InstCombine/cast.ll:test25, a case that occurs many timesChris Lattner2005-01-311-0/+56
| | | | | | in spec llvm-svn: 19953
* Implement the trivial cases in InstCombine/store.llChris Lattner2005-01-311-1/+38
| | | | llvm-svn: 19950
* Implement Transforms/InstCombine/cast-load-gep.ll, which allows us to ↵Chris Lattner2005-01-311-15/+29
| | | | | | | | devirtualize 11 indirect calls in perlbmk. llvm-svn: 19947
* Adjust to changes in instruction interfaces.Chris Lattner2005-01-293-10/+11
| | | | llvm-svn: 19900
* Switchinst takes a hint for the number of cases it will have.Chris Lattner2005-01-291-1/+1
| | | | llvm-svn: 19899
* switchinst ctor now takes a hint for the number of cases that it will have.Chris Lattner2005-01-292-3/+3
| | | | llvm-svn: 19898
* Adjust Valuehandle to hold its operand directly in it.Chris Lattner2005-01-292-7/+7
| | | | llvm-svn: 19897
* * add some DEBUG statementsChris Lattner2005-01-281-3/+10
| | | | | | | | | | | | | | | | * Properly compile this: struct a {}; int test() { struct a b[2]; if (&b[0] != &b[1]) abort (); return 0; } to 'return 0', not abort(). llvm-svn: 19875
* Add a dependency to the trace library so that it gets pulled inAlkis Evlogimenos2005-01-251-1/+3
| | | | | | automatically. llvm-svn: 19828
* Get rid of a several dozen more and instructions in specint.Chris Lattner2005-01-231-5/+36
| | | | llvm-svn: 19786
* Handle comparisons of gep instructions that have different typed indicesChris Lattner2005-01-211-5/+9
| | | | | | as long as they are the same size. llvm-svn: 19734
* Add two optimizations. The first folds (X+Y)-X -> YChris Lattner2005-01-191-2/+89
| | | | | | | | | | | | | | | | | The second folds operations into selects, e.g. (select C, (X+Y), (Y+Z)) -> (Y+(select C, X, Z) This occurs a few times across spec, e.g. select add/sub mesa: 83 0 povray: 5 2 gcc 4 2 parser 0 22 perlbmk 13 30 twolf 0 3 llvm-svn: 19706
* Fix 'raise' to work with packed types. Patch by Morten Ofstad.Chris Lattner2005-01-191-1/+1
| | | | llvm-svn: 19693
* Delete PHI nodes that are not dead but are locked in a cycle of singleChris Lattner2005-01-171-0/+26
| | | | | | useness. llvm-svn: 19629
* Move code out of indentation one level to make it easier to read.Chris Lattner2005-01-171-60/+64
| | | | | | | | | | | | | Disable the xform for < > cases. It turns out that the following is being miscompiled: bool %test(sbyte %S) { %T = cast sbyte %S to uint %V = setgt uint %T, 255 ret bool %V } llvm-svn: 19628
* Fix some bugs in an xform added yesterday. This fixes Prolangs-C/allroots.Chris Lattner2005-01-141-2/+2
| | | | llvm-svn: 19553
* Fix a compile crash on spiffChris Lattner2005-01-141-7/+4
| | | | llvm-svn: 19552
* if two gep comparisons only differ by one index, compare that index directly.Chris Lattner2005-01-141-0/+28
| | | | | | This allows us to better optimize begin() -> end() comparisons in common cases. llvm-svn: 19542
* Do not overrun iterators. This fixes a 176.gcc crashChris Lattner2005-01-131-2/+1
| | | | llvm-svn: 19541
* Turn select C, (X+Y), (X-Y) --> (X+(select C, Y, (-Y))). This occurs inChris Lattner2005-01-131-0/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | the 'sim' program and probably elsewhere. In sim, it comes up for cases like this: #define round(x) ((x)>0.0 ? (x)+0.5 : (x)-0.5) double G; void T(double X) { G = round(X); } (it uses the round macro a lot). This changes the LLVM code from: %tmp.1 = setgt double %X, 0.000000e+00 ; <bool> [#uses=1] %tmp.4 = add double %X, 5.000000e-01 ; <double> [#uses=1] %tmp.6 = sub double %X, 5.000000e-01 ; <double> [#uses=1] %mem_tmp.0 = select bool %tmp.1, double %tmp.4, double %tmp.6 store double %mem_tmp.0, double* %G to: %tmp.1 = setgt double %X, 0.000000e+00 ; <bool> [#uses=1] %mem_tmp.0.p = select bool %tmp.1, double 5.000000e-01, double -5.000000e-01 %mem_tmp.0 = add double %mem_tmp.0.p, %X store double %mem_tmp.0, double* %G ret void llvm-svn: 19537
* Implement an optimization for == and != comparisons like this:Chris Lattner2005-01-131-1/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | _Bool test2(int X, int Y) { return &arr[X][Y] == arr; } instead of generating this: bool %test2(int %X, int %Y) { %tmp.3.idx = mul int %X, 160 ; <int> [#uses=1] %tmp.3.idx1 = shl int %Y, ubyte 2 ; <int> [#uses=1] %tmp.3.offs2 = sub int 0, %tmp.3.idx ; <int> [#uses=1] %tmp.7 = seteq int %tmp.3.idx1, %tmp.3.offs2 ; <bool> [#uses=1] ret bool %tmp.7 } generate this: bool %test2(int %X, int %Y) { seteq int %X, 0 ; <bool>:0 [#uses=1] seteq int %Y, 0 ; <bool>:1 [#uses=1] %tmp.7 = and bool %0, %1 ; <bool> [#uses=1] ret bool %tmp.7 } This idiom occurs in C++ programs when iterating from begin() to end(), in a vector or array. For example, we now compile this: void test(int X, int Y) { for (int *i = arr; i != arr+100; ++i) foo(*i); } to this: no_exit: ; preds = %entry, %no_exit ... %exitcond = seteq uint %indvar.next, 100 ; <bool> [#uses=1] br bool %exitcond, label %return, label %no_exit instead of this: no_exit: ; preds = %entry, %no_exit ... %inc5 = getelementptr [100 x [40 x int]]* %arr, int 0, int 0, int %inc.rec ; <int*> [#uses=1] %tmp.8 = seteq int* %inc5, getelementptr ([100 x [40 x int]]* %arr, int 0, int 100, int 0) ; <bool> [#uses=1] %indvar.next = add uint %indvar, 1 ; <uint> [#uses=1] br bool %tmp.8, label %return, label %no_exit llvm-svn: 19536
* Fix some bugs in code I didn't mean to check in.Chris Lattner2005-01-131-5/+12
| | | | llvm-svn: 19534
* Fix a crash compiling 129.compressChris Lattner2005-01-131-6/+109
| | | | llvm-svn: 19533
* Add the LOADABLE_MODULE=1 directive to indicate that this shared library isReid Spencer2005-01-111-0/+1
| | | | | | intended to be a dlopenable module and not a "plain" shared library. llvm-svn: 19456
* Apply feedback from Chris.Jeff Cohen2005-01-101-2/+2
| | | | llvm-svn: 19432
* Fix VS warningsChris Lattner2005-01-082-13/+13
| | | | llvm-svn: 19383
* Fix VS warnings.Chris Lattner2005-01-082-4/+5
| | | | llvm-svn: 19382
* Fix uint64_t -> unsigned VS warnings.Chris Lattner2005-01-082-12/+13
| | | | llvm-svn: 19381
* Silence VS warnings.Chris Lattner2005-01-081-5/+7
| | | | llvm-svn: 19380
* Silence warningsChris Lattner2005-01-082-3/+4
| | | | llvm-svn: 19379
* Add more missing createXxxPass functions.Jeff Cohen2005-01-083-0/+9
| | | | llvm-svn: 19370
* Convert tabs to spacesMisha Brukman2005-01-071-3/+2
| | | | llvm-svn: 19320
* Add missing createXxxPass functionsJeff Cohen2005-01-074-0/+20
| | | | llvm-svn: 19319
* Add missing includeJeff Cohen2005-01-071-0/+1
| | | | llvm-svn: 19315
* Put createLoopUnswitchPass() into proper namespaceJeff Cohen2005-01-061-1/+1
| | | | llvm-svn: 19306
* Add missing includeJeff Cohen2005-01-061-0/+1
| | | | llvm-svn: 19305
* This is a bulk commit that implements the following primary improvements:Chris Lattner2005-01-011-78/+268
| | | | | | | | | | | | | | | | | | | | | | * We can now fold cast instructions into select instructions that have at least one constant operand. * We now optimize expressions more aggressively based on bits that are known to be zero. These optimizations occur a lot in code that uses bitfields even in simple ways. * We now turn more cast-cast sequences into AND instructions. Before we would only do this if it if all types were unsigned. Now only the middle type needs to be unsigned (guaranteeing a zero extend). * We transform sign extensions into zero extensions in several cases. This corresponds to these test/Regression/Transforms/InstCombine testcases: 2004-11-22-Missed-and-fold.ll and.ll: test28-29 cast.ll: test21-24 and-or-and.ll cast-cast-to-and.ll zeroext-and-reduce.ll llvm-svn: 19220
* Implement SimplifyCFG/DeadSetCC.llChris Lattner2005-01-011-0/+8
| | | | | | | | SimplifyCFG is one of those passes that we use for final cleanup: it should not rely on other passes to clean up its garbage. This fixes the "why are trivially dead setcc's in the output of gccas" problem. llvm-svn: 19212
* Fix PR491 and testcase ↵Chris Lattner2004-12-291-1/+2
| | | | | | Transforms/DeadStoreElimination/2004-12-28-PartialStore.ll llvm-svn: 19180
OpenPOWER on IntegriCloud