Chris Lattner
fe1860b138
Strengthen the boundary conditions of this fold, implementing
...
InstCombine/set.ll:test25
llvm-svn: 35852
2007-04-09 23:52:13 +00:00
Chris Lattner
218d43af10
Fix PR1304 and Transforms/InstCombine/2007-04-08-SingleEltVectorCrash.ll
...
llvm-svn: 35792
2007-04-09 01:37:55 +00:00
Chris Lattner
b3d105a4f9
Eliminate useless insertelement instructions. This implements
...
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
2007-04-09 01:11:16 +00:00
Chris Lattner
1a1b798eb5
reenable this xform, whoops :)
...
llvm-svn: 35765
2007-04-08 08:01:49 +00:00
Chris Lattner
1760b42378
Fix regression on Instcombine/apint-or2.ll
...
llvm-svn: 35763
2007-04-08 07:55:22 +00:00
Chris Lattner
d435e0bfd2
Generalize the code that handles (A&B)|(A&C) to work where B/C are not constants.
...
Add a new xform to simplify (A&B)|(~A&C). THis implements InstCombine/or2.ll:test1
llvm-svn: 35760
2007-04-08 07:47:01 +00:00
Chris Lattner
03c84be56b
implement Transforms/InstCombine/malloc2.ll and PR1313
...
llvm-svn: 35700
2007-04-06 18:57:34 +00:00
Dale Johannesen
fb15913194
Prevent transformConstExprCastCall from generating conversions that assert
...
elsewhere.
llvm-svn: 35668
2007-04-04 19:16:42 +00:00
Jeff Cohen
01d4afe6da
Fix 2007-04-04-BadFoldBitcastIntoMalloc.ll
...
llvm-svn: 35665
2007-04-04 16:58:57 +00:00
Duncan Sands
de998e6599
Fix comment.
...
llvm-svn: 35655
2007-04-04 06:42:45 +00:00
Chris Lattner
974e931689
Fix a bug I introduced with my patch yesterday which broke Qt (I converted
...
some constant exprs to apints).
Thanks to Anton for tracking down a small testcase that triggered this!
llvm-svn: 35633
2007-04-03 23:29:39 +00:00
Chris Lattner
bfe18d29f9
reinstate the previous two patches, with a bugfix :)
...
ldecod now passes.
llvm-svn: 35626
2007-04-03 17:43:25 +00:00
Evan Cheng
e30cfe8e9e
Reverting back to 1.723. The last two commits broke JM (and possibily others) on ARM.
...
llvm-svn: 35620
2007-04-03 08:11:50 +00:00
Chris Lattner
23d58bde29
Split a whole ton of code out of visitICmpInst into visitICmpInstWithInstAndIntCst.
...
llvm-svn: 35614
2007-04-03 04:46:52 +00:00
Chris Lattner
9b66a372c8
Fix PR1253 and xor2.ll:test[01]
...
llvm-svn: 35612
2007-04-03 01:47:41 +00:00
Zhou Sheng
98c161c290
1. Make use of APInt operation instead of using ConstantExpr::getXXX.
...
2. Use cheaper APInt methods.
llvm-svn: 35594
2007-04-02 13:45:30 +00:00
Zhou Sheng
47311533a7
Use uint32_t for bitwidth instead of unsigned.
...
llvm-svn: 35593
2007-04-02 08:20:41 +00:00
Chris Lattner
aaf29d3b5e
Wrap long line
...
llvm-svn: 35588
2007-04-02 05:48:58 +00:00
Chris Lattner
7208dd1001
use more obvious function name.
...
llvm-svn: 35587
2007-04-02 05:42:22 +00:00
Chris Lattner
35ece02bea
simplify (x+c)^signbit as (x+c+signbit), pointed out by PR1288. This implements
...
test/Transforms/InstCombine/xor.ll:test28
llvm-svn: 35584
2007-04-02 05:36:22 +00:00
Chris Lattner
a66a97908c
simplify this code, make it work for ap ints
...
llvm-svn: 35561
2007-04-01 20:57:36 +00:00
Zhou Sheng
8b2b6b9e36
Avoid unnecessary APInt construction.
...
llvm-svn: 35555
2007-04-01 17:13:37 +00:00
Reid Spencer
88fb617695
For PR1297:
...
Support overloaded intrinsics bswap, ctpop, cttz, ctlz.
llvm-svn: 35547
2007-04-01 07:35:23 +00:00
Chris Lattner
aa4b06bdae
Fix InstCombine/2007-03-31-InfiniteLoop.ll
...
llvm-svn: 35536
2007-04-01 05:36:37 +00:00
Zhou Sheng
967239685a
Delete dead code.
...
llvm-svn: 35525
2007-03-31 02:50:26 +00:00
Zhou Sheng
ebf4c32f0b
Use APInt operators to calculate the carry bits, remove this loop.
...
llvm-svn: 35524
2007-03-31 02:38:39 +00:00
Zhou Sheng
67bcf1cfb6
Make sure the use of ConstantInt::getZExtValue() for shift amount safe.
...
llvm-svn: 35510
2007-03-30 17:20:39 +00:00
Zhou Sheng
d667b5db0c
1. Make sure the use of ConstantInt::getZExtValue() for getting shift
...
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
2007-03-30 09:29:48 +00:00
Zhou Sheng
382723d8b4
Use APInt operation instead of ConstantExpr::getXX.
...
llvm-svn: 35503
2007-03-30 05:45:18 +00:00
Zhou Sheng
ac2b833c7a
1. Make more use of APInt::getHighBitsSet/getLowBitsSet.
...
2. Let APInt variable do the binary operation stuff instead of using
ConstantExpr::getXXX.
llvm-svn: 35450
2007-03-29 08:15:12 +00:00
Zhou Sheng
684c2133f2
Clean up some codes in InstCombiner::SimplifyDemandedBits().
...
llvm-svn: 35446
2007-03-29 04:45:55 +00:00
Zhou Sheng
067efd7806
Clean up codes in InstCombiner::SimplifyDemandedBits():
...
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
2007-03-29 02:26:30 +00:00
Zhou Sheng
74db84591c
1. Make the APInt variable do the binary operation stuff if possible
...
instead of using ConstantExpr::getXX.
2. Use constant reference to APInt if possible instead of expensive
APInt copy.
llvm-svn: 35443
2007-03-29 01:57:21 +00:00
Zhou Sheng
a098617383
Avoid unnecessary APInt construction.
...
llvm-svn: 35431
2007-03-28 17:38:21 +00:00
Zhou Sheng
8fecc8c3a0
1. Make more use of getLowBitsSet/getHighBitsSet.
...
2. Use APInt[] instead of "X & SignBit".
3. Clean up some codes.
4. Make the expression like "ShiftAmt = ShiftAmtC->getZExtValue()" safe.
llvm-svn: 35424
2007-03-28 15:02:20 +00:00
Zhou Sheng
cf7d99a731
1. Make more use of getLowBitsSet/getHighBitsSet.
...
2. Make the APInt value do the zext/trunc stuff instead of using
ConstantExpr::getZExt().
llvm-svn: 35422
2007-03-28 09:19:01 +00:00
Zhou Sheng
2dc7cf0114
Use UnknownBIts[BitWidth-1] instead of UnknownBIts & SignBits.
...
llvm-svn: 35418
2007-03-28 05:15:57 +00:00
Zhou Sheng
e43a68551e
Remove unused APInt variable.
...
llvm-svn: 35414
2007-03-28 03:02:21 +00:00
Zhou Sheng
7245616070
Clean up codes in ComputeMaskedBits():
...
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
2007-03-28 02:19:03 +00:00
Reid Spencer
3b614f9dad
For PR1280:
...
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
2007-03-28 01:36:16 +00:00
Evan Cheng
a23cc41b11
Unbreaks non-debug builds.
...
llvm-svn: 35383
2007-03-27 16:44:48 +00:00
Reid Spencer
e4b331a4f2
Implement some minor review feedback.
...
llvm-svn: 35373
2007-03-26 23:58:26 +00:00
Reid Spencer
0cdfe48fc8
For PR1271:
...
Fix another incorrectly converted shift mask.
llvm-svn: 35371
2007-03-26 23:45:51 +00:00
Chris Lattner
16700ef424
eliminate use of std::set
...
llvm-svn: 35361
2007-03-26 20:40:50 +00:00
Reid Spencer
73d778edb7
Get better debug output by having modified instructions print both the
...
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
2007-03-26 17:44:01 +00:00
Reid Spencer
3fea170ecd
Get the number of bits to set in a mask correct for a shl/lshr transform.
...
llvm-svn: 35357
2007-03-26 17:18:58 +00:00
Reid Spencer
a6a4dbd24e
For PR1271:
...
Fix SingleSource/Regression/C/2003-05-21-UnionBitFields.c by changing a
getHighBitsSet call to getLowBitsSet call that was incorrectly converted
from the original lshr constant expression.
llvm-svn: 35348
2007-03-26 05:25:00 +00:00
Reid Spencer
4d3d7d0f2a
For PR1271:
...
Remove a use of getLowBitsSet that caused the mask used for replacement of
shl/lshr pairs with an AND instruction to be computed incorrectly. Its not
clear exactly why this is the case. This solves the disappearing shifts
problem, but it doesn't fix Regression/C/2003-05-21-UnionBitFields. It
seems there is more going on.
llvm-svn: 35342
2007-03-25 21:11:44 +00:00
Chris Lattner
26cfd91db8
implement Transforms/InstCombine/cast2.ll:test3 and PR1263
...
llvm-svn: 35341
2007-03-25 20:43:09 +00:00
Reid Spencer
1677543a3a
Some cleanup from review:
...
* Don't assume shift amounts are <= 64 bits
* Avoid creating an extra APInt in SubOne and AddOne by using -- and ++
* Add another use of getLowBitsSet
* Convert a series of if statements to a switch
llvm-svn: 35339
2007-03-25 19:55:33 +00:00