summaryrefslogtreecommitdiff
path: root/lib/Transforms
Commit message (Collapse)AuthorAge
* This patch removes some of useless instructions generated by bitfield access.Jin-Gu Kang2011-03-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127539 91177308-0d34-0410-b5e6-96231b3b80d8
* Roll r127459 back in:Cameron Zwarich2011-03-11
| | | | | | | | | | | Optimize trivial branches in CodeGenPrepare, which often get created from the lowering of objectsize intrinsics. Unfortunately, a number of tests were relying on llc not optimizing trivial branches, so I had to add an option to allow them to continue to test what they originally tested. This fixes <rdar://problem/8785296> and <rdar://problem/9112893>. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127498 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r127459, "Optimize trivial branches in CodeGenPrepare, which often getDaniel Dunbar2011-03-11
| | | | | | created from the", it broke some GCC test suite tests. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127477 91177308-0d34-0410-b5e6-96231b3b80d8
* InstCombine: Fix a thinko where transform an icmp under the assumption that ↵Benjamin Kramer2011-03-11
| | | | | | | | it's a zero comparison when it's not. Fixes PR9454. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127464 91177308-0d34-0410-b5e6-96231b3b80d8
* Optimize trivial branches in CodeGenPrepare, which often get created from theCameron Zwarich2011-03-11
| | | | | | | | | | lowering of objectsize intrinsics. Unfortunately, a number of tests were relying on llc not optimizing trivial branches, so I had to add an option to allow them to continue to test what they originally tested. This fixes <rdar://problem/8785296> and <rdar://problem/9112893>. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127459 91177308-0d34-0410-b5e6-96231b3b80d8
* RecursivelyDeleteTriviallyDeadInstructions only needs aDan Gohman2011-03-10
| | | | | | | | | Value, not an Instruction, so casting is not necessary. Also, it's theoretically possible that the Value is not an Instruction, since WeakVH follows RAUWs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127427 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix reassociate to postpone certain instruction deletions untilDan Gohman2011-03-10
| | | | | | | | | | | after it has finished all of its reassociations, because its habit of unlinking operands and holding them in a datastructure while working means that it's not easy to determine when an instruction is really dead until after all its regular work is done. rdar://9096268. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127424 91177308-0d34-0410-b5e6-96231b3b80d8
* InstCombine: Turn umul_with_overflow into mul nuw if we can prove that it ↵Benjamin Kramer2011-03-10
| | | | | | | | | | cannot overflow. This happens a lot in clang-compiled C++ code because it adds overflow checks to operator new[]: unsigned *foo(unsigned n) { return new unsigned[n]; } We can optimize away the overflow check on 64 bit targets because (uint64_t)n*4 cannot overflow. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127418 91177308-0d34-0410-b5e6-96231b3b80d8
* Preserve line number information while simplifying libcalls.Devang Patel2011-03-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127362 91177308-0d34-0410-b5e6-96231b3b80d8
* These llvm.dbg.* constants are not used anymore.Devang Patel2011-03-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127352 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a crasher introduced by r127317 that is seen on the bots when using anCameron Zwarich2011-03-09
| | | | | | | alloca as both integer and floating-point vectors of the same size. Bugpoint is not cooperating with me, but I'll try to find a manual testcase tomorrow. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127320 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support to scalar replacement for partial vector accesses of an alloca, e.g.Cameron Zwarich2011-03-09
| | | | | | | | | | | | | | | | | a union of a float, <2 x float>, and <4 x float>. This mostly comes up with the use of vector intrinsics, especially in NEON when programmers know the layout of the register file. This enables codegen to eliminate a lot of the subregister traffic it would otherwise generate. This commit only enables this for a small number of floating-point cases, but a lot more integer cases. I assume this is okay for all ports, but I did not do extensive testing of the quality of code involving i512 vectors and the like. If there is a use case where this generates worse code than before, let me know and we can scale it back. This fixes <rdar://problem/9036264>. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127317 91177308-0d34-0410-b5e6-96231b3b80d8
* Move vector type merging to a separate function in preparation for it gettingCameron Zwarich2011-03-09
| | | | | | more complicated. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127316 91177308-0d34-0410-b5e6-96231b3b80d8
* PR9346: Prevent SimplifyDemandedBits from incorrectly introducingEli Friedman2011-03-09
| | | | | | | | INT_MIN % -1. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127306 91177308-0d34-0410-b5e6-96231b3b80d8
* PR9420; an instruction before an unreachable is guaranteed not to have anyEli Friedman2011-03-09
| | | | | | | | | | reachable uses, but there still might be uses in dead blocks. Use the standard solution of replacing all the uses with undef. This is a rare case because it's very sensitive to phase ordering in SimplifyCFG. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127299 91177308-0d34-0410-b5e6-96231b3b80d8
* llvm.dbg.declare intrinsic does not use any llvm::Values. It's magic!Devang Patel2011-03-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127282 91177308-0d34-0410-b5e6-96231b3b80d8
* Reorder comments to put them the right way around.Nick Lewycky2011-03-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127220 91177308-0d34-0410-b5e6-96231b3b80d8
* While sinking an instruction, do not lose llvm.dbg.value intrinsic.Devang Patel2011-03-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127214 91177308-0d34-0410-b5e6-96231b3b80d8
* Preserve line no. info.Devang Patel2011-03-07
| | | | | | | Radar 9097659 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127182 91177308-0d34-0410-b5e6-96231b3b80d8
* Add more analysis of the sign bit of an srem instruction. If the LHS is negativeNick Lewycky2011-03-07
| | | | | | | | then the result could go either way. If it's provably positive then so is the srem. Fixes PR9343 #7! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127146 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't internalize available_externally functions. We already did the rightRafael Espindola2011-03-06
| | | | | | thing for variables. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127138 91177308-0d34-0410-b5e6-96231b3b80d8
* ConstantInt has some getters which return ConstantInt's or ConstantVector's ofNick Lewycky2011-03-06
| | | | | | | | | the value splatted into every element. Extend this to getTrue and getFalse which by providing new overloads that take Types that are either i1 or <N x i1>. Use it in InstCombine to add vector support to some code, fixing PR8469! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127116 91177308-0d34-0410-b5e6-96231b3b80d8
* InstCombine: We know the number of items initially added to the worklist ↵Benjamin Kramer2011-03-05
| | | | | | map, reserve space early to avoid rehashing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127089 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR9398 - 10% of llc compile time is spent in Value::getNumUses. This reducesCameron Zwarich2011-03-05
| | | | | | | the percentage of time spent in CodeGenPrepare when llcing 403.gcc from 12.6% to 1.8% of total llc time. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127069 91177308-0d34-0410-b5e6-96231b3b80d8
* Thread comparisons over udiv/sdiv/ashr/lshr exact and lshr nuw/nsw wheneverNick Lewycky2011-03-05
| | | | | | | | | | possible. This goes into instcombine and instsimplify because instsimplify doesn't need to check hasOneUse since it returns (almost exclusively) constants. This fixes PR9343 #4 #5 and #8! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127064 91177308-0d34-0410-b5e6-96231b3b80d8
* Try once again to optimize "icmp (srem X, Y), Y" by turning the comparison intoNick Lewycky2011-03-05
| | | | | | | true/false or "icmp slt/sge Y, 0". git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127063 91177308-0d34-0410-b5e6-96231b3b80d8
* DenseMap<uintptr_t,...> doesn't allow all values as keys.Jakob Stoklund Olesen2011-03-04
| | | | | | | Avoid colliding with the sentinels, hopefully unbreaking llvm-gcc-x86_64-linux-selfhost. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126982 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix typo in comment.Richard Osborne2011-03-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126941 91177308-0d34-0410-b5e6-96231b3b80d8
* Optimize fprintf -> iprintf if there are no floating point argumentsRichard Osborne2011-03-03
| | | | | | | | and siprintf is available on the target. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126940 91177308-0d34-0410-b5e6-96231b3b80d8
* Optimize sprintf -> siprintf if there are no floating point argumentsRichard Osborne2011-03-03
| | | | | | | | and siprintf is available on the target. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126937 91177308-0d34-0410-b5e6-96231b3b80d8
* Optimize printf -> iprintf if there are no floating point argumentsRichard Osborne2011-03-03
| | | | | | | | and iprintf is available on the target. Currently iprintf is only marked as being available on the XCore. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126935 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove some more unused code that I missed.Cameron Zwarich2011-03-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126826 91177308-0d34-0410-b5e6-96231b3b80d8
* Eliminate the unused CodeGenPrepare option to split critical edges.Cameron Zwarich2011-03-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126825 91177308-0d34-0410-b5e6-96231b3b80d8
* Stop computing the number of uses twice per value in CodeGenPrepare's sinking ofCameron Zwarich2011-03-01
| | | | | | | | addressing code. On 403.gcc this almost halves CodeGenPrepare time and reduces total llc time by 9.5%. Unfortunately, getNumUses() is still the hottest function in llc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126782 91177308-0d34-0410-b5e6-96231b3b80d8
* Make InstCombiner::FoldAndOfICmps create a ConstantRange that's theAnders Carlsson2011-03-01
| | | | | | | | | | intersection of the LHS and RHS ConstantRanges and return "false" when the range is empty. This simplifies some code and catches some extra cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126744 91177308-0d34-0410-b5e6-96231b3b80d8
* Add an obvious missing safety check to DAE::RemoveDeadArgumentsFromCallers.Eli Friedman2011-03-01
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126720 91177308-0d34-0410-b5e6-96231b3b80d8
* Unbreak CMake build.Ted Kremenek2011-02-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126715 91177308-0d34-0410-b5e6-96231b3b80d8
* update cmakeChris Lattner2011-02-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126694 91177308-0d34-0410-b5e6-96231b3b80d8
* Delete the GEPSplitter experiment.Dan Gohman2011-02-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126671 91177308-0d34-0410-b5e6-96231b3b80d8
* Delete the SimplifyHalfPowrLibCalls pass, which was unused, andDan Gohman2011-02-28
| | | | | | | only existed as the result of a misunderstanding. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126669 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach SimplifyCFG that (switch (select cond, X, Y)) is better expressed as a ↵Frits van Bommel2011-02-28
| | | | | | | | | branch. Based on a patch by Alistair Lynn. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126647 91177308-0d34-0410-b5e6-96231b3b80d8
* srem doesn't actually have the same resulting sign as its numerator, you couldNick Lewycky2011-02-28
| | | | | | | | also have a zero when numerator = denominator. Reverts parts of r126635 and r126637. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126644 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach InstCombine to fold "(shr exact X, Y) == 0" --> X == 0, fixing #1 fromNick Lewycky2011-02-28
| | | | | | | PR9343. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126643 91177308-0d34-0410-b5e6-96231b3b80d8
* The sign of an srem instruction is the sign of its dividend (the firstNick Lewycky2011-02-28
| | | | | | | | argument), regardless of the divisor. Teach instcombine about this and fix test7 in PR9343! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126635 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "SimplifyCFG: GEPs with just one non-constant index are also cheap."Benjamin Kramer2011-02-25
| | | | | | | Yes, there are other types than i8* and GEPs on them can produce an add+multiply. We don't consider that cheap enough to be speculatively executed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126481 91177308-0d34-0410-b5e6-96231b3b80d8
* SimplifyCFG: GEPs with just one non-constant index are also cheap.Benjamin Kramer2011-02-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126452 91177308-0d34-0410-b5e6-96231b3b80d8
* SimplifyCFG: GEPs with constant indices are cheap enough to be executed ↵Benjamin Kramer2011-02-24
| | | | | | unconditionally. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126445 91177308-0d34-0410-b5e6-96231b3b80d8
* Do not use DIFactory. Use DIBuilder.Devang Patel2011-02-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126398 91177308-0d34-0410-b5e6-96231b3b80d8
* wire TargetLibraryInfo into simplify libcalls and use it in a couple ofChris Lattner2011-02-24
| | | | | | | trivial places. This pass needs a lot of work. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126367 91177308-0d34-0410-b5e6-96231b3b80d8
* move a massive amount of code out into its own helper functionChris Lattner2011-02-24
| | | | | | | to reduce nesting. This needs to be turned into a table. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126366 91177308-0d34-0410-b5e6-96231b3b80d8