aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* Re-apply the patch to improve the optimizations of memcpy's, with severalOwen Anderson2008-02-121-1/+79
| | | | | | | bugs fixed. This now passes PPC bootstrap. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47026 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix for bug 1996: optimize out loads of undef. This code basically just Eli Friedman2008-02-121-1/+28
| | | | | | | checks for a malloc/alloca immediately followed by a load. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47006 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix scalarrepl to not 'miscompile' undefined code, part #2.Chris Lattner2008-02-101-1/+1
| | | | | | | | This fixes the store case, my previous patch just fixed the load case. rdar://5707076. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46932 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR 1995.Devang Patel2008-02-081-21/+17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46898 91177308-0d34-0410-b5e6-96231b3b80d8
* Temporarily reverting:Bill Wendling2008-02-061-82/+0
| | | | | | | | | http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20080128/057882.html This is causing a miscompilation on PPC G5 and just now seeing it on iMac x86-64. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46822 91177308-0d34-0410-b5e6-96231b3b80d8
* Make RenamePass faster by making the 'is this a new phi node'Chris Lattner2008-02-051-11/+11
| | | | | | | | | check more intelligent. This speeds up mem2reg from 5.29s to 0.79s on a synthetic testcase with tons of predecessors and phi nodes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46767 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a bug compiling PR1978 (perhaps not the only one though) whichChris Lattner2008-02-051-54/+5
| | | | | | | | | | | was incorrectly simplifying "x == (gep x, 1, i)" into false, even though i could be negative. As it turns out, all the code to handle this already existed, we just need to disable the incorrect optimization case and let the general case handle it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46739 91177308-0d34-0410-b5e6-96231b3b80d8
* Be more precise when eliminating pointers bue to memcpy's. This allows moreOwen Anderson2008-02-041-4/+10
| | | | | | | stores to be deleted in some cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46694 91177308-0d34-0410-b5e6-96231b3b80d8
* Allow GVN to hack on memcpy's, making them open to further optimization.Owen Anderson2008-02-041-0/+82
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46693 91177308-0d34-0410-b5e6-96231b3b80d8
* There are some cases where icmp(add) can be folded into a new icmp. Handle them.Nick Lewycky2008-02-031-0/+32
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46687 91177308-0d34-0410-b5e6-96231b3b80d8
* Hack on vectors too.Nick Lewycky2008-02-031-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46684 91177308-0d34-0410-b5e6-96231b3b80d8
* Fold away one multiply in instcombine. This would normally be caught inNick Lewycky2008-02-031-0/+24
| | | | | | | reassociate anyways, but they could be generated during instcombine's run. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46683 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't drop function/call return attributes like 'nounwind'.Duncan Sands2008-02-011-0/+8
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46645 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove a couple more cases of "getNumUses() == 0". No need to walk the linkedNick Lewycky2008-01-301-2/+2
| | | | | | | list just to see if whether the list is empty. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46555 91177308-0d34-0410-b5e6-96231b3b80d8
* Use empty() instead of comparing size() with zero.Nick Lewycky2008-01-301-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46554 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't DCE FreeInst's. We were using those! Patch from Owen Anderson.Nick Lewycky2008-01-301-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46553 91177308-0d34-0410-b5e6-96231b3b80d8
* Make DSE much more aggressive by performing DCE earlier. Update a testcase ↵Owen Anderson2008-01-301-2/+55
| | | | | | to reflect this increased aggressiveness. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46542 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a bug where scalarrepl would discard offset if type would match.Chris Lattner2008-01-301-2/+2
| | | | | | | | In practice this can only happen on code with already undefined behavior, but this is still a good thing to handle correctly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46539 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't let globalopt hack on volatile loads or stores.Chris Lattner2008-01-291-1/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46523 91177308-0d34-0410-b5e6-96231b3b80d8
* Use empty() instead of comparing size() with zero.Dan Gohman2008-01-294-4/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46514 91177308-0d34-0410-b5e6-96231b3b80d8
* eliminate additions of 0.0 when they are obviously dead. This has to be ↵Chris Lattner2008-01-291-0/+47
| | | | | | | | | careful to avoid turning -0.0 + 0.0 -> -0.0 which is incorrect. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46499 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for eliminating memcpy's at the end of functions. Also fix some ↵Owen Anderson2008-01-291-26/+63
| | | | | | | | | errors I noticed in the handling of eliminating stores to byval arguments. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46494 91177308-0d34-0410-b5e6-96231b3b80d8
* Filter loops that subtract induction variables.Devang Patel2008-01-291-17/+17
| | | | | | | | | These loops are not yet handled. Fix PR 1912. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46484 91177308-0d34-0410-b5e6-96231b3b80d8
* Transform calls to memcpy into llvm.memcpy calls, patch by Eli Friedman.Chris Lattner2008-01-281-0/+30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46433 91177308-0d34-0410-b5e6-96231b3b80d8
* Handle some more combinations of extend and icmp. Fixes PR1940.Nick Lewycky2008-01-281-8/+12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46431 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR1932 by disabling an xform invalid for fdiv.Chris Lattner2008-01-281-9/+10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46429 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR1938 by forcing the code that uses an undefined value to branch oneChris Lattner2008-01-281-4/+19
| | | | | | | | | way or the other. Rewriting the code itself prevents subsequent analysis passes from making contradictory conclusions about the code that could cause an infeasible path to be made feasible. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46427 91177308-0d34-0410-b5e6-96231b3b80d8
* Be more careful modifying the use_list while also iterating through it.Nick Lewycky2008-01-271-1/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46417 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r46393: readonly/readnone functions are noDuncan Sands2008-01-271-9/+6
| | | | | | | longer allowed to write through byval arguments. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46416 91177308-0d34-0410-b5e6-96231b3b80d8
* The CorrelatedExpressionElimination pass is known to be buggy. Remove it.Bill Wendling2008-01-271-1486/+0
| | | | | | | This fixes PR1769. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46408 91177308-0d34-0410-b5e6-96231b3b80d8
* Fold fptrunc(add (fpextend x), (fpextend y)) -> add(x,y), as GCC does.Chris Lattner2008-01-271-3/+75
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46406 91177308-0d34-0410-b5e6-96231b3b80d8
* If there are no machine instructions emitted for a function, then insertBill Wendling2008-01-261-14/+1
| | | | | | | | | a "nop" instruction so that we don't have the function's label associated with something that it's not supposed to be associated with. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46394 91177308-0d34-0410-b5e6-96231b3b80d8
* Create an explicit copy for byval parameters evenDuncan Sands2008-01-261-6/+9
| | | | | | | when inlining a readonly function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46393 91177308-0d34-0410-b5e6-96231b3b80d8
* If we have a function like this:Bill Wendling2008-01-261-1/+14
| | | | | | | | | | | | | | | | | | | | | | | void bork() { int *address = 0; *address = 0; } It's compiled into LLVM code that looks like this: define void @bork() noreturn nounwind { entry: unreachable } This is bad on some platforms (like PPC) because it will generate the label for the function but no body. The label could end up being associated with some non-code related stuff, like a section. This places a "trap" instruction if the SimplifyCFG pass removed all code from the function leaving only one "unreachable" instruction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46387 91177308-0d34-0410-b5e6-96231b3b80d8
* Do this more neatly.Duncan Sands2008-01-251-2/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46369 91177308-0d34-0410-b5e6-96231b3b80d8
* DeadStoreElimination can treat byval parameters as if there were alloca's ↵Owen Anderson2008-01-251-5/+6
| | | | | | for the purpose of removing end-of-function stores. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46351 91177308-0d34-0410-b5e6-96231b3b80d8
* Enable the fix I just checked in, silly me.Nick Lewycky2008-01-221-1/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46247 91177308-0d34-0410-b5e6-96231b3b80d8
* Multiply can be evaluated in a different type, so long as the target type hasNick Lewycky2008-01-221-0/+10
| | | | | | | a smaller bitwidth. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46244 91177308-0d34-0410-b5e6-96231b3b80d8
* Make sure the caller doesn't use freed memory.Duncan Sands2008-01-201-1/+3
| | | | | | | Fixes PR1935. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46203 91177308-0d34-0410-b5e6-96231b3b80d8
* Initializing an unsigned with ~0UL causes the compilerDuncan Sands2008-01-201-9/+9
| | | | | | | to complain on x86-64 (gcc 4.1). Use ~0U instead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46197 91177308-0d34-0410-b5e6-96231b3b80d8
* DAE bug fix. Don't lose parameter attributes on vararg arguments.Evan Cheng2008-01-171-5/+9
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46113 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix arg promotion to propagate the correct attrs on the calls toChris Lattner2008-01-171-14/+25
| | | | | | | | promoted functions. This is important for varargs calls in particular. Thanks to duncan for providing a great testcase. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46108 91177308-0d34-0410-b5e6-96231b3b80d8
* Handle attribute(used) global variables that are i8.Chris Lattner2008-01-161-14/+13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46090 91177308-0d34-0410-b5e6-96231b3b80d8
* Do not strip llvm.used values.Devang Patel2008-01-161-3/+25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46045 91177308-0d34-0410-b5e6-96231b3b80d8
* I noticed that the trampoline straightening transformation couldDuncan Sands2008-01-141-21/+28
| | | | | | | | | | drop attributes on varargs call arguments. Also, it could generate invalid IR if the transformed call already had the 'nest' attribute somewhere (this can never happen for code coming from llvm-gcc, but it's a theoretical possibility). Fix both problems. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45973 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix the miscompilation of MiBench/consumer-lame that was exposed by Evan'sChris Lattner2008-01-141-59/+97
| | | | | | | | byval work. This miscompilation is due to the program indexing an array out of range and us doing a transformation that broke this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45949 91177308-0d34-0410-b5e6-96231b3b80d8
* The isNotSuitableForSRA property is now dead, don't compute it.Chris Lattner2008-01-141-45/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45948 91177308-0d34-0410-b5e6-96231b3b80d8
* Change SRAGlobal to not depend on isNotSuitableForSRA, which makes it very Chris Lattner2008-01-141-2/+75
| | | | | | | difficult to understand the invariants. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45947 91177308-0d34-0410-b5e6-96231b3b80d8
* Make the 'shrink global to bool' optimization more self contained, and thus Chris Lattner2008-01-141-10/+25
| | | | | | | easier to show that its safe. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45946 91177308-0d34-0410-b5e6-96231b3b80d8
* Turn a memcpy from a double* into a load/store of double instead ofChris Lattner2008-01-141-9/+46
| | | | | | | | | | | a load/store of i64. The later prevents promotion/scalarrepl of the source and dest in many cases. This fixes the 300% performance regression of the byval stuff on stepanov_v1p2. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45945 91177308-0d34-0410-b5e6-96231b3b80d8