summaryrefslogtreecommitdiff
path: root/lib/Transforms
AgeCommit message (Collapse)AuthorFilesLines
2005-04-21Fix a bug where we would not promote calls to invokes if they occured inChris Lattner1-3/+5
the same block as the setjmp. Thanks to Greg Pettyjohn for noticing this! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21403 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21Improve doxygen documentation, patch contributed by Evan Jones!Chris Lattner1-17/+17
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21393 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21Instcombine this:Chris Lattner1-0/+3
%shortcirc_val = select bool %tmp.1, bool true, bool %tmp.4 ; <bool> [#uses=1] %tmp.6 = cast bool %shortcirc_val to int ; <int> [#uses=1] into this: %shortcirc_val = or bool %tmp.1, %tmp.4 ; <bool> [#uses=1] %tmp.6 = cast bool %shortcirc_val to int ; <int> [#uses=1] not this: %tmp.4.cast = cast bool %tmp.4 to int ; <int> [#uses=1] %tmp.6 = select bool %tmp.1, int 1, int %tmp.4.cast ; <int> [#uses=1] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21389 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21Teach simplifycfg that setcc is cheap and non-trapping, so that it canChris Lattner1-0/+6
convert this: %tmp.1 = seteq int %i, 0 ; <bool> [#uses=1] br bool %tmp.1, label %shortcirc_done, label %shortcirc_next shortcirc_next: ; preds = %entry %tmp.4 = seteq int %j, 0 ; <bool> [#uses=1] br label %shortcirc_done shortcirc_done: ; preds = %shortcirc_next, %entry %shortcirc_val = phi bool [ %tmp.4, %shortcirc_next ], [ true, %entry ] ; <bool> [#uses=1] to this: %tmp.1 = seteq int %i, 0 ; <bool> [#uses=1] %tmp.4 = seteq int %j, 0 ; <bool> [#uses=1] %shortcirc_val = select bool %tmp.1, bool true, bool %tmp.4 ; <bool> [#uses=1] ... which is later simplified by instcombine into an or. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21388 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-19Wrap some long lines.Chris Lattner1-3/+9
Make IPSCCP strip off dead constant exprs that are using functions, making them appear as though their address is taken. This allows us to propagate some more pool descriptors, lowering the overhead of pool alloc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21363 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-19Eliminate a broken transformation, fixing PR548Chris Lattner1-4/+2
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21354 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-18silence a bogus warningChris Lattner1-1/+1
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21320 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-15a new simple pass, which will be extended to be more useful in the future.Chris Lattner1-0/+213
This pass forward branches through conditions when it can show that the conditions is either always true or false for a predecessor. This currently only handles the most simple cases of this, but is successful at threading across 2489 branches and 65 switch instructions in 176.gcc, which isn't bad. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21306 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-12Get rid of this for_each loopChris Lattner1-2/+2
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21253 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-08Fix bug: InstCombine/2005-05-07-UDivSelectCrash.llChris Lattner1-14/+16
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21152 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-07Implement the following xforms:Chris Lattner1-3/+18
(X-Y)-X --> -Y A + (B - A) --> B (B - A) + A --> B git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21138 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-07Implement InstCombine/add.ll:test28, transforming C1-(X+C2) --> (C1-C2)-X.Chris Lattner1-2/+8
This occurs several dozen times in specint2k, particularly in crafty and gcc apparently. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21136 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-07Transform X-(X+Y) == -Y and X-(Y+X) == -YChris Lattner1-2/+11
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21134 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-29disable this transformation in the one obscure case that really pessimizesChris Lattner1-0/+3
pointer analysis. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20916 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-28Rename createPromoteMemoryToRegister() toAlkis Evlogimenos1-2/+1
createPromoteMemoryToRegisterPass() to be consistent with other pass creation functions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20885 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-25Enhance loopsimplify to preserve alias analysis instead of clobbering it.Chris Lattner1-2/+15
This prevents crashes on some programs when using -ds-aa -licm. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20831 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-25Fix a bug where LICM was not updating AA information properly when sinkingChris Lattner1-1/+2
a pointer value out of a loop causing it to be duplicated. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20828 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-23enable -debug-only=licmChris Lattner1-0/+1
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20788 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-17Fix the missing symbols problem Bill was hitting. Patch contributed byChris Lattner2-0/+2
Bill Wendling!! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20649 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-15stop using method.Chris Lattner1-1/+1
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20603 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-15This mega patch converts us from using Function::a{iterator|begin|end} toChris Lattner22-62/+62
using Function::arg_{iterator|begin|end}. Likewise Module::g* -> Module::global_*. This patch is contributed by Gabor Greif, thanks! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20597 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-06fix a bug where we thought arguments were constants :(Chris Lattner1-3/+7
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20506 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-06Fix Regression/Transforms/LoopStrengthReduce/dont_insert_redundant_ops.ll,Chris Lattner1-1/+1
hopefully not breaking too many other things. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20505 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-06implement Transforms/LoopStrengthReduce/invariant_value_first_arg.llChris Lattner1-1/+1
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20501 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-06minor simplifications of the code.Chris Lattner1-9/+8
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20497 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-06trivial simplificationChris Lattner1-1/+1
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20494 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-06Fix a bug where we could corrupt a parent loop's header info if we unrolledChris Lattner1-6/+17
a nested loop. This fixes Transforms/LoopUnroll/2005-03-06-BadLoopInfoUpdate.ll and PR532 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20493 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-06Make this MUCH faster by avoiding a linear search in the symbol table code.Chris Lattner1-2/+1
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20479 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-05Reformat comments to fix 80 columns.Jeff Cohen1-7/+8
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20467 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-05Reuse induction variables created for strength-reduced GEPs by other similar ↵Jeff Cohen1-32/+61
GEPs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20466 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-05second argument to Value::setName is now gone.Chris Lattner2-4/+4
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20463 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-04Do not compute 1ULL << 64, which is undefined. This fixes Ptrdist/ks on theChris Lattner1-1/+2
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 Cohen1-2/+25
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 Lattner1-6/+14
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 Cohen1-23/+19
* 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 Cohen1-3/+14
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 Cohen1-7/+6
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 Cohen1-35/+39
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 Lattner1-25/+40
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 Lattner2-2/+2
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20343 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-26remove extraneous castChris Lattner1-2/+1
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 Lattner1-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! :) 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 Lattner1-1/+1
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20289 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-22Remove use of bind_objChris Lattner1-2/+3
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 Lattner1-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 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 Lattner1-1/+1
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 Lattner1-0/+2
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 Evlogimenos1-0/+40
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 Evlogimenos1-1/+2
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19988 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-01API change.Chris Lattner1-1/+1
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19959 91177308-0d34-0410-b5e6-96231b3b80d8