aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms
AgeCommit message (Collapse)Author
2005-03-04Do not compute 1ULL << 64, which is undefined. This fixes Ptrdist/ks on theChris Lattner
sparc, and testcase Regression/Transforms/InstCombine/2005-03-04-ShiftOverflow.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20445 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-04Add support for not strength reducing GEPs where the element size is a smallJeff Cohen
power of two. This emphatically includes the zeroeth power of two. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20429 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-03Add an optional argument to lower to a specific constant value instead ofChris Lattner
to a "sizeof" expression. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20414 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-01Fixed the following LSR bugs:Jeff Cohen
* Loop invariant code does not dominate the loop header, but rather the end of the loop preheader. * The base for a reduced GEP isn't a constant unless all of its operands (preceding the induction variable) are constant. * Allow induction variable elimination for the simple case after all. Also made changes recommended by Chris for properly deleting instructions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20383 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-28Fix crash in LSR due to attempt to remove original induction variable. However,Jeff Cohen
for reasons explained in the comments, I also deactivated this code as it needs more thought. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20367 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-27PHI nodes were incorrectly placed when more than one GEP is reduced in a loop.Jeff Cohen
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20360 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-27First pass at improved Loop Strength Reduction. Still not yet ready for ↵Jeff Cohen
prime time. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20358 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-27Teach globalopt how memset/cpy/move affect memory, to allow better optimization.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20352 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-27Fix spelling, patch contributed by Gabor Greif!Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20343 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-26remove extraneous castChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20334 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-24Implement Transforms/SimplifyCFG/switch_thread.llChris Lattner
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! :) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20300 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-23make this more efficient. Scan up to 16 nodes, not the whole list.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20289 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-22Remove use of bind_objChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20276 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-17Do not mark obviously unreachable blocks live when processing PHI nodes,Chris Lattner
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20227 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-14Fix the second bug attached to PR504.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20181 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-12Fix for testcase Transforms/IndVarsSimplify/2005-02-11-InvokeCrash.llChris Lattner
and PR504. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20129 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-10Localize globals if they are only used in main(). This replaces theAlkis Evlogimenos
global with an alloca, which eventually gets promoted into a register. This enables a lot of other optimizations later on. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20109 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-02Fix crash on MallocInsts of unsized types.Alkis Evlogimenos
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19988 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-01API change.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19959 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-01Adjust to changes in APIsChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19958 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-01Hacks to make this ugly ugly code work with the new use lists.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19957 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-31Implement InstCombine/cast.ll:test25, a case that occurs many timesChris Lattner
in spec git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19953 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-31Implement the trivial cases in InstCombine/store.llChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19950 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-31Implement Transforms/InstCombine/cast-load-gep.ll, which allows us to ↵Chris Lattner
devirtualize 11 indirect calls in perlbmk. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19947 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-29Adjust to changes in instruction interfaces.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19900 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-29Switchinst takes a hint for the number of cases it will have.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19899 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-29switchinst ctor now takes a hint for the number of cases that it will have.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19898 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-29Adjust Valuehandle to hold its operand directly in it.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19897 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-28* add some DEBUG statementsChris Lattner
* Properly compile this: struct a {}; int test() { struct a b[2]; if (&b[0] != &b[1]) abort (); return 0; } to 'return 0', not abort(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19875 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-25Add a dependency to the trace library so that it gets pulled inAlkis Evlogimenos
automatically. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19828 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-23Get rid of a several dozen more and instructions in specint.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19786 91177308-0d34-0410-b5e6-96231b3b80d8
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