1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-28 14:32:51 +01:00
Commit Graph

713 Commits

Author SHA1 Message Date
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
Reid Spencer
8449e5fa0e Refactor several ConstantExpr::getXXX calls with ConstantInt arguments
using the facilities of APInt. While this duplicates a tiny fraction of
the constant folding code, it also makes the code easier to read and
avoids large ConstantExpr overhead for simple, known computations.

llvm-svn: 35335
2007-03-25 05:33:51 +00:00
Zhou Sheng
3312a86598 1. Avoid unnecessary APInt construction if possible.
2. Use isStrictlyPositive() instead of isPositive() in two places where
   they need APInt value > 0 not only >=0.

llvm-svn: 35333
2007-03-25 05:01:29 +00:00
Reid Spencer
e601991a5e Make more uses of getHighBitsSet and get rid of some pointless & of an
APInt with its type mask.

llvm-svn: 35325
2007-03-25 04:26:16 +00:00
Reid Spencer
676eeb9c94 More APIntification:
* Convert the last use of a uint64_t that should have been an APInt.
* Change ComputeMaskedBits to have a const reference argument for the Mask
  so that recursions don't cause unneeded temporaries. This causes temps
  to be needed in other places (where the mask has to change) but this
  change optimizes for the recursion which is more frequent.
* Remove two instances of &ing a Mask with getAllOnesValue. Its not
  needed any more because APInt is accurate in its bit computations.
* Start using the getLowBitsSet and getHighBits set methods on APInt
  instead of shifting. This makes it more clear in the code what is
  going on.

llvm-svn: 35321
2007-03-25 02:03:12 +00:00
Chris Lattner
3f71a6b498 fix a regression on vector or instructions.
llvm-svn: 35314
2007-03-24 23:56:43 +00:00
Zhou Sheng
ce8c7becec Make some codes more efficient.
llvm-svn: 35297
2007-03-24 15:34:37 +00:00
Reid Spencer
b03fc33244 For PR1205:
Convert some calls to ConstantInt::getZExtValue() into getValue() and
use APInt facilities in the subsequent computations.

llvm-svn: 35294
2007-03-24 00:42:08 +00:00
Reid Spencer
01d252add1 For PR1205:
* APIntify visitAdd and visitSelectInst
* Remove unused uint64_t versions of utility functions that have been
  replaced with APInt versions.
This completes most of the changes for APIntification of InstCombine. This
passes llvm-test and llvm/test/Transforms/InstCombine/APInt.

Patch by Zhou Sheng.

llvm-svn: 35287
2007-03-23 21:24:59 +00:00
Reid Spencer
da8ec61ec4 For PR1205:
APIntify visitDiv, visitMul and visitRem.

Patch by Zhou Sheng.

llvm-svn: 35283
2007-03-23 20:05:17 +00:00
Chris Lattner
04baffb0c5 switch AddReachableCodeToWorklist from being recursive to being iterative.
llvm-svn: 35282
2007-03-23 19:17:18 +00:00
Reid Spencer
1fd12cf9f6 For PR1205:
APIntify several utility functions supporting logical operators and shift
operators.

Patch by Zhou Sheng.

llvm-svn: 35281
2007-03-23 18:46:34 +00:00
Zhou Sheng
e706d8f56d Make the "KnownZero ^ TypeMask" computation just once.
llvm-svn: 35276
2007-03-23 03:13:21 +00:00
Zhou Sheng
6b7b4945f1 Simplify the code.
llvm-svn: 35275
2007-03-23 02:39:25 +00:00
Reid Spencer
9881580cec For PR1205:
APInt support for logical operators in visitAnd, visitOr, and visitXor.

Patch by Zhou Sheng.

llvm-svn: 35273
2007-03-22 22:19:58 +00:00
Reid Spencer
74288268d3 For PR1205:
* APIntify commonIntCastTransforms
* APIntify visitTrunc
* APIntify visitZExt

Patch by Zhou Sheng.

llvm-svn: 35271
2007-03-22 20:56:53 +00:00
Reid Spencer
b6c09a009e For PR1205:
* Re-enable the APInt version of MaskedValueIsZero.
* APIntify the Comput{Un}SignedMinMaxValuesFromKnownBits functions
* APIntify visitICmpInst.

llvm-svn: 35270
2007-03-22 20:36:03 +00:00
Dan Gohman
d0a0ea9916 Change uses of Function::front to Function::getEntryBlock for readability.
llvm-svn: 35265
2007-03-22 16:38:57 +00:00
Reid Spencer
bdfbda05fb For PR1248:
* Fix some indentation and comments in InsertRangeTest
* Add an "IsSigned" parameter to AddWithOverflow and make it handle signed
  additions. Also, APIntify this function so it works with any bitwidth.
* For the icmp pred ([us]div %X, C1), C2 transforms, exit early if the
  div instruction's RHS is zero.
* Finally, for icmp pred (sdiv %X, C1), -C2, fix an off-by-one error. The
  HiBound needs to be incremented in order to get the range test correct.

llvm-svn: 35247
2007-03-21 23:19:50 +00:00
Zhou Sheng
0ae1c9e1ad Simplify isHighOnes().
llvm-svn: 35211
2007-03-20 12:49:06 +00:00
Reid Spencer
2f1ee85f90 Make isOneBitSet faster by using APInt::isPowerOf2. Thanks Chris.
llvm-svn: 35194
2007-03-20 00:16:52 +00:00
Reid Spencer
a792b71ab3 APIntify the isHighOnes utility function.
llvm-svn: 35190
2007-03-19 21:29:50 +00:00
Reid Spencer
4009f1eacb Implement isMaxValueMinusOne in terms of APInt instead of uint64_t.
Patch by Sheng Zhou.

llvm-svn: 35188
2007-03-19 21:10:28 +00:00
Reid Spencer
57a15f4445 Implement isMinValuePlusOne using facilities of APInt instead of uint64_t
Patch by Zhou Sheng.

llvm-svn: 35187
2007-03-19 21:08:07 +00:00
Reid Spencer
1985e3645b Implement isOneBitSet in terms of APInt::countPopulation.
llvm-svn: 35186
2007-03-19 21:04:43 +00:00
Reid Spencer
367a2917c0 1. Use APInt::getSignBit to reduce clutter (patch by Sheng Zhou)
2. Replace uses of the "isPositive" utility function with APInt::isPositive

llvm-svn: 35185
2007-03-19 20:58:18 +00:00