Commit Graph

1592 Commits

Author SHA1 Message Date
Devang Patel
cfde9594d1 Fix future bug. Of course, Chris spotted this.
Handle Argument or Undef as an incoming PHI value.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35821 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-09 16:41:46 +00:00
Devang Patel
24a1c49172 More cosmetic changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35820 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-09 16:21:29 +00:00
Devang Patel
322313376a Only cosmetic changes. Zero functionality Change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35819 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-09 16:11:48 +00:00
Chris Lattner
8546409d1b Fix PR1304 and Transforms/InstCombine/2007-04-08-SingleEltVectorCrash.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35792 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-09 01:37:55 +00:00
Chris Lattner
599ded1a7f 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 :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35788 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-09 01:11:16 +00:00
Chris Lattner
044e5337f5 reenable this xform, whoops :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35765 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-08 08:01:49 +00:00
Chris Lattner
6cae0e06ac Fix regression on Instcombine/apint-or2.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35763 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-08 07:55:22 +00:00
Chris Lattner
c5e7ea49eb 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35760 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-08 07:47:01 +00:00
Nick Lewycky
ac4d664d45 Add support for cast instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35734 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-07 15:48:32 +00:00
Owen Anderson
ba43963e96 Completely purge DomSet. This is the (hopefully) final patch for PR1171.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35731 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-07 07:17:27 +00:00
Nick Lewycky
a995d920d5 Support NE inequality in ValueRanges.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35724 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-07 04:49:12 +00:00
Nick Lewycky
f3a9e368f6 Cleanup. Refactor out the applying of value ranges to its own method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35719 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-07 03:36:51 +00:00
Nick Lewycky
b01c77e137 Use TargetData to find the size of a type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35718 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-07 03:16:12 +00:00
Nick Lewycky
8ac40dd747 Strengthen icmp snuggling by doing 'compare-or-equal-to' to 'compare'
first and then range testing second.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35715 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-07 02:30:14 +00:00
Devang Patel
c4625da483 Add loop rotation pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35714 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-07 01:25:15 +00:00
Chris Lattner
4802d90ca8 implement Transforms/InstCombine/malloc2.ll and PR1313
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35700 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-06 18:57:34 +00:00
Chris Lattner
1984a32867 Use a worklist-driven algorithm instead of a recursive one.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35680 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-05 01:27:02 +00:00
Dale Johannesen
16ff304e2c Prevent transformConstExprCastCall from generating conversions that assert
elsewhere.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35668 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-04 19:16:42 +00:00
Jeff Cohen
86796bec50 Fix 2007-04-04-BadFoldBitcastIntoMalloc.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35665 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-04 16:58:57 +00:00
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
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