aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms
AgeCommit message (Collapse)Author
2005-01-21Handle comparisons of gep instructions that have different typed indicesChris Lattner
as long as they are the same size. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19734 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-19Add two optimizations. The first folds (X+Y)-X -> YChris Lattner
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19706 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-19Fix 'raise' to work with packed types. Patch by Morten Ofstad.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19693 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-17Delete PHI nodes that are not dead but are locked in a cycle of singleChris Lattner
useness. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19629 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-17Move code out of indentation one level to make it easier to read.Chris Lattner
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 } git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19628 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-14Fix some bugs in an xform added yesterday. This fixes Prolangs-C/allroots.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19553 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-14Fix a compile crash on spiffChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19552 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-14if two gep comparisons only differ by one index, compare that index directly.Chris Lattner
This allows us to better optimize begin() -> end() comparisons in common cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19542 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-13Do not overrun iterators. This fixes a 176.gcc crashChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19541 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-13Turn select C, (X+Y), (X-Y) --> (X+(select C, Y, (-Y))). This occurs inChris Lattner
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19537 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-13Implement an optimization for == and != comparisons like this:Chris Lattner
_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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19536 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-13Fix some bugs in code I didn't mean to check in.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19534 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-13Fix a crash compiling 129.compressChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19533 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-11Add the LOADABLE_MODULE=1 directive to indicate that this shared library isReid Spencer
intended to be a dlopenable module and not a "plain" shared library. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19456 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-10Apply feedback from Chris.Jeff Cohen
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19432 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-08Fix VS warningsChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19383 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-08Fix VS warnings.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19382 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-08Fix uint64_t -> unsigned VS warnings.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19381 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-08Silence VS warnings.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19380 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-08Silence warningsChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19379 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-08Add more missing createXxxPass functions.Jeff Cohen
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19370 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-07Convert tabs to spacesMisha Brukman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19320 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-07Add missing createXxxPass functionsJeff Cohen
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19319 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-07Add missing includeJeff Cohen
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19315 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-06Put createLoopUnswitchPass() into proper namespaceJeff Cohen
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19306 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-06Add missing includeJeff Cohen
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19305 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-01This is a bulk commit that implements the following primary improvements:Chris Lattner
* 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19220 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-01Implement SimplifyCFG/DeadSetCC.llChris Lattner
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19212 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-29Fix PR491 and testcase ↵Chris Lattner
Transforms/DeadStoreElimination/2004-12-28-PartialStore.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19180 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-15Adjust to new interfacesChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18958 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-14Constant exprs are not efficiently negatable in practice. This disablesChris Lattner
turning X - (constantexpr) into X + (-constantexpr) among other things. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18935 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-13Fix link error in PPC optimized build of 'opt'.Brian Gaeke
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18913 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-13Get rid of getSizeOf, using ConstantExpr::getSizeOf instead.Chris Lattner
do not insert a prototype for malloc of: void* malloc(uint): on 64-bit u targets this is not correct. Instead of prototype it as void *malloc(...), and pass the correct intptr_t through the "...". Finally, fix Regression/CodeGen/SparcV9/2004-12-13-MallocCrash.ll, by not forming constantexpr casts from pointer to uint. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18908 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-12Change indentation of a whole bunch of code, no real changes here.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18843 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-12More substantial simplifications and speedups. This makes ADCE about 20% fasterChris Lattner
in some cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18842 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-12More minor microoptimizationsChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18841 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-12Remove some more set operationsChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18840 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-12Reduce number of set operations.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18839 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-12Optimize div/rem + select combinations more.Chris Lattner
In particular, implement div.ll:test10 and rem.ll:test4. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18838 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-12Properly implement copying of a global, fixing the 255.vortex & povrayChris Lattner
failures from last night. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18832 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-12Simplify code and do not invalidate iterators.Chris Lattner
This fixes a crash compiling TimberWolfMC that was exposed due to recent optimizer changes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18831 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-12Though the previous xform applies to literally dozens (hundreds?) of variablesChris Lattner
in SPEC, the subsequent optimziations that we are after don't play with with FP values, so disable this xform for them. Really we just don't want stuff like: double G; (always 0 or 412312.312) = G; turning into: bool G_b; = G_b ? 412312.312 : 0; We'd rather just do the load. -Chris git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18819 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-12If a variable can only hold two values, and is not already a bool, shrink itChris Lattner
down to actually BE a bool. This allows simple value range propagation stuff work harder, deleting comparisons in bzip2 in some hot loops. This implements GlobalOpt/integer-bool.ll, which is the essence of the loop condition distilled into a testcase. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18817 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-11If one side of and/or is known to be 0/-1, it doesn't matterChris Lattner
if the other side is overdefined. This allows us to fold conditions like: if (X < Y || Y > Z) in some cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18807 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-11Only cound if we actually made a change.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18800 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-11The split bb is really the exit of the old functionChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18799 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-11Two bug fixes:Chris Lattner
1. Actually increment the Statistic for the GV elim optzn 2. When resolving undef branches, only resolve branches in executable blocks, avoiding marking a bunch of completely dead blocks live. This has a big impact on the quality of the generated code. With this patch, we positively rip up vortex, compiling Ut_MoveBytes to a single memcpy call. In vortex we get this: 12 ipsccp - Number of globals found to be constant 986 ipsccp - Number of arguments constant propagated 1378 ipsccp - Number of basic blocks unreachable 8919 ipsccp - Number of instructions removed git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18796 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-11Do not delete the entry block to a function.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18795 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-11Implement Transforms/SCCP/ipsccp-gvar.ll, by tracking values stored toChris Lattner
non-address-taken global variables. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18790 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-11Fix a bug where we could delete dead invoke instructions with uses.Chris Lattner
In functions where we fully constant prop the return value, replace all ret instructions with 'ret undef'. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18786 91177308-0d34-0410-b5e6-96231b3b80d8