Commit Graph

3159 Commits

Author SHA1 Message Date
Duncan Sands
0091bf2439 Fix comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35655 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-04 06:42:45 +00:00
Chris Lattner
7305084156 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!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35633 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-03 23:29:39 +00:00
Chris Lattner
01deb9d91c reinstate the previous two patches, with a bugfix :)
ldecod now passes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35626 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-03 17:43:25 +00:00
Evan Cheng
d89f41e9bb Reverting back to 1.723. The last two commits broke JM (and possibily others) on ARM.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35620 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-03 08:11:50 +00:00
Chris Lattner
aed01d1931 split some code out into a helper function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35615 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-03 05:11:24 +00:00
Chris Lattner
01d8c107ac Split a whole ton of code out of visitICmpInst into visitICmpInstWithInstAndIntCst.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35614 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-03 04:46:52 +00:00
Chris Lattner
44ad43033e Fix PR1253 and xor2.ll:test[01]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35612 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-03 01:47:41 +00:00
Chris Lattner
1d31290634 allow -1 strides to reuse "1" strides.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35607 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-02 22:51:58 +00:00
Zhou Sheng
4a1822a6d8 1. Make use of APInt operation instead of using ConstantExpr::getXXX.
2. Use cheaper APInt methods.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35594 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-02 13:45:30 +00:00
Zhou Sheng
4351c649b2 Use uint32_t for bitwidth instead of unsigned.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35593 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-02 08:20:41 +00:00
Chris Lattner
1ebd89eb6b Pass the type of the store access, not the type of the store, into the
target hook.  This allows us to codegen a loop as:

LBB1_1: @cond_next
        mov r2, #0
        str r2, [r0, +r3, lsl #2]
        add r3, r3, #1
        cmn r3, #1
        bne LBB1_1      @cond_next

instead of:

LBB1_1: @cond_next
        mov r2, #0
        str r2, [r0], #+4
        add r3, r3, #1
        cmn r3, #1
        bne LBB1_1      @cond_next

This looks the same, but has one fewer induction variable (and therefore,
one fewer register) live in the loop.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35592 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-02 06:34:44 +00:00
Chris Lattner
cd1d6d5b03 Wrap long line
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35588 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-02 05:48:58 +00:00
Chris Lattner
acf4e074a9 use more obvious function name.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35587 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-02 05:42:22 +00:00
Chris Lattner
5c6e2db0c4 simplify (x+c)^signbit as (x+c+signbit), pointed out by PR1288. This implements
test/Transforms/InstCombine/xor.ll:test28


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35584 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-02 05:36:22 +00:00
Chris Lattner
c995123182 reduce use of std::set
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35576 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-02 01:44:59 +00:00
Chris Lattner
d9c3a0d7cc Various passes before isel split edges and do other CFG-restructuring changes.
isel has its own particular features that it wants in the CFG, in order to
reduce the number of times a constant is computed, etc.  Make sure that we
clean up the CFG before doing any other things for isel.  Doing so can
dramatically reduce the number of split edges and reduce the number of
places that constants get computed.  For example, this shrinks
CodeGen/Generic/phi-immediate-factoring.ll from 44 to 37 instructions on X86,
and from 21 to 17 MBB's in the output.  This is primarily a code size win,
not a performance win.

This implements CodeGen/Generic/phi-immediate-factoring.ll and PR1296.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35575 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-02 01:35:34 +00:00
Chris Lattner
fe35555d09 print the type of an inserted IV in -debug mode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35563 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-01 22:21:39 +00:00
Chris Lattner
55fc8c4c39 simplify this code, make it work for ap ints
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35561 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-01 20:57:36 +00:00
Zhou Sheng
3a507fda84 Avoid unnecessary APInt construction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35555 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-01 17:13:37 +00:00
Reid Spencer
e9391fd9b5 For PR1297:
Support overloaded intrinsics bswap, ctpop, cttz, ctlz.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35547 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-01 07:35:23 +00:00
Chris Lattner
6abbdf90dd Fix InstCombine/2007-03-31-InfiniteLoop.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35536 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-01 05:36:37 +00:00
Chris Lattner
dbe0deca33 Split the sdisel code munging stuff out into its own opt-pass, CodeGenPrepare.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35528 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-31 04:06:36 +00:00
Zhou Sheng
1c5d163634 Delete dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35525 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-31 02:50:26 +00:00
Zhou Sheng
b9cb95f8e3 Use APInt operators to calculate the carry bits, remove this loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35524 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-31 02:38:39 +00:00
Zhou Sheng
302748dd30 Make sure the use of ConstantInt::getZExtValue() for shift amount safe.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35510 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-30 17:20:39 +00:00
Zhou Sheng
0e2d3ac0f8 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35505 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-30 09:29:48 +00:00
Zhou Sheng
90b9681886 Use APInt operation instead of ConstantExpr::getXX.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35503 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-30 05:45:18 +00:00
Zhou Sheng
290bec5c15 1. Make more use of APInt::getHighBitsSet/getLowBitsSet.
2. Let APInt variable do the binary operation stuff instead of using
   ConstantExpr::getXXX.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35450 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-29 08:15:12 +00:00
Zhou Sheng
d48653a3ab Clean up some codes in InstCombiner::SimplifyDemandedBits().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35446 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-29 04:45:55 +00:00
Zhou Sheng
01542f3d80 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".


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35444 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-29 02:26:30 +00:00
Zhou Sheng
97b52c260f 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35443 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-29 01:57:21 +00:00
Zhou Sheng
34a4b38cbd Avoid unnecessary APInt construction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35431 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-28 17:38:21 +00:00
Zhou Sheng
e9e03f6b76 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35424 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-28 15:02:20 +00:00
Zhou Sheng
e82fca09bf 1. Make more use of getLowBitsSet/getHighBitsSet.
2. Make the APInt value do the zext/trunc stuff instead of using
   ConstantExpr::getZExt().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35422 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-28 09:19:01 +00:00
Zhou Sheng
4acf155af3 Use UnknownBIts[BitWidth-1] instead of UnknownBIts & SignBits.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35418 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-28 05:15:57 +00:00
Zhou Sheng
b32c00603b Remove unused APInt variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35414 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-28 03:02:21 +00:00
Zhou Sheng
aa305ab5e8 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".


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35408 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-28 02:19:03 +00:00
Reid Spencer
35c3885ba1 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35400 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-28 01:36:16 +00:00
Evan Cheng
c7baf687ba Unbreaks non-debug builds.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35383 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-27 16:44:48 +00:00
Reid Spencer
6eb0d99f5f Implement some minor review feedback.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35373 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-26 23:58:26 +00:00
Reid Spencer
68d27cf84e For PR1271:
Fix another incorrectly converted shift mask.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35371 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-26 23:45:51 +00:00
Devang Patel
d64d3a1d28 Reduce malloc/free traffic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35370 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-26 23:19:29 +00:00
Chris Lattner
0e5444bb20 eliminate use of std::set
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35361 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-26 20:40:50 +00:00
Reid Spencer
a9b8101333 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35358 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-26 17:44:01 +00:00
Reid Spencer
d5e30f0a01 Get the number of bits to set in a mask correct for a shl/lshr transform.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35357 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-26 17:18:58 +00:00
Reid Spencer
1be1284fe6 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35348 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-26 05:25:00 +00:00
Dale Johannesen
da91f49751 Look through bitcast when finding IVs. (Chris' patch really.)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35347 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-26 03:01:27 +00:00
Reid Spencer
55702aaa52 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35342 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-25 21:11:44 +00:00
Chris Lattner
db9654e284 implement Transforms/InstCombine/cast2.ll:test3 and PR1263
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35341 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-25 20:43:09 +00:00
Reid Spencer
2149a9dfec 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35339 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-25 19:55:33 +00:00
Reid Spencer
7177c3a60a 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35335 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-25 05:33:51 +00:00
Zhou Sheng
0fc5095d0e 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35333 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-25 05:01:29 +00:00
Reid Spencer
2f5491791b Make more uses of getHighBitsSet and get rid of some pointless & of an
APInt with its type mask.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35325 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-25 04:26:16 +00:00
Reid Spencer
2b81207b4b 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35321 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-25 02:03:12 +00:00
Chris Lattner
42593e69e2 fix a regression on vector or instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35314 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-24 23:56:43 +00:00
Zhou Sheng
00f436c5bc Make some codes more efficient.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35297 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-24 15:34:37 +00:00
Reid Spencer
f244252740 For PR1205:
Convert some calls to ConstantInt::getZExtValue() into getValue() and
use APInt facilities in the subsequent computations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35294 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-24 00:42:08 +00:00
Reid Spencer
2ec619a29a 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35287 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-23 21:24:59 +00:00
Reid Spencer
bca0e38baa For PR1205:
APIntify visitDiv, visitMul and visitRem.

Patch by Zhou Sheng.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35283 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-23 20:05:17 +00:00
Chris Lattner
2c7718a539 switch AddReachableCodeToWorklist from being recursive to being iterative.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35282 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-23 19:17:18 +00:00
Reid Spencer
b35ae0371a For PR1205:
APIntify several utility functions supporting logical operators and shift
operators.

Patch by Zhou Sheng.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35281 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-23 18:46:34 +00:00
Zhou Sheng
f62cc9f9e5 Make the "KnownZero ^ TypeMask" computation just once.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35276 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-23 03:13:21 +00:00
Zhou Sheng
9c636fe6f2 Simplify the code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35275 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-23 02:39:25 +00:00
Reid Spencer
a03d45fa88 For PR1205:
APInt support for logical operators in visitAnd, visitOr, and visitXor.

Patch by Zhou Sheng.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35273 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-22 22:19:58 +00:00
Reid Spencer
ad6676e81b For PR1205:
* APIntify commonIntCastTransforms
* APIntify visitTrunc
* APIntify visitZExt

Patch by Zhou Sheng.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35271 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-22 20:56:53 +00:00
Reid Spencer
0460fb3ea5 For PR1205:
* Re-enable the APInt version of MaskedValueIsZero.
* APIntify the Comput{Un}SignedMinMaxValuesFromKnownBits functions
* APIntify visitICmpInst.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35270 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-22 20:36:03 +00:00
Dan Gohman
ecb7a77885 Change uses of Function::front to Function::getEntryBlock for readability.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35265 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-22 16:38:57 +00:00
Nick Lewycky
27e4da93b6 Fix broken optimization disabled by a logic bug.
Analyze GEPs. If the indices are all zero, transfer whether the pointer is
known to be not null through the GEP.

Add a few more cases for xor and shift instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35257 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-22 02:02:51 +00:00
Reid Spencer
e4e4003032 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35247 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-21 23:19:50 +00:00
Dale Johannesen
8e59e163db do not share old induction variables when this would result in invalid
instructions (that would have to be split later)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35227 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-20 21:54:54 +00:00
Jeff Cohen
c01a53007a Fix some VC++ warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35224 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-20 20:43:18 +00:00
Devang Patel
3b57b6f36e LoopSimplify::FindPHIToPartitionLoops()
Use ETForest instead of DominatorSet.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35221 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-20 20:18:12 +00:00
Zhou Sheng
2cde46cb66 Simplify isHighOnes().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35211 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-20 12:49:06 +00:00
Dale Johannesen
dc42f48ea9 use types of loads and stores, not address, in CheckForIVReuse
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35197 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-20 00:47:50 +00:00
Reid Spencer
5f6a89562d Make isOneBitSet faster by using APInt::isPowerOf2. Thanks Chris.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35194 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-20 00:16:52 +00:00
Reid Spencer
05227d88af APIntify the isHighOnes utility function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35190 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-19 21:29:50 +00:00
Reid Spencer
3a2a9fbf99 Implement isMaxValueMinusOne in terms of APInt instead of uint64_t.
Patch by Sheng Zhou.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35188 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-19 21:10:28 +00:00
Reid Spencer
727992c30a Implement isMinValuePlusOne using facilities of APInt instead of uint64_t
Patch by Zhou Sheng.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35187 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-19 21:08:07 +00:00
Reid Spencer
44e33e674a Implement isOneBitSet in terms of APInt::countPopulation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35186 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-19 21:04:43 +00:00
Reid Spencer
5a1e3e1a7d 1. Use APInt::getSignBit to reduce clutter (patch by Sheng Zhou)
2. Replace uses of the "isPositive" utility function with APInt::isPositive


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35185 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-19 20:58:18 +00:00
Reid Spencer
8439bc8d69 Remove a redundant clause in an if statement.
Patch by Sheng Zhou.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35184 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-19 20:47:50 +00:00
Chris Lattner
a9d1a843fc fix ScalarRepl/2007-03-19-CanonicalizeMemcpy.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35169 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-19 18:25:57 +00:00
Chris Lattner
8bf9911932 implement the next chunk of SROA with memset/memcpy's of aggregates. This
implements Transforms/ScalarRepl/memset-aggregate-byte-leader.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35150 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-19 00:16:43 +00:00
Nick Lewycky
3f64b1ab1d Clean up this code and fix subtract miscompile.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35146 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-18 22:58:46 +00:00
Chris Lattner
318bf7963a Implement InstCombine/and-xor-merge.ll:test[12].
Rearrange some code to simplify it now that shifts are binops


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35145 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-18 22:51:34 +00:00
Nick Lewycky
1eda0f60d7 Propagate ValueRanges across equality.
Add some more micro-optimizations: x * 0 = 0, a - x = a --> x = 0.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35138 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-18 01:09:32 +00:00
Anton Korobeynikov
1cc6452181 Silence warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35137 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-17 14:48:06 +00:00
Nick Lewycky
4c70875774 Add more comments and update to new asm syntax.
Add new micro-optimizations.

Add icmp predicate snuggling. Given %x ULT 4, "icmp ugt %x, 2" becomes
"icmp eq %x, 3". This doesn't apply in any non-trivial cases yet due to missing
support for NE values in ValueRanges.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35119 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-16 02:37:39 +00:00
Zhou Sheng
adc149549d ShiftAmt might equal to zero. Handle this situation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35094 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-14 09:07:33 +00:00
Zhou Sheng
9670445cd4 Enable KnownZero/One.clear().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35093 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-14 03:21:24 +00:00
Evan Cheng
1d95816db5 Correct type info for isLegalAddressImmediate() check.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35086 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-13 20:34:37 +00:00
Chris Lattner
bc1dbfce62 ifdef out some dead code.
Fix PR1244 and Transforms/InstCombine/2007-03-13-CompareMerge.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35082 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-13 14:27:42 +00:00
Zhou Sheng
b277b16593 For expression like
"APInt::getAllOnesValue(ShiftAmt).zextOrCopy(BitWidth)",
to handle ShiftAmt == BitWidth situation, use zextOrCopy() instead of
zext().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35080 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-13 06:40:59 +00:00
Zhou Sheng
771dbf7677 In APInt version ComputeMaskedBits():
1. Ensure VTy, KnownOne and KnownZero have same bitwidth.
  2. Make code more efficient.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35078 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-13 02:23:10 +00:00
Evan Cheng
5eef2d21a0 Use new TargetLowering addressing modes hooks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35072 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-12 23:27:37 +00:00
Jeff Cohen
c4558fde76 Unbreak VC++ build. Do not use identifiers starting with _ as they are reserved and
can collide with system defined names.  Windows defines _BB, for example.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35066 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-12 17:56:27 +00:00
Reid Spencer
8cb6834ccf Add an APInt version of SimplifyDemandedBits.
Patch by Zhou Sheng.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35064 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-12 17:25:59 +00:00
Reid Spencer
6b79e2d202 Add an APInt version of ShrinkDemandedConstant.
Patch by Zhou Sheng.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35063 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-12 17:15:10 +00:00
Zhou Sheng
edd089c86a Avoid to assert on "(KnownZero & KnownOne) == 0".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35062 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-12 16:54:56 +00:00
Zhou Sheng
430f626937 In function ComputeMaskedBits():
1. Replace getSignedMinValue() with getSignBit() for better code readability.
  2. Replace APIntOps::shl() with operator<<= for convenience.
  3. Make APInt construction more effective.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35060 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-12 05:44:52 +00:00
Nick Lewycky
e677a0b099 Add value ranges. Currently inefficient in both execution time and
optimization power.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35058 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-10 18:12:48 +00:00
Anton Korobeynikov
e2ff29c17c Use range tests in LowerSwitch, where possible
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35057 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-10 16:46:28 +00:00
Devang Patel
f7543fe35a Remove dead comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35053 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-09 23:41:03 +00:00
Devang Patel
a5b7dc5ef8 Avoid recursion. Use iterative algorithm for RenamePass().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35052 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-09 23:39:14 +00:00
Devang Patel
4fe26582c0 Increment iterator now because IVUseShouldUsePostIncValue may remove
User from the list of I users.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35051 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-09 21:19:53 +00:00
Zhou Sheng
a47f60bfaf Fix a bug in function ComputeMaskedBits().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35027 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-08 15:15:18 +00:00
Chris Lattner
97f9df1cd1 This appears correct, enable it so we can see perf changes on testers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35024 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-08 07:03:55 +00:00
Chris Lattner
c14d3cac4b Second half of PR1226. This is currently still disabled, until I have a chance to
do the correctness/performance analysis testing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35023 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-08 06:36:54 +00:00
Zhou Sheng
9a28daa864 Fix a bug in APIntified ComputeMaskedBits().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35022 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-08 05:42:00 +00:00
Reid Spencer
e7816b5c9e For PR1205:
Provide an APIntified version of MaskedValueIsZero. This will (temporarily)
cause a "defined but not used" message from the compiler. It will be used
in the next patch in this series.

Patch by Sheng Zhou.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35019 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-08 01:52:58 +00:00
Reid Spencer
3e7594f187 For PR1205:
Add a new ComputeMaskedBits function that is APIntified. We'll slowly
convert things over to use this version. When its all done, we'll remove
the existing version.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35018 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-08 01:46:38 +00:00
Devang Patel
5ee9997906 Now IndVarSimplify is a LoopPass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35003 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-07 06:39:01 +00:00
Devang Patel
54959d6cf6 Now LICM is a LoopPass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35001 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-07 04:41:30 +00:00
Devang Patel
3f1a1e0366 Now LoopUnroll is a LoopPass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34996 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-07 01:38:05 +00:00
Devang Patel
1bc89361c2 Now LoopUnswitch is a LoopPass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34992 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-07 00:26:10 +00:00
Devang Patel
0f54dcbf07 Now LoopStrengthReduce is a LoopPass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34984 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-06 21:14:09 +00:00
Reid Spencer
baf1e4b914 Remove an unnecessary if statement and adjust indentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34939 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-05 23:36:13 +00:00
Chris Lattner
372dda8881 This is the first major step of implementing PR1226. We now successfully
scalarrepl things down to elements, but mem2reg can't promote elements that
are memset/memcpy'd.  Until then, the code is disabled "0 &&".


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34924 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-05 07:52:57 +00:00
Chris Lattner
3c69849696 fix a subtle bug that caused an MSVC warning. Thanks to Jeffc for pointing this out.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34920 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-05 00:11:19 +00:00
Chris Lattner
783ccdb5c4 Add some simplifications for demanded bits, this allows instcombine to turn:
define i64 @test(i64 %A, i32 %B) {
        %tmp12 = zext i32 %B to i64             ; <i64> [#uses=1]
        %tmp3 = shl i64 %tmp12, 32              ; <i64> [#uses=1]
        %tmp5 = add i64 %tmp3, %A               ; <i64> [#uses=1]
        %tmp6 = and i64 %tmp5, 123              ; <i64> [#uses=1]
        ret i64 %tmp6
}

into:

define i64 @test(i64 %A, i32 %B) {
        %tmp6 = and i64 %A, 123         ; <i64> [#uses=1]
        ret i64 %tmp6
}

This implements Transforms/InstCombine/add2.ll:test1


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34919 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-05 00:02:29 +00:00
Jeff Cohen
ca5183d445 Unbreak VC++ build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34917 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-05 00:00:42 +00:00
Chris Lattner
d5fa214729 simplify some code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34914 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-04 23:16:36 +00:00
Chris Lattner
57939df2eb minor cleanups
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34904 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-04 04:50:21 +00:00
Chris Lattner
f964f321eb Speed up -instcombine by 20% by avoiding a particularly expensive passmgr call.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34902 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-04 04:27:24 +00:00
Chris Lattner
55091782c1 switch MarkAliveBlocks over to using SmallPtrSet instead of std::set, speeding
up simplifycfg by 20%


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34901 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-04 04:20:48 +00:00
Chris Lattner
9f3d738866 make better use of LCSSA information in RewriteLoopExitValues. Before, we
would scan the entire loop body, then scan all users of instructions in the
loop, looking for users outside the loop.  Now, since we know that the
loop is in LCSSA form, we know that any users outside the loop will be LCSSA
phi nodes.  Just scan them.

This speeds up indvars significantly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34898 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-04 03:43:23 +00:00
Chris Lattner
9caed5440d Implement PR1179/PR1232 and test/Transforms/IndVarsSimplify/loop_evaluate_[234].ll
This makes -indvars require and use LCSSA, updating it as appropriate.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34896 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-04 01:00:28 +00:00
Chris Lattner
c9838f25d5 Make RewriteLoopExitValues far less nested by using continue in the loop
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34891 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-03 22:48:48 +00:00
Chris Lattner
c739cd6d07 my recent change caused a failure in a bswap testcase, because it changed
the order that instcombine processed instructions in the testcase.  The end
result is that instcombine finished with:

define i16 @test1(i16 %a) {
        %tmp = zext i16 %a to i32               ; <i32> [#uses=2]
        %tmp21 = lshr i32 %tmp, 8               ; <i32> [#uses=1]
        %tmp5 = shl i32 %tmp, 8         ; <i32> [#uses=1]
        %tmp.upgrd.32 = or i32 %tmp21, %tmp5            ; <i32> [#uses=1]
        %tmp.upgrd.3 = trunc i32 %tmp.upgrd.32 to i16           ; <i16> [#uses=1]
        ret i16 %tmp.upgrd.3
}

which can't get matched as a bswap.

This patch makes instcombine more sophisticated about removing truncating
casts, allowing it to turn this into:

define i16 @test2(i16 %a) {
        %tmp211 = lshr i16 %a, 8
        %tmp52 = shl i16 %a, 8
        %tmp.upgrd.323 = or i16 %tmp211, %tmp52
        ret i16 %tmp.upgrd.323
}

which then matches as bswap.  This fixes bswap.ll and implements
InstCombine/cast2.ll:test[12].  This also implements cast elimination of
add/sub.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34870 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-03 05:27:34 +00:00
Nick Lewycky
b6431da7be Translate bit operations to English.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34868 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-03 03:14:40 +00:00
Chris Lattner
ec9c35826d add a top-level iteration loop to instcombine. This means that it will never
finish without combining something it is capable of.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34865 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-03 02:04:50 +00:00
Reid Spencer
af3e9468dc APIntify this pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34863 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-03 00:48:31 +00:00
Reid Spencer
bee0f663d8 Finally get this patch right :)
Replace expensive getZExtValue() == 0 calls with isZero() calls.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34861 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-02 23:51:25 +00:00
Reid Spencer
502db93a8a Dang, I've done that twice now! Undo previous commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34860 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-02 23:37:53 +00:00
Reid Spencer
a5dae0cac0 Use more efficient test for one value in a ConstantInt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34859 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-02 23:35:28 +00:00
Reid Spencer
4e69f48a0a Guard against huge loop trip counts in an APInt safe way.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34858 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-02 23:31:34 +00:00
Reid Spencer
e8391e039e Make sure debug code is not evaluated in non-debug case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34856 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-02 23:15:21 +00:00
Reid Spencer
f1bed4c720 1. Sort switch cases using APInt safe comparison.
2. Make sure debug output of APInt values is safe for all bit widths.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34855 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-02 23:05:28 +00:00
Reid Spencer
4cf735b47e Use APInt safe isOne() method on ConstantInt instead of getZExtValue()==1
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34854 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-02 23:03:17 +00:00
Reid Spencer
e1c99d4c69 Make sorting of ConstantInt be APInt clean through use of ult function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34853 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-02 23:01:14 +00:00
Chris Lattner
dbab386e23 Fix a significant algorithm problem with the instcombine worklist. removing
a value from the worklist required scanning the entire worklist to remove all
entries.  We now use a combination map+vector to prevent duplicates from
happening and prevent the scan.  This speeds up instcombine on a large file
from the llvm-gcc bootstrap from 189.7s to 4.84s in a debug build and from
5.04s to 1.37s in a release build.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34848 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-02 21:28:56 +00:00
Chris Lattner
f22a5c6e9e minor cleanup
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34846 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-02 19:59:19 +00:00
Chris Lattner
67ef241f45 switch the inliner from being recursive to being iterative.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34832 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-02 03:11:20 +00:00
Reid Spencer
513d0f25ed Reverse a premature commital.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34822 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-02 00:31:39 +00:00
Reid Spencer
cae5754619 Prefer non-virtual calls to ConstantInt::isZero over virtual calls to
Constant::isNullValue() in situations where it is possible.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34821 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-02 00:28:52 +00:00
Reid Spencer
a3507ebd33 Although probably not necessary, guard against a potential assertion by
using isNullValue() instead of getZExtValue() == 0.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34815 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-01 21:54:37 +00:00
Reid Spencer
4da0451821 Use isUnitValue() instead of getZExtValue() == 1 which will prevent an
assert if the ConstantInt's value is large.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34814 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-01 21:51:23 +00:00
Reid Spencer
a0e0129e3f Use APInt conversion to string so the result is correct regardless of the
bit width of the ConstantInt being converted.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34810 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-01 21:00:32 +00:00
Reid Spencer
62aa905595 The 64-bit constructor for ConstantInt changes from int64_t to uint64_t.
This caused a warning for construction with -1. Avoid the warning by using
-1ULL instead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34796 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-01 19:33:52 +00:00
Reid Spencer
a6e8a955d6 Remove the "isSigned" parameters from ConstantRange. It turns out they
are not needed as the results are the same with or without it.

Patch by Nicholas Lewycky.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34782 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-01 07:54:15 +00:00
Reid Spencer
c6aedf70b3 For PR1205:
Adjust to changes in ConstantRange interface.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34762 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-28 22:03:51 +00:00
Reid Spencer
581b0d453a For PR1205:
Remove ConstantInt from ConstantRange interface and adjust its users to
compensate.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34758 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-28 19:57:34 +00:00
Reid Spencer
dc5c159701 For PR1205:
First round of ConstantRange changes. This makes all CR constructors use
only APInt and not use ConstantInt. Clients are adjusted accordingly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34756 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-28 18:57:32 +00:00
Devang Patel
fb688d4d1c Use efficient container SmallPtrSet
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34640 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-26 20:22:50 +00:00
Devang Patel
5295692061 Do not unswitch loop on same value again and again.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34638 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-26 19:31:58 +00:00
Chris Lattner
b3036683c1 Fix InstCombine/2007-02-23-PhiFoldInfLoop.ll and PR1217
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34546 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-24 01:03:45 +00:00
Chris Lattner
cae0a193e3 fix an obscure and tricky bug the inliner can hit sometimes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34531 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-23 19:54:30 +00:00
Jim Laskey
7d4853896c Revert changes for a simplier solution.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34495 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-22 16:21:18 +00:00
Jim Laskey
c518ccfeb5 Itanium ABI exception handing support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34480 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-21 22:49:50 +00:00
Dan Gohman
e26bff22db Fix typos in comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34456 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-20 20:52:03 +00:00
Chris Lattner
bb9a041100 remove reoptimizer-specific passes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34439 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-20 05:31:49 +00:00
Chris Lattner
ec1f752ae4 eliminate use of deprecated apis
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34417 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-19 07:34:47 +00:00
Chris Lattner
4a6f363491 fix comment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34395 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-18 22:10:58 +00:00
Chris Lattner
eb47391994 simplify pass, delete dead gvar protos as well.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34394 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-18 22:10:34 +00:00
Chris Lattner
535014f8ec convert more vectors to smallvectors, 2.8% speedup
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34333 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-15 22:52:10 +00:00
Chris Lattner
72588fc3f4 change some vectors to smallvectors. This speeds up instcombine on 447.dealII
by 5%.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34332 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-15 22:48:32 +00:00
Chris Lattner
1f87a58ab2 switch an std::set to a SmallPtr set, this speeds up instcombine by 9.5%
on 447.dealII


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34323 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-15 19:41:52 +00:00
Reid Spencer
ac9dcb94dd For PR1195:
Change use of "packed" term to "vector" in comments, strings, variable
names, etc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34300 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-15 03:39:18 +00:00
Reid Spencer
d29b8b85ce Change an assert that mentions Packed Type -> Vector Type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34298 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-15 03:11:20 +00:00
Reid Spencer
9d6565a5b1 For PR1195:
Rename PackedType -> VectorType, ConstantPacked -> ConstantVector, and
PackedTyID -> VectorTyID. No functional changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34293 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-15 02:26:10 +00:00
Chris Lattner
d2b7cec527 Generalize TargetData strings, to support more interesting forms of data.
Patch by Scott Michel.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34266 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-14 05:52:17 +00:00
Chris Lattner
c18470cb00 eliminate a bunch of vector-related heap traffic
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34222 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-13 05:58:53 +00:00
Chris Lattner
93e985f1b1 Eliminate use of ctors that take vectors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34219 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-13 02:10:56 +00:00
Chris Lattner
1ccd185cb4 stop using methods that take vectors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34205 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-12 22:56:41 +00:00
Chris Lattner
dec628eead Switch ValueSymbolTable to use StringMap<Value*> instead of std::map<std::string, Value*>
as its main datastructure.  There are many improvements yet to be made, but
this speeds up opt --std-compile-opts on 447.dealII by 7.3%.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34193 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-12 05:18:08 +00:00
Chris Lattner
86cc423555 simplify code by using Value::takeName
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34177 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-11 01:37:51 +00:00
Chris Lattner
6934a04a8c Simplify code by using value::takename
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34176 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-11 01:23:03 +00:00
Chris Lattner
046800a712 simplify name juggling through the use of Value::takeName.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34175 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-11 01:08:35 +00:00
Chris Lattner
b1919e2f08 Privatize StructLayout::MemberOffsets, adding an accessor
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34156 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-10 19:55:17 +00:00
Chris Lattner
3cfc1d22b2 Fix Transforms/DeadArgElim/2007-02-07-FuncRename.ll, fallout from PR411.
This happened because deadargelim now causes VMCore to auto-rename every
function that it hacks arguments out of.  Because it hacks arguments out of
functions in a non-deterministic order, this caused the resultant numbering
to be nondet.  The fix is to just be careful to not rename functions!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34005 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-07 19:31:33 +00:00
Chris Lattner
7f1444bc0a shrink vmcore by moving symbol table stripping support out of VMCore into
the one IPO pass that uses it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33990 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-07 06:22:45 +00:00
Chris Lattner
dfb22c3521 redesign the primary datastructure used by mem2reg to eliminate an
std::map of std::vector's (ouch!).  This speeds up mem2reg by 10% on 176.gcc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33974 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-07 01:15:04 +00:00
Chris Lattner
d3874049a5 With the last change, we no longer need both directions of mapping from
BBNumbers.  Instead of using a bi-directional mapping, just use a single
densemap.  This speeds up mem2reg on 176.gcc by 8%, from  1.3489 to
1.2485s.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33940 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-05 23:37:20 +00:00
Reid Spencer
9133fe2895 Apply the VISIBILITY_HIDDEN field to the remaining anonymous classes in
the Transforms library. This reduces debug library size by 132 KB, debug
binary size by 376 KB, and reduces link time for llvm tools slightly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33939 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-05 23:32:05 +00:00
Chris Lattner
a0d1548d0d Simplify use of DFBlocks, this makes no noticable performance difference,
but paves the way to eliminate BBNumbers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33938 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-05 23:31:26 +00:00
Reid Spencer
59d043bc8c This file should have been removed when -raise was removed. It isn't
used any more.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33937 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-05 23:27:02 +00:00
Chris Lattner
6a1a28dedd Switch InsertedPHINodes back to SmallPtrSet now that the SmallPtrSet::erase
bug is fixed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33932 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-05 23:11:37 +00:00
Chris Lattner
fc7d13d898 switch a SmallPtrSet back to an std::set for now, this caused problems.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33930 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-05 22:28:52 +00:00
Chris Lattner
c670f3da72 switch an std::set over to a SmallPtrSet, speeding up mem2reg 6% on 176.gcc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33929 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-05 22:15:21 +00:00
Chris Lattner
c837615cf0 switch an std::set over to SmallPtrSet, speeding up mem2reg 3.4% on 176.gcc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33928 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-05 22:13:11 +00:00
Chris Lattner
40b6555561 eliminate some malloc traffic, this speeds up mem2reg by 3.4%.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33927 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-05 21:58:48 +00:00
Reid Spencer
7ea07659a1 Add missing and needed #include.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33926 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-05 21:47:39 +00:00
Reid Spencer
9153a6729f Make the class VISIBILITY_HIDDEN.
Reduce lexical size of the anonymous namespace.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33925 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-05 21:45:12 +00:00
Reid Spencer
688b0490e2 For PR411:
Adjust to changes in Module interface:
getMainFunction() -> getFunction("main")
getNamedFunction(X) -> getFunction(X)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33922 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-05 21:19:13 +00:00
Reid Spencer
ef9b9a7939 For PR411:
This patch replaces the SymbolTable class with ValueSymbolTable which does
not support types planes. This means that all symbol names in LLVM must now
be unique. The patch addresses the necessary changes to deal with this and
removes code no longer needed as a result. This completes the bulk of the
changes for this PR. Some cleanup patches will follow.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33918 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-05 20:47:22 +00:00
Reid Spencer
15468bfc22 For PR411:
This pass is no longer needed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33917 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-05 20:41:05 +00:00
Reid Spencer
c19fbd6ec8 Create a pass to strip dead function declarations (prototypes). This is
for use by llvm-extract and bugpoint.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33916 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-05 20:24:25 +00:00
Chris Lattner
b0b991a2c8 Fix miscompilations of consumer-typeset, telecomm-gsm, and 176.gcc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33902 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-05 05:57:49 +00:00
Reid Spencer
0974ea0911 For PR1177:
Revert last patch which caused iteration invalidation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33901 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-05 05:23:32 +00:00
Chris Lattner
4f3ebab172 fix a miscompilation of 176.gcc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33900 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-05 04:09:35 +00:00