aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Scalar
Commit message (Collapse)AuthorAgeFilesLines
* Added recognition for signed add/sub/mul with overflow intrinsics to GVN as ↵Lang Hames2011-07-091-0/+3
| | | | | | per Chris and Frits suggestion. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134777 91177308-0d34-0410-b5e6-96231b3b80d8
* Make GVN look through extractvalues for recognised intrinsics. GVN can then ↵Lang Hames2011-07-081-7/+54
| | | | | | CSE ops that match values produced by the intrinsics. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134677 91177308-0d34-0410-b5e6-96231b3b80d8
* Use DBG_VALUE location while inserting DBG_VALUE during alloca promotion.Devang Patel2011-07-071-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134568 91177308-0d34-0410-b5e6-96231b3b80d8
* Handle cases where multiple dbg.declare and dbg.value intrinsics are tied to ↵Devang Patel2011-07-061-11/+58
| | | | | | one alloca. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134549 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify. Consolidate dbg.declare handling in AllocaPromoter.Devang Patel2011-07-062-14/+19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134538 91177308-0d34-0410-b5e6-96231b3b80d8
* indvars -disable-iv-rewrite: ExprToMap lives in Pass data, so be moreAndrew Trick2011-07-061-1/+2
| | | | | | | careful about referencing values. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134537 91177308-0d34-0410-b5e6-96231b3b80d8
* indvars -disable-iv-rewrite: Added SimplifyCongruentIVs.Andrew Trick2011-07-061-1/+58
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134530 91177308-0d34-0410-b5e6-96231b3b80d8
* LICM: Remove trailing white spacesTobias Grosser2011-07-061-32/+32
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134521 91177308-0d34-0410-b5e6-96231b3b80d8
* LICM: Do not loose alignment on promotionTobias Grosser2011-07-061-8/+30
| | | | | | | | The promotion code lost any alignment information, when hoisting loads and stores out of the loop. This lead to incorrect aligned memory accesses. We now use the largest alignment we can prove to be correct. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134520 91177308-0d34-0410-b5e6-96231b3b80d8
* Introduce "expect" intrinsic instructions.Jakub Staszak2011-07-061-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134516 91177308-0d34-0410-b5e6-96231b3b80d8
* Preserve debug loc.Devang Patel2011-07-051-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134441 91177308-0d34-0410-b5e6-96231b3b80d8
* indvars -disable-iv-rewrite: avoid multiple IVs in weird cases.Andrew Trick2011-07-051-18/+30
| | | | | | | Putting back the helper that I removed on 7/1 to do this right. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134423 91177308-0d34-0410-b5e6-96231b3b80d8
* indvars -disable-iv-rewrite: bug fix involving weird geps and related cleanup.Andrew Trick2011-07-021-46/+51
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134306 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix likely typo, reduce number of instruction name collisions.Nick Lewycky2011-07-011-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134235 91177308-0d34-0410-b5e6-96231b3b80d8
* indvars -disable-iv-rewrite: handle cloning binary operators that cannot ↵Andrew Trick2011-06-301-3/+7
| | | | | | overflow. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134177 91177308-0d34-0410-b5e6-96231b3b80d8
* indvars -disable-iv-rewrite: handle an edge case involving identity phis.Andrew Trick2011-06-301-3/+8
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134124 91177308-0d34-0410-b5e6-96231b3b80d8
* indvars -disable-iv-rewrite: insert new trunc instructions carefully.Andrew Trick2011-06-291-13/+21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134112 91177308-0d34-0410-b5e6-96231b3b80d8
* indvars -disable-iv-rewrite: just because SCEV ignores casts doesn'tAndrew Trick2011-06-291-0/+1
| | | | | | | mean they can be removed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134054 91177308-0d34-0410-b5e6-96231b3b80d8
* cleanup: misleading comment.Andrew Trick2011-06-281-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134010 91177308-0d34-0410-b5e6-96231b3b80d8
* SCEVExpander: give new insts a name that identifies the reponsible pass.Andrew Trick2011-06-283-4/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133992 91177308-0d34-0410-b5e6-96231b3b80d8
* whitespaceAndrew Trick2011-06-281-8/+8
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133991 91177308-0d34-0410-b5e6-96231b3b80d8
* indvars --disable-iv-rewrite: sever ties with IVUsers.Andrew Trick2011-06-281-6/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133988 91177308-0d34-0410-b5e6-96231b3b80d8
* indvars --disable-iv-rewrite: Defer evaluating s/zext until SCEVAndrew Trick2011-06-281-40/+57
| | | | | | | evaluates all other IV exprs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133982 91177308-0d34-0410-b5e6-96231b3b80d8
* indvars -disable-iv-rewrite: run RLEV after SimplifyIVUsers forAndrew Trick2011-06-271-4/+6
| | | | | | | a bit more control over the order SCEVs are evaluated. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133959 91177308-0d34-0410-b5e6-96231b3b80d8
* Calculate GetBestDestForJumpOnUndef correctly.Jakub Staszak2011-06-271-1/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133946 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach one piece of scalarrepl to handle lifetime markers. When transforming anNick Lewycky2011-06-271-13/+37
| | | | | | | | | alloca that only holds a copy of a global and we're going to replace the users of the alloca with that global, just nuke the lifetime intrinsics. Part of PR10121. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133905 91177308-0d34-0410-b5e6-96231b3b80d8
* Reinstate r133513 (reverted in r133700) with an additional fix for aJay Foad2011-06-231-4/+4
| | | | | | | -Wshorten-64-to-32 warning in Instructions.h. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133708 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r133513:Eric Christopher2011-06-231-4/+4
| | | | | | | | | | | "Reinstate r133435 and r133449 (reverted in r133499) now that the clang self-hosted build failure has been fixed (r133512)." Due to some additional warnings. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133700 91177308-0d34-0410-b5e6-96231b3b80d8
* 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
* 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
* Reinstate r133435 and r133449 (reverted in r133499) now that the clangJay Foad2011-06-211-4/+4
| | | | | | 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-211-4/+4
| | | | 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-201-4/+4
| | | | | | | | | | | | | | | | | | | | 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
* 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
* 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
* 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
* 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