summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* Don't need to include IntrinsicInst.h any moreVictor Hernandez2010-01-211-1/+0
| | | | llvm-svn: 94092
* No need to map NULL operands of metadataVictor Hernandez2010-01-211-1/+1
| | | | llvm-svn: 94091
* Re-implement the main strength-reduction portion of LoopStrengthReduction.Dan Gohman2010-01-212-2273/+2315
| | | | | | | | | | | | | | This new version is much more aggressive about doing "full" reduction in cases where it reduces register pressure, and also more aggressive about rewriting induction variables to count down (or up) to zero when doing so reduces register pressure. It currently uses fairly simplistic algorithms for finding reuse opportunities, but it introduces a new framework allows it to combine multiple strategies at once to form hybrid solutions, instead of doing all full-reduction or all base+index. llvm-svn: 94061
* Add strcpy_chk -> strcpy support for "don't know" object sizeEric Christopher2010-01-211-0/+45
| | | | | | answers. This will update as object size checking gets better information. llvm-svn: 94059
* simplify this code.Chris Lattner2010-01-201-1/+1
| | | | llvm-svn: 94048
* Move per-function inline threshold calculation to a method.Jakob Stoklund Olesen2010-01-201-14/+12
| | | | | | | No functional change except the forgotten test for InlineLimit.getNumOccurrences() == 0 in the CurrentThreshold2 calculation. llvm-svn: 94007
* Switch Elts from vector to SmallVectorVictor Hernandez2010-01-201-2/+1
| | | | llvm-svn: 93989
* Map operands of all function-local metadata, not just metadata passed to ↵Victor Hernandez2010-01-201-19/+13
| | | | | | llvm.dbg.declare intrinsics llvm-svn: 93979
* When doing address-mode sinking, expand the base register first, ratherDan Gohman2010-01-191-12/+17
| | | | | | | | | | | | than the scaled register. This makes it more likely that subsequent AddrModeMatcher queries will match the new address the same way as the old, instead of accidentally matching what had been the base register as the new scaled register, and then failing to match the scaled register. This fixes some problems with address-mode sinking multiple muls into a block, which will be a lot more common with some upcoming LoopStrengthReduction changes. llvm-svn: 93935
* optimize ~(~X >>s Y) --> (X >>s Y), patch by Edmund GrimleyChris Lattner2010-01-191-0/+5
| | | | | | Evans! llvm-svn: 93884
* Fix a crash in scalarrepl for memcpy/memmove where the source and destinationBob Wilson2010-01-191-6/+10
| | | | | | | | | are the same. I had already fixed a similar problem where the source and destination were different bitcasts derived from the same alloca, but the previous fix still did not handle the case where both operands are exactly the same value. Radar 7552893. llvm-svn: 93848
* Fix comment.Eric Christopher2010-01-191-1/+1
| | | | llvm-svn: 93831
* my instcombine transformations to make extension elimination moreChris Lattner2010-01-182-5/+32
| | | | | | | | aggressive changed the canonical form from sext(trunc(x)) to ashr(lshr(x)), make sure to transform a couple more things into that canonical form, and catch a case where we missed turning zext/shl/ashr into a single sext. llvm-svn: 93787
* While mapping llvm.dbg.declare intrinsic manually map its operand, if possible,Devang Patel2010-01-181-0/+18
| | | | | | because it points to an alloca instruction through metadata. llvm-svn: 93757
* Convert some of the dynamic opcode lookups into static ones.Owen Anderson2010-01-171-59/+40
| | | | llvm-svn: 93693
* Fix comment.Owen Anderson2010-01-171-1/+1
| | | | llvm-svn: 93679
* Fix a comment typo.Bob Wilson2010-01-151-1/+1
| | | | llvm-svn: 93560
* When the visitSub method was split into visitSub and visitFSub, this xform wasBill Wendling2010-01-131-11/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | added to the FSub version. However, the original version of this xform guarded against doing this for floating point (!Op0->getType()->isFPOrFPVector()). This is causing LLVM to perform incorrect xforms for code like: void func(double *rhi, double *rlo, double xh, double xl, double yh, double yl){ double mh, ml; double c = 134217729.0; double up, u1, u2, vp, v1, v2; up = xh*c; u1 = (xh - up) + up; u2 = xh - u1; vp = yh*c; v1 = (yh - vp) + vp; v2 = yh - v1; mh = xh*yh; ml = (((u1*v1 - mh) + (u1*v2)) + (u2*v1)) + (u2*v2); ml += xh*yl + xl*yh; *rhi = mh + ml; *rlo = (mh - (*rhi)) + ml; } The last line was optimized away, but rl is intended to be the difference between the infinitely precise result of mh + ml and after it has been rounded to double precision. llvm-svn: 93369
* 1) Use the new SimplifyInstructionsInBlock routine instead of the copyChris Lattner2010-01-121-17/+14
| | | | | | | | | | | | in JT. 2) When cloning blocks for PHI or xor conditions, use instsimplify to simplify the code as we go. This allows us to squish common cases early in JT which opens up opportunities for subsequent iterations, and allows it to completely simplify the testcase. llvm-svn: 93253
* add a helper function.Chris Lattner2010-01-121-0/+24
| | | | llvm-svn: 93251
* tidy upChris Lattner2010-01-121-5/+1
| | | | llvm-svn: 93222
* Teach jump threading to duplicate small blocks when the branchChris Lattner2010-01-121-9/+123
| | | | | | | | | | | | | | | | | | | condition is a xor with a phi node. This eliminates nonsense like this from 176.gcc in several places: LBB166_84: testl %eax, %eax - setne %al - xorb %cl, %al - notb %al - testb $1, %al - je LBB166_85 + je LBB166_69 + jmp LBB166_85 This is rdar://7391699 llvm-svn: 93221
* some cleanup, and make it obvious that ProcessJumpOnPHI only worksChris Lattner2010-01-111-24/+14
| | | | | | on branches by renaming it and checking for a branch at the call site. llvm-svn: 93208
* reenable the piece that turns trunc(zext(x)) -> x even if zext has multiple ↵Chris Lattner2010-01-111-3/+1
| | | | | | | | | uses, codegen has no apparent problem with the trunc version of this, because it turns into a simple subreg idiom llvm-svn: 93202
* Disable folding sext(trunc(x)) -> x (and other similar cast/cast cases) when ↵Chris Lattner2010-01-111-6/+14
| | | | | | | | | | | the trunc has multiple uses. Codegen is not able to coalesce the subreg case correctly and so this leads to higher register pressure and spilling (see PR5997). This speeds up 256.bzip2 from 8.60 -> 8.04s on my machine, ~7%. llvm-svn: 93200
* add one more bitfield optimization, allowing clang to generateChris Lattner2010-01-111-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | good code on PR4216: _test_bitfield: ## @test_bitfield orl $32962, %edi movl $4294941946, %eax andq %rdi, %rax ret instead of: _test_bitfield: movl $4294941696, %ecx movl %edi, %eax orl $194, %edi orl $32768, %eax andq $250, %rdi andq %rax, %rcx movq %rdi, %rax orq %rcx, %rax ret Evan is looking into the remaining andq+imm -> andl optimization. llvm-svn: 93147
* Extend CanEvaluateZExtd to handle and/or/xor more aggressively in theChris Lattner2010-01-111-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | BitsToClear case. This allows it to promote expressions which have an and/or/xor after the lshr, promoting cases like test2 (from PR4216) and test3 (random extample extracted from a spec benchmark). clang now compiles the code in PR4216 into: _test_bitfield: ## @test_bitfield movl %edi, %eax orl $194, %eax movl $4294902010, %ecx andq %rax, %rcx orl $32768, %edi andq $39936, %rdi movq %rdi, %rax orq %rcx, %rax ret instead of: _test_bitfield: ## @test_bitfield movl %edi, %eax orl $194, %eax movl $4294902010, %ecx andq %rax, %rcx shrl $8, %edi orl $128, %edi shlq $8, %rdi andq $39936, %rdi movq %rdi, %rax orq %rcx, %rax ret which is still not great, but is progress. llvm-svn: 93145
* Remove the dead TD argument to CanEvaluateZExtd, and add aChris Lattner2010-01-111-14/+57
| | | | | | | | | new BitsToClear result which allows us to start promoting expressions that end with a lshr-by-constant. This is conservatively correct and better than what we had before (see testcases) but still needs to be extended further. llvm-svn: 93144
* improve comments, remove dead TD argument to CanEvaluateSExtd.Chris Lattner2010-01-111-11/+12
| | | | llvm-svn: 93143
* teach sext optimization to handle truncs from types that are notChris Lattner2010-01-101-3/+4
| | | | | | the dest of the sext. llvm-svn: 93128
* teach zext optimization how to deal with truncs that don't come fromChris Lattner2010-01-101-12/+12
| | | | | | | | | | | | | | | | | the zext dest type. This allows us to handle test52/53 in cast.ll, and allows llvm-gcc to generate much better code for PR4216 in -m64 mode: _test_bitfield: ## @test_bitfield orl $32962, %edi movl %edi, %eax andl $-25350, %eax ret This also fixes a bug handling vector extends, ensuring that the mask produced is a vector constant, not an integer constant. llvm-svn: 93127
* simplify CanEvaluateSExtd to return a bool now that we have aChris Lattner2010-01-101-63/+22
| | | | | | simpler profitability predicate. llvm-svn: 93111
* the NumCastsRemoved argument to CanEvaluateSExtd is dead, remove it.Chris Lattner2010-01-101-26/+13
| | | | llvm-svn: 93110
* now that the cost model has changed, we can always consider Chris Lattner2010-01-101-25/+16
| | | | | | | | elimination of a sign extend to be a win, which simplifies the client of CanEvaluateSExtd, and allows us to eliminate more casts (examples taken from real code). llvm-svn: 93109
* change the preferred canonical form for a sign extension to beChris Lattner2010-01-102-23/+8
| | | | | | | | lshr+ashr instead of trunc+sext. We want to avoid type conversions whenever possible, it is easier to codegen expressions without truncates and extensions. llvm-svn: 93107
* fix indentation of switch statements, no functionality change.Chris Lattner2010-01-101-79/+79
| | | | llvm-svn: 93106
* fix pasto that broke bootstrap.Chris Lattner2010-01-101-1/+1
| | | | llvm-svn: 93105
* simplify CanEvaluateZExtd now that we don't care about the number of Chris Lattner2010-01-101-89/+23
| | | | | | | bits known clear in the result and don't care about the # casts eliminated. TD is also dead but keeping it for now. llvm-svn: 93098
* two changes: Chris Lattner2010-01-101-25/+27
| | | | | | | | | | | 1) don't try to optimize a sext or zext that is only used by a trunc, let the trunc get optimized first. This avoids some pointless effort in some common cases since instcombine scans down a block in the first pass. 2) Change the cost model for zext elimination to consider an 'and' cheaper than a zext. This allows us to do it more aggressively, and for the next patch to simplify the code quite a bit. llvm-svn: 93097
* enhance CanEvaluateZExtd to handle shift left and sext, allowingChris Lattner2010-01-101-3/+17
| | | | | | more expressions to be promoted and casts eliminated. llvm-svn: 93096
* remove an xform subsumed by EvaluateInDifferentType.Chris Lattner2010-01-101-27/+0
| | | | llvm-svn: 93095
* Fix nondeterministic behavior.Julien Lerouge2010-01-101-9/+3
| | | | llvm-svn: 93093
* clean up this xform by using m_Trunc.Chris Lattner2010-01-101-12/+9
| | | | llvm-svn: 93092
* inline and remove the rest of commonIntCastTransforms.Chris Lattner2010-01-102-18/+18
| | | | llvm-svn: 93091
* Inline the expression type promotion/demotion stuff out ofChris Lattner2010-01-101-417/+417
| | | | | | | | | commonIntCastTransforms into the callers, eliminating a switch, and allowing the static predicate methods to be moved down to live next to the corresponding function. No functionality change. llvm-svn: 93089
* only factor from expressions whose uses are empty and whoseChris Lattner2010-01-091-0/+5
| | | | | | base is the right expression type. This fixes PR5981. llvm-svn: 93045
* Fix nondeterministic behavior.Julien Lerouge2010-01-091-6/+7
| | | | llvm-svn: 93038
* Remove unnecessary dyn_cast and add a comment. Part of a WIP.Eric Christopher2010-01-081-4/+4
| | | | llvm-svn: 93026
* mplement a theoretical fixme.Chris Lattner2010-01-081-3/+7
| | | | llvm-svn: 93024
* rename CanEvaluateInDifferentType -> CanEvaluateTruncated and Chris Lattner2010-01-081-71/+28
| | | | | | simplify it now that it is only used for truncates. llvm-svn: 93021
OpenPOWER on IntegriCloud