summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* 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
* teach instcombine to delete sign extending shift pairs (sra(shl X, C), C) whenChris Lattner2010-01-081-4/+15
| | | | | | the input is already sign extended. llvm-svn: 93019
* Suppress an unused variable warning when assertions are off;Duncan Sands2010-01-081-2/+3
| | | | | | remove some trailing whitespace while there. llvm-svn: 93008
* tidy up some stuff duncan pointed out.Chris Lattner2010-01-081-2/+3
| | | | llvm-svn: 93007
* teach ComputeNumSignBits to look through PHI nodes.Chris Lattner2010-01-071-3/+0
| | | | llvm-svn: 92964
* Enhance instcombine to reason more strongly about promoting computationChris Lattner2010-01-071-51/+144
| | | | | | | that feeds into a zext, similar to the patch I did yesterday for sext. There is a lot of room for extension beyond this patch. llvm-svn: 92962
* Use a do-while loop instead of while + boolean.Benjamin Kramer2010-01-071-6/+4
| | | | llvm-svn: 92912
* Be less stingy as to how many selects and phi nodes weDuncan Sands2010-01-071-2/+2
| | | | | | are prepared to look through. llvm-svn: 92898
* handle ConstantVector while I'm in here.Chris Lattner2010-01-071-0/+3
| | | | llvm-svn: 92892
* fix a globalopt crash on 'bullet' (handling evaluation of a storeChris Lattner2010-01-071-16/+20
| | | | | | | | | | to an element of a vector in a static ctor) which occurs with an unrelated patch I'm testing. Annoyingly, EvaluateStoreInto basically does exactly the same stuff as InsertElement constant folding, but it now handles vectors, and you can't insertelement into a vector. It would be 'really nice' if GEP into a vector were not legal. llvm-svn: 92889
* Move the object size intrinsic optimization to inst-combine and makeEric Christopher2010-01-062-24/+12
| | | | | | it work for any integer size return type. llvm-svn: 92853
* Fix a README item: have functionattrs look through selects andDuncan Sands2010-01-061-10/+41
| | | | | | | | | phi nodes when deciding which pointers point to local memory. I actually checked long ago how useful this is, and it isn't very: it hardly ever fires in the testsuite, but since Chris wants it here it is! llvm-svn: 92836
* Formatting.Mikhail Glushenkov2010-01-061-2/+2
| | | | llvm-svn: 92831
* Partially address a README by having functionattrs consider calls toDuncan Sands2010-01-061-0/+15
| | | | | | | | | | memcpy, memset and other intrinsics that only access their arguments to be readnone if the intrinsic's arguments all point to local memory. This improves the testcase in the README to readonly, but it could in theory be made readnone, however this would involve more sophisticated analysis that looks through the memcpy. llvm-svn: 92829
* tweaks suggested by DuncanChris Lattner2010-01-061-7/+7
| | | | llvm-svn: 92824
OpenPOWER on IntegriCloud