aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* Set debug loc.Devang Patel2011-06-221-0/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133636 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace the existing forms of ConstantArray::get() with a single formJay Foad2011-06-221-2/+2
| | | | | | that takes an ArrayRef. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133615 91177308-0d34-0410-b5e6-96231b3b80d8
* IVUsers no longer needs to record the phis.Andrew Trick2011-06-212-12/+8
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133518 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unused variables.Benjamin Kramer2011-06-211-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133514 91177308-0d34-0410-b5e6-96231b3b80d8
* Reinstate r133435 and r133449 (reverted in r133499) now that the clangJay Foad2011-06-218-91/+95
| | | | | | self-hosted build failure has been fixed (r133512). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133513 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't use PN->replaceUsesOfWith() to change a PHINode's incoming blocks,Jay Foad2011-06-211-1/+3
| | | | | | | because it won't work after my phi operand changes, because the incoming blocks will no longer be Uses. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133512 91177308-0d34-0410-b5e6-96231b3b80d8
* indvars -disable-iv-rewrite: Adds support for eliminating identityAndrew Trick2011-06-211-100/+237
| | | | | | | | | | | | | | | | | | | | ops. This is a rewrite of the IV simplification algorithm used by -disable-iv-rewrite. To avoid perturbing the default mode, I temporarily split the driver and created SimplifyIVUsersNoRewrite. The idea is to avoid doing opcode/pattern matching inside IndVarSimplify. SCEV already does it. We want to optimize with the full generality of SCEV, but optimize def-use chains top down on-demand rather than rewriting the entire expression bottom-up. This was easy to do for operations that SCEV can prove are identity function. So we're now eliminating bitmasks and zero extends this way. A result of this rewrite is that indvars -disable-iv-rewrite no longer requires IVUsers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133502 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r133435 and r133449 to appease buildbots.Chad Rosier2011-06-218-95/+91
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133499 91177308-0d34-0410-b5e6-96231b3b80d8
* Completely short-circuit out ARC optimization if the ARC runtimeDan Gohman2011-06-201-4/+62
| | | | | | | functions do not appear in the module. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133478 91177308-0d34-0410-b5e6-96231b3b80d8
* Change how PHINodes store their operands.Jay Foad2011-06-208-91/+95
| | | | | | | | | | | | | | | | | | | | Change PHINodes to store simple pointers to their incoming basic blocks, instead of full-blown Uses. Note that this loses an optimization in SplitCriticalEdge(), because we can no longer walk the use list of a BasicBlock to find phi nodes. See the comment I removed starting "However, the foreach loop is slow for blocks with lots of predecessors". Extend replaceAllUsesWith() on a BasicBlock to also update any phi nodes in the block's successors. This mimics what would have happened when PHINodes were proper Users of their incoming blocks. (Note that this only works if OldBB->replaceAllUsesWith(NewBB) is called when OldBB still has a terminator instruction, so it still has some successors.) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133435 91177308-0d34-0410-b5e6-96231b3b80d8
* Make better use of the PHINode API.Jay Foad2011-06-202-5/+10
| | | | | | | | | Change various bits of code to make better use of the existing PHINode API, to insulate them from forthcoming changes in how PHINodes store their operands. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133434 91177308-0d34-0410-b5e6-96231b3b80d8
* Revamp the "ConstantStruct::get" methods. Previously, these were scatteredChris Lattner2011-06-203-46/+52
| | | | | | | | | | | | | | | | | all over the place in different styles and variants. Standardize on two preferred entrypoints: one that takes a StructType and ArrayRef, and one that takes StructType and varargs. In cases where there isn't a struct type convenient, we now add a ConstantStruct::getAnon method (whose name will make more sense after a few more patches land). It would be "really really nice" if the ConstantStruct::get and ConstantVector::get methods didn't make temporary std::vectors. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133412 91177308-0d34-0410-b5e6-96231b3b80d8
* fix the varargs version of StructType::get to not require an LLVMContext, ↵Chris Lattner2011-06-181-1/+1
| | | | | | | | | making usage much cleaner. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133364 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR10103: Less code for enum type translation.Hans Wennborg2011-06-181-0/+74
| | | | | | | | | | | In cases such as the attached test, where the case value for a switch destination is used in a phi node that follows the destination, it might be better to replace that value with the condition value of the switch, so that more blocks can be folded away with TryToSimplifyUncondBranchFromEmptyBlock because there are less conflicts in the phi node. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133344 91177308-0d34-0410-b5e6-96231b3b80d8
* When scalar replacement returns a vector type, only accept it if the vectorCameron Zwarich2011-06-181-0/+5
| | | | | | | | | | | | type's bitwidth matches the (allocated) size of the alloca. This severely pessimizes vector scalar replacement when the only vector type being used is something like <3 x float> on x86 or ARM whose allocated size matches a <4 x float>. I hope to fix some of the flawed assumptions about allocated size throughout scalar replacement and reenable this in most cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133338 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix an invalid bitcast crash that occurs when doing a partial memset of a vectorCameron Zwarich2011-06-181-3/+15
| | | | | | alloca. Fixes part of <rdar://problem/9580800>. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133336 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove a pointless assignment. Nothing checks the value of VectorTy anymore nowCameron Zwarich2011-06-181-1/+0
| | | | | | unless ScalarKind is Vector. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133335 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r133285. Causing odd failures on Dragonegg.Chad Rosier2011-06-171-4/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133301 91177308-0d34-0410-b5e6-96231b3b80d8
* Set debug loc for new preheader's terminator.Devang Patel2011-06-171-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133298 91177308-0d34-0410-b5e6-96231b3b80d8
* Relocate NUW test to cover all binary ops in a dynamic alloca expr.Stuart Hastings2011-06-171-5/+4
| | | | | | | Followup to 132926. rdar://problem/9265821 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133285 91177308-0d34-0410-b5e6-96231b3b80d8
* When promoting an alloca to registers discard any lifetime intrinsics.Nick Lewycky2011-06-171-0/+59
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133251 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix ARCOpt to insert releases on both successors of an invoke ratherDan Gohman2011-06-161-10/+27
| | | | | | | than trying to insert them immediately after the invoke. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133188 91177308-0d34-0410-b5e6-96231b3b80d8
* The ARC language-specific optimizer. Credit to Dan Gohman.John McCall2011-06-153-0/+3525
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133108 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify; no significant functionality change.Eli Friedman2011-06-151-26/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133086 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix cmake build.Rafael Espindola2011-06-151-1/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133085 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unused code.Eli Friedman2011-06-151-128/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133078 91177308-0d34-0410-b5e6-96231b3b80d8
* Stop using memdep for a check that didn't really make sense with memdep. In ↵Eli Friedman2011-06-151-11/+9
| | | | | | terms of specific issues, using memdep here checks irrelevant instructions and won't work properly once we start returning "unknown" more aggressively from memdep. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133035 91177308-0d34-0410-b5e6-96231b3b80d8
* Add "unknown" results for memdep, which mean "I don't know whether a ↵Eli Friedman2011-06-153-22/+37
| | | | | | dependence for the given instruction exists in the given block". This cleans up all the existing hacks in memdep which represent this concept by returning clobber with various unrelated instructions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133031 91177308-0d34-0410-b5e6-96231b3b80d8
* Be more obvious about what is being tested.Cameron Zwarich2011-06-141-1/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132982 91177308-0d34-0410-b5e6-96231b3b80d8
* Use IRBuilder to make our intrinsic calls in the inliner so that we pick upJohn McCall2011-06-141-10/+9
| | | | | | | | line info correctly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132961 91177308-0d34-0410-b5e6-96231b3b80d8
* Use Value::stripPointerCasts instead of reinventing part of the wheel.Nick Lewycky2011-06-141-6/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132954 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix grammar.Cameron Zwarich2011-06-131-3/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132952 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename MergeInType to MergeInTypeForLoadOrStore.Cameron Zwarich2011-06-131-8/+10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132940 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove the HadAVector instance variable and replace it with a use of ScalarKind.Cameron Zwarich2011-06-131-15/+26
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132939 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove a vacuous check.Cameron Zwarich2011-06-131-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132938 91177308-0d34-0410-b5e6-96231b3b80d8
* Have SRoA explicitly track the kind of scalar it is promoting. This is prettyCameron Zwarich2011-06-131-10/+21
| | | | | | | | spartan right now, but I plan to encode more information in this enum to improve the correctness and reliability of SRoA. At least this first pass makes it possible to make VectorTy an actual VectorType. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132937 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove an argument that is always true.Cameron Zwarich2011-06-131-6/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132936 91177308-0d34-0410-b5e6-96231b3b80d8
* Avoid fusing bitcasts with dynamic allocas if the amount-to-allocateStuart Hastings2011-06-131-0/+5
| | | | | | | | | might overflow. Re-typing the alloca to a larger type (e.g. double) hoists a shift into the alloca, potentially exposing overflow in the expression. rdar://problem/9265821 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132926 91177308-0d34-0410-b5e6-96231b3b80d8
* InstCombine: Fold A-b == C --> b == A-C if A and C are constants.Benjamin Kramer2011-06-131-7/+16
| | | | | | The backend already knew this trick. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132915 91177308-0d34-0410-b5e6-96231b3b80d8
* It's possible that an all-zero GEP may be used as the argument to lifetimeNick Lewycky2011-06-131-2/+6
| | | | | | | | | | intrinsics. In fact, we'll optimize a bitcast to that when possible. Detect it when looking for the lifetime intrinsics. No test case, noticed by inspection. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132906 91177308-0d34-0410-b5e6-96231b3b80d8
* InstCombine: Shrink ((zext X) & C1) == C2 to fold away the cast if the ↵Benjamin Kramer2011-06-121-1/+17
| | | | | | "zext" and the "and" have one use. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132897 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify code. No functionality changes, name changes aside.Benjamin Kramer2011-06-121-11/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132896 91177308-0d34-0410-b5e6-96231b3b80d8
* When deleting a basic block, remove call edges only for non-intrinsics.John McCall2011-06-091-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132803 91177308-0d34-0410-b5e6-96231b3b80d8
* SplitCriticalEdge can sometimes split the edge from an invoke to a landingJohn McCall2011-06-091-28/+184
| | | | | | | | | | | | | | pad, separating the exception and selector calls from the new lpad. Teaching it not to do that, or to properly adjust the CFG afterwards, is out of scope because it would require the other edges to the landing pad to be split as well (effectively). Instead, just recover from the most likely cases during inlining. The best long-term solution is to change the exception representation and commit to either requiring or not requiring the more complex edge-splitting logic; this is just a shorter-term hack. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132799 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach the CallGraph to ignore calls to intrinsics.John McCall2011-06-091-41/+7
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132797 91177308-0d34-0410-b5e6-96231b3b80d8
* Improve the handling of available_externally and llvm.global_ctors.Rafael Espindola2011-06-091-4/+16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132775 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove a vacuous condition.Cameron Zwarich2011-06-091-3/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132767 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR10104 by adding a bounds check on a vector element access check. It wasCameron Zwarich2011-06-091-1/+4
| | | | | | | | assuming that all offsets are legal vector accesses, and thus trying to access the float member of { <2 x float>, float } as the 3rd element of the first member. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132766 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix an assymmetry between ConvertScalar_ExtractValue and ↵Cameron Zwarich2011-06-081-3/+4
| | | | | | | | | | ConvertScalar_InsertValue. The former was using the size of the entire alloca, whereas the latter was correctly using the allocated size of the immediate type being converted (which may differ from the size of the alloca). This fixes PR10082. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132759 91177308-0d34-0410-b5e6-96231b3b80d8
* If the block that we're threading through is jumped to by an indirect branch,Bill Wendling2011-06-041-1/+3
| | | | | | | | | | | | | then we don't want to set the destination in the indirect branch to the destination. This is because the indirect branch needs its destinations to have had their block addresses taken. This isn't so of the new critical edge that's split during this process. If it turns out that the destination block has only one predecessor, and that being a BB with an indirect branch, then it won't be marked as 'used' and may be removed. PR10072 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132638 91177308-0d34-0410-b5e6-96231b3b80d8