summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Turn stuff like:Chris Lattner2007-04-111-9/+40
| | | | | | | | | | | | | icmp slt i32 %X, 0 ; <i1>:0 [#uses=1] sext i1 %0 to i32 ; <i32>:1 [#uses=1] into: %X.lobit = ashr i32 %X, 31 ; <i32> [#uses=1] This implements InstCombine/icmp.ll:test[34] llvm-svn: 35891
* Simplify some comparisons to arithmetic, this implements:Chris Lattner2007-04-111-0/+27
| | | | | | Transforms/InstCombine/icmp.ll llvm-svn: 35890
* canonicalize (x <u 2147483648) -> (x >s -1) and (x >u 2147483647) -> (x <s 0)Chris Lattner2007-04-111-25/+32
| | | | llvm-svn: 35886
* fix a miscompilation of:Chris Lattner2007-04-111-63/+59
| | | | | | | | | | | | | | | define i32 @test(i32 %X) { entry: %Y = and i32 %X, 4 ; <i32> [#uses=1] icmp eq i32 %Y, 0 ; <i1>:0 [#uses=1] sext i1 %0 to i32 ; <i32>:1 [#uses=1] ret i32 %1 } by moving code out of commonIntCastTransforms into visitZExt. Simplify the APInt gymnastics in it etc. llvm-svn: 35885
* Strengthen the boundary conditions of this fold, implementingChris Lattner2007-04-091-3/+3
| | | | | | InstCombine/set.ll:test25 llvm-svn: 35852
* Fix PR1304 and Transforms/InstCombine/2007-04-08-SingleEltVectorCrash.llChris Lattner2007-04-091-2/+10
| | | | llvm-svn: 35792
* Eliminate useless insertelement instructions. This implementsChris Lattner2007-04-091-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Transforms/InstCombine/vec_insertelt.ll and fixes PR1286. We now compile the code from that bug into: _foo: movl 4(%esp), %eax movdqa (%eax), %xmm0 movl 8(%esp), %ecx psllw (%ecx), %xmm0 movdqa %xmm0, (%eax) ret instead of: _foo: subl $4, %esp movl %ebp, (%esp) movl %esp, %ebp movl 12(%ebp), %eax movdqa (%eax), %xmm0 #IMPLICIT_DEF %eax pinsrw $2, %eax, %xmm0 xorl %ecx, %ecx pinsrw $3, %ecx, %xmm0 pinsrw $4, %eax, %xmm0 pinsrw $5, %ecx, %xmm0 pinsrw $6, %eax, %xmm0 pinsrw $7, %ecx, %xmm0 movl 8(%ebp), %eax movdqa (%eax), %xmm1 psllw %xmm0, %xmm1 movdqa %xmm1, (%eax) movl %ebp, %esp popl %ebp ret woo :) llvm-svn: 35788
* reenable this xform, whoops :)Chris Lattner2007-04-081-1/+2
| | | | llvm-svn: 35765
* Fix regression on Instcombine/apint-or2.llChris Lattner2007-04-081-30/+29
| | | | llvm-svn: 35763
* Generalize the code that handles (A&B)|(A&C) to work where B/C are not ↵Chris Lattner2007-04-081-30/+83
| | | | | | | | constants. Add a new xform to simplify (A&B)|(~A&C). THis implements InstCombine/or2.ll:test1 llvm-svn: 35760
* implement Transforms/InstCombine/malloc2.ll and PR1313Chris Lattner2007-04-061-1/+11
| | | | llvm-svn: 35700
* Prevent transformConstExprCastCall from generating conversions that assertDale Johannesen2007-04-041-0/+35
| | | | | | elsewhere. llvm-svn: 35668
* Fix 2007-04-04-BadFoldBitcastIntoMalloc.llJeff Cohen2007-04-041-4/+5
| | | | llvm-svn: 35665
* Fix comment.Duncan Sands2007-04-041-1/+1
| | | | llvm-svn: 35655
* Fix a bug I introduced with my patch yesterday which broke Qt (I convertedChris Lattner2007-04-031-1/+1
| | | | | | | | some constant exprs to apints). Thanks to Anton for tracking down a small testcase that triggered this! llvm-svn: 35633
* reinstate the previous two patches, with a bugfix :)Chris Lattner2007-04-031-493/+525
| | | | | | ldecod now passes. llvm-svn: 35626
* Reverting back to 1.723. The last two commits broke JM (and possibily ↵Evan Cheng2007-04-031-524/+491
| | | | | | others) on ARM. llvm-svn: 35620
* Split a whole ton of code out of visitICmpInst into ↵Chris Lattner2007-04-031-520/+524
| | | | | | visitICmpInstWithInstAndIntCst. llvm-svn: 35614
* Fix PR1253 and xor2.ll:test[01]Chris Lattner2007-04-031-1/+30
| | | | llvm-svn: 35612
* 1. Make use of APInt operation instead of using ConstantExpr::getXXX.Zhou Sheng2007-04-021-26/+19
| | | | | | 2. Use cheaper APInt methods. llvm-svn: 35594
* Use uint32_t for bitwidth instead of unsigned.Zhou Sheng2007-04-021-29/+29
| | | | llvm-svn: 35593
* Wrap long lineChris Lattner2007-04-021-3/+3
| | | | llvm-svn: 35588
* use more obvious function name.Chris Lattner2007-04-021-1/+1
| | | | llvm-svn: 35587
* simplify (x+c)^signbit as (x+c+signbit), pointed out by PR1288. This implementsChris Lattner2007-04-021-1/+7
| | | | | | test/Transforms/InstCombine/xor.ll:test28 llvm-svn: 35584
* simplify this code, make it work for ap intsChris Lattner2007-04-011-17/+6
| | | | llvm-svn: 35561
* Avoid unnecessary APInt construction.Zhou Sheng2007-04-011-18/+17
| | | | llvm-svn: 35555
* For PR1297:Reid Spencer2007-04-011-25/+7
| | | | | | Support overloaded intrinsics bswap, ctpop, cttz, ctlz. llvm-svn: 35547
* Fix InstCombine/2007-03-31-InfiniteLoop.llChris Lattner2007-04-011-1/+3
| | | | llvm-svn: 35536
* Delete dead code.Zhou Sheng2007-03-311-1/+0
| | | | llvm-svn: 35525
* Use APInt operators to calculate the carry bits, remove this loop.Zhou Sheng2007-03-311-16/+2
| | | | llvm-svn: 35524
* Make sure the use of ConstantInt::getZExtValue() for shift amount safe.Zhou Sheng2007-03-301-18/+20
| | | | llvm-svn: 35510
* 1. Make sure the use of ConstantInt::getZExtValue() for getting shiftZhou Sheng2007-03-301-27/+25
| | | | | | | | amount is safe. 2. Use new method on ConstantInt instead of (? :) operator. 3. Use new method uge() on ConstantInt to simplify codes. llvm-svn: 35505
* Use APInt operation instead of ConstantExpr::getXX.Zhou Sheng2007-03-301-6/+6
| | | | llvm-svn: 35503
* 1. Make more use of APInt::getHighBitsSet/getLowBitsSet.Zhou Sheng2007-03-291-24/+28
| | | | | | | 2. Let APInt variable do the binary operation stuff instead of using ConstantExpr::getXXX. llvm-svn: 35450
* Clean up some codes in InstCombiner::SimplifyDemandedBits().Zhou Sheng2007-03-291-12/+6
| | | | llvm-svn: 35446
* Clean up codes in InstCombiner::SimplifyDemandedBits():Zhou Sheng2007-03-291-32/+35
| | | | | | | | 1. Line out nested call of APInt::zext/trunc. 2. Make more use of APInt::getHighBitsSet/getLowBitsSet. 3. Use APInt[] operator instead of expression like "APIntVal & SignBit". llvm-svn: 35444
* 1. Make the APInt variable do the binary operation stuff if possibleZhou Sheng2007-03-291-3/+5
| | | | | | | | instead of using ConstantExpr::getXX. 2. Use constant reference to APInt if possible instead of expensive APInt copy. llvm-svn: 35443
* Avoid unnecessary APInt construction.Zhou Sheng2007-03-281-3/+2
| | | | llvm-svn: 35431
* 1. Make more use of getLowBitsSet/getHighBitsSet.Zhou Sheng2007-03-281-13/+16
| | | | | | | | 2. Use APInt[] instead of "X & SignBit". 3. Clean up some codes. 4. Make the expression like "ShiftAmt = ShiftAmtC->getZExtValue()" safe. llvm-svn: 35424
* 1. Make more use of getLowBitsSet/getHighBitsSet.Zhou Sheng2007-03-281-5/+3
| | | | | | | 2. Make the APInt value do the zext/trunc stuff instead of using ConstantExpr::getZExt(). llvm-svn: 35422
* Use UnknownBIts[BitWidth-1] instead of UnknownBIts & SignBits.Zhou Sheng2007-03-281-1/+1
| | | | llvm-svn: 35418
* Remove unused APInt variable.Zhou Sheng2007-03-281-3/+0
| | | | llvm-svn: 35414
* Clean up codes in ComputeMaskedBits():Zhou Sheng2007-03-281-29/+27
| | | | | | | | 1. Line out nested use of zext/trunc. 2. Make more use of getHighBitsSet/getLowBitsSet. 3. Use APInt[] != 0 instead of "(APInt & SignBit) != 0". llvm-svn: 35408
* For PR1280:Reid Spencer2007-03-281-3/+13
| | | | | | | When converting an add/xor/and triplet into a trunc/sext, only do so if the intermediate integer type is a bitwidth that the targets can handle. llvm-svn: 35400
* Unbreaks non-debug builds.Evan Cheng2007-03-271-0/+2
| | | | llvm-svn: 35383
* Implement some minor review feedback.Reid Spencer2007-03-261-3/+3
| | | | llvm-svn: 35373
* For PR1271:Reid Spencer2007-03-261-1/+1
| | | | | | Fix another incorrectly converted shift mask. llvm-svn: 35371
* eliminate use of std::setChris Lattner2007-03-261-6/+4
| | | | llvm-svn: 35361
* Get better debug output by having modified instructions print both theReid Spencer2007-03-261-2/+10
| | | | | | | | original and new instruction. A slight performance hit with ostringstream but it is only for debug. Also, clean up an uninitialized variable warning noticed in a release build. llvm-svn: 35358
* Get the number of bits to set in a mask correct for a shl/lshr transform.Reid Spencer2007-03-261-1/+1
| | | | llvm-svn: 35357
OpenPOWER on IntegriCloud