Commit Graph

3077 Commits

Author SHA1 Message Date
Jim Laskey
1c6f01aaa5 Load and stores have not been uniqued properly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31261 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-28 17:25:28 +00:00
Chris Lattner
47e32e6b83 Split *all* critical edges before isel. This resolves issues with spill code
being inserted on unsplit critical edges, which introduces (sometimes large
amounts of) partially dead spill code.

This also fixes PR925 + CodeGen/Generic/switch-crit-edge-constant.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31260 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-28 17:04:37 +00:00
Chris Lattner
6fb6ef4d65 Fix a serious bug that caused any x86 vector stuff to infinite loop
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31254 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-28 06:15:26 +00:00
Jim Laskey
def69b92e7 Clean up.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31243 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-27 23:52:51 +00:00
Chris Lattner
8c494ab759 Fix a bug in merged condition handling (CodeGen/Generic/2006-10-27-CondFolding.ll).
Add many fewer CFG edges and PHI node entries.  If there is a switch which has
the same block as multiple destinations, only add that block once as a successor/phi
node (in the jumptable case)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31242 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-27 23:50:33 +00:00
Jim Laskey
583bd47f77 Switch over from SelectionNodeCSEMap to FoldingSet.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31240 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-27 23:46:08 +00:00
Chris Lattner
1c9b2f312d remove debug code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31233 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-27 21:58:03 +00:00
Chris Lattner
d2f9ee9ea7 Codegen cond&cond with two branches. This compiles (f.e.) PowerPC/and-branch.ll to:
cmpwi cr0, r4, 4
        bgt cr0, LBB1_2 ;UnifiedReturnBlock
LBB1_3: ;entry
        cmplwi cr0, r3, 0
        bne cr0, LBB1_2 ;UnifiedReturnBlock

instead of:

        cmpwi cr7, r4, 4
        mfcr r2
        addic r4, r3, -1
        subfe r3, r4, r3
        rlwinm r2, r2, 30, 31, 31
        or r2, r2, r3
        cmplwi cr0, r2, 0
        bne cr0, LBB1_2 ;UnifiedReturnBlock
LBB1_1: ;cond_true


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31232 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-27 21:54:23 +00:00
Chris Lattner
571e434a34 Turn conditions like x<Y|z==q into multiple blocks.
This compiles Regression/CodeGen/X86/or-branch.ll into:

_foo:
        subl $12, %esp
        call L_bar$stub
        movl 20(%esp), %eax
        movl 16(%esp), %ecx
        cmpl $5, %eax
        jl LBB1_1       #cond_true
LBB1_3: #entry
        testl %ecx, %ecx
        jne LBB1_2      #UnifiedReturnBlock
LBB1_1: #cond_true
        call L_bar$stub
        addl $12, %esp
        ret
LBB1_2: #UnifiedReturnBlock
        addl $12, %esp
        ret

instead of:

_foo:
        subl $12, %esp
        call L_bar$stub
        movl 20(%esp), %eax
        movl 16(%esp), %ecx
        cmpl $4, %eax
        setg %al
        testl %ecx, %ecx
        setne %cl
        testb %cl, %al
        jne LBB1_2      #UnifiedReturnBlock
LBB1_1: #cond_true
        call L_bar$stub
        addl $12, %esp
        ret
LBB1_2: #UnifiedReturnBlock
        addl $12, %esp
        ret

And on ppc to:

        cmpwi cr0, r29, 5
        blt cr0, LBB1_1 ;cond_true
LBB1_3: ;entry
        cmplwi cr0, r30, 0
        bne cr0, LBB1_2 ;UnifiedReturnBlock

instead of:

        cmpwi cr7, r4, 4
        mfcr r2
        addic r4, r3, -1
        subfe r30, r4, r3
        rlwinm r29, r2, 30, 31, 31
        and r2, r29, r30
        cmplwi cr0, r2, 0
        bne cr0, LBB1_2 ;UnifiedReturnBlock


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31230 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-27 21:36:01 +00:00
Evan Cheng
5270cf1b77 getPreIndexedLoad -> getIndexedLoad.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31209 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-26 21:53:40 +00:00
Reid Spencer
1628cec4d7 For PR950:
Make necessary changes to support DIV -> [SUF]Div. This changes llvm to
have three division instructions: signed, unsigned, floating point. The
bytecode and assembler are bacwards compatible, however.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31195 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-26 06:15:43 +00:00
Chris Lattner
c2e91e34dc simplify code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31188 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-25 22:21:37 +00:00
Chris Lattner
323ece6fcd turn off tail merging for now
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31180 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-25 18:08:50 +00:00
Chris Lattner
13a04125df be more aggressive about matching identical instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31179 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-25 18:08:14 +00:00
Devang Patel
f9c197e022 Move getPreferredAlignmentLog from AsmPrinter to TargetData
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31171 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-24 20:32:14 +00:00
Chris Lattner
2452595927 visitSwitchCase knows how to insert conditional branches well. Change
visitBr to just call visitSwitchCase, eliminating duplicate logic.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31167 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-24 18:07:37 +00:00
Chris Lattner
57ab65972e Generalize CaseBlock a bit more:
Rename LHSBB/RHSBB to TrueBB/FalseBB.  Allow the RHS value to be null,
in which case the LHS is treated as a bool.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31166 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-24 17:57:59 +00:00
Chris Lattner
7b248d9866 generalize 'CaseBlock'. It really allows any comparison to be inserted.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31161 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-24 17:03:35 +00:00
Jim Laskey
62d07d6ace Don't do dead block elimination in fast mode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31155 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-24 16:11:49 +00:00
Jim Laskey
e719d9f8f2 LinearScanner hotspot.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31153 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-24 14:35:25 +00:00
Jim Laskey
fcc1d9473e Tighter data structure for deleted debug labels.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31152 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-24 11:50:43 +00:00
Chris Lattner
7d09784d3f move single basic blocks that are neither fallen into nor fall out of into
a place more useful.  In particular, if we can put them in a place where code
will be able to fall into it, do so.  Otherwise, put it in a place it can fall
through into a successor.  Otherwise, if preventing a fallthrough, move to the
end of the function, out of the way.

This deletes several hundred unconditional branches from spass.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31149 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-24 01:12:32 +00:00
Chris Lattner
c585a3f62a add moveBefore/moveAfter helper methods
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31145 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-24 00:02:26 +00:00
Chris Lattner
a4bcfe12d1 Enable tail merging by default.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31140 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-23 22:10:12 +00:00
Chris Lattner
b354343af7 Minor tweak. Instead of generating:
movl 32(%esp), %eax
        cmpl $1, %eax
        je LBB1_1       #bb
LBB1_4: #entry
        cmpl $2, %eax
        je LBB1_2       #bb2
        jmp LBB1_3      #UnifiedReturnBlock
LBB1_1: #bb

notice that we would miss the fall through and emit this instead:

        movl 32(%esp), %eax
        cmpl $2, %eax
        je LBB1_2       #bb2
LBB1_4: #entry
        cmpl $1, %eax
        jne LBB1_3      #UnifiedReturnBlock
LBB1_1: #bb


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31130 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-23 18:38:22 +00:00
Jim Laskey
66ebf0973d More complete solution to deleting blocks and debug info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31129 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-23 14:56:37 +00:00
Chris Lattner
b2e806eecd Fix phi node updating for switches lowered to linear sequences of branches.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31125 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-22 23:00:53 +00:00
Chris Lattner
e236ac64a2 disable this code for now, it's not yet safely updating phi nodes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31124 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-22 22:47:10 +00:00
Chris Lattner
d2c1d2200b Implement PR964 and Regression/CodeGen/Generic/SwitchLowering.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31119 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-22 21:36:53 +00:00
Chris Lattner
4bc135e93b don't break infinite loops
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31102 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-21 06:11:43 +00:00
Chris Lattner
a2d799531a Use branch reversal to do stuff like this:
call L_strcmp$stub
        testl %eax, %eax
-       jne LBB26_208   #cond_true6020
-       jmp LBB26_227   #bb7119
+       je LBB26_227    #bb7119
 LBB26_208:     #cond_true6020
        movl $l31_str14, 4(%esp)

        testl %eax, %eax
-       jne LBB26_704   #cond_true13042
-       jmp LBB26_713   #bb13151
+       je LBB26_713    #bb13151
 LBB26_704:     #cond_true13042
        movl $_str52, 4(%esp)

        cmpl 76(%ecx), %eax
-       jge LBB26_1628  #cond_false63.i.i
-       jmp LBB26_1769  #_Z8makeGridP13mrSurfaceListidiidd.exit.i
+       jl LBB26_1769   #_Z8makeGridP13mrSurfaceListidiidd.exit.i
 LBB26_1628:    #cond_false63.i.i
        movl $0, 48964(%esp)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31100 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-21 05:54:00 +00:00
Chris Lattner
2d47bd937c Transform code like:
jle FOO
  jmp BAR
BAR:

into:

  jle FOO
BAR:

... whoa!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31098 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-21 05:43:30 +00:00
Chris Lattner
386e29065d Three changes:
1. Remove a bunch of ifdef'd code.
2. When a block just contains an uncond branch, change all blocks branching
   to it to jump to the destination instead.
3. If branch analysis tells us some edges in the machinecfg are not actually
   possible, remove them.

#2 triggers a suprisingly large number of times.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31094 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-21 05:08:28 +00:00
Chris Lattner
12143054aa Add an experimental cross-jumping implementation.
This is currently disabled by default and limited in several ways, but does
have a positive effect.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31090 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-21 00:47:49 +00:00
Chris Lattner
8ace2cd034 implement MachineOperand::isIdenticalTo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31088 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-20 22:39:59 +00:00
Chris Lattner
34ab4d45d2 Make flag and chain edges visually distinguishable from value edges in DOT
output.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31067 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-20 18:06:09 +00:00
Reid Spencer
b83eb6447b For PR950:
This patch implements the first increment for the Signless Types feature.
All changes pertain to removing the ConstantSInt and ConstantUInt classes
in favor of just using ConstantInt.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31063 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-20 07:07:24 +00:00
Bill Wendling
c70ddad2b7 Partially in response to PR926: insert the newly created machine basic
blocks into the basic block list when lowering the switch inst. into a
binary tree of if-then statements. This allows the "visitSwitchCase" func
to allow for fall-through behavior.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31057 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-19 21:46:38 +00:00
Jim Laskey
07a2709e9d Add option for controlling inclusion of global AA.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31040 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-18 19:08:31 +00:00
Jim Laskey
096c22ea3d Use global info for alias analysis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31035 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-18 12:29:57 +00:00
Chris Lattner
683747abb8 Teach the branch folder to update debug info if it removes blocks with line
# notes in it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31026 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-17 23:17:27 +00:00
Chris Lattner
a97906b6e6 add a method to remove a line # record.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31025 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-17 23:16:42 +00:00
Chris Lattner
8466b21432 Do not leak all of the SourceLineInfo objects. Do not bother mallocing each
one separately.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31022 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-17 22:06:46 +00:00
Chris Lattner
b360729873 Trivial patch to speed up legalizing common i64 constants.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31020 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-17 21:47:13 +00:00
Chris Lattner
50662beab7 Fix CodeGen/PowerPC/2006-10-17-brcc-miscompile.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31019 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-17 21:24:15 +00:00
Evan Cheng
649b7ef627 Fix printer for StoreSDNode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31017 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-17 21:18:26 +00:00
Evan Cheng
2cacccae19 Reflect MemOpAddrMode change; added a helper to create pre-indexed load.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31016 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-17 21:14:32 +00:00
Jim Laskey
26f7fa7bba Make it simplier to dump DAGs while in DAGCombiner. Remove a nasty optimization.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31009 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-17 19:33:52 +00:00
Chris Lattner
ffddf6ba1c Enable deleting branches to successor blocks. With the previous patches,
branch folding can now compile stuff like this:

void foo(int W, int X, int Y, int Z) {
  if (W & 1) {
    for (; X;--X) bar();
  } else if (W & 2) {
    for (; Y;--Y) bar();
  } else if (W & 4) {
    for (; Z;--Z) bar();
  } else if (W & 8) {
    for (; W;--W) bar();
  }

  if (W) {
    bar();
  }
}

contrived testcase where loops exits all end up merging together.  To have
the loop merges be:

...
        cmplw cr0, r30, r27
        bne cr0, LBB1_14        ;bb38
LBB1_16:        ;cond_next48.loopexit
        mr r27, r29
LBB1_20:        ;cond_next48
        cmplwi cr0, r27, 0
        beq cr0, LBB1_22        ;UnifiedReturnBlock
...

instead of:


...
        cmplw cr0, r30, r27
        bne cr0, LBB1_14        ;bb38
LBB1_16:        ;cond_next48.loopexit
        mr r27, r29
        b LBB1_20       ;cond_next48
LBB1_17:        ;cond_next48.loopexit1
        b LBB1_20       ;cond_next48
LBB1_18:        ;cond_next48.loopexit2
        b LBB1_20       ;cond_next48
LBB1_19:        ;cond_next48.loopexit3
LBB1_20:        ;cond_next48
        cmplwi cr0, r27, 0
        beq cr0, LBB1_22        ;UnifiedReturnBlock
...


This is CodeGen/PowerPC/branch-opt.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31006 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-17 18:16:40 +00:00
Jim Laskey
99e41eed6d Clean up interface to getGlobalLinkName.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31001 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-17 17:17:24 +00:00
Chris Lattner
c50ffcb7fc Reenable this pass, fixing the bugs in it.
It now correctly deletes unreachable blocks and blocks that are empty.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31000 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-17 17:13:52 +00:00
Evan Cheng
5d04a1af4f Make sure operand does have size and element type operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30999 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-17 17:06:35 +00:00
Jim Laskey
a1a19f803c Basic support for getGlobalLinkName.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30997 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-17 13:41:07 +00:00
Evan Cheng
5956922a2d Be careful when looking through a vbit_convert. Optimizing this:
(vector_shuffle
  (vbitconvert (vbuildvector (copyfromreg v4f32), 1, v4f32), 4, f32),
  (undef, undef, undef, undef), (0, 0, 0, 0), 4, f32)
to the
  vbitconvert
is a very bad idea.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30989 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-16 22:49:37 +00:00
Jim Laskey
c7c3f110ed Pass AliasAnalysis thru to DAGCombiner.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30984 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-16 20:52:31 +00:00
Jim Laskey
ba8a2ee548 Global name regression.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30982 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-16 19:38:41 +00:00
Jim Laskey
d4edf2cf91 Tidy up after truncstore changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30961 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-14 12:14:27 +00:00
Evan Cheng
d42a5238a9 Debug tweak.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30959 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-14 08:34:06 +00:00
Chris Lattner
30f73e78bd Make sure that the node returned by SimplifySetCC is added to the worklist
so that it can be deleted if unused.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30955 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-14 03:52:46 +00:00
Chris Lattner
8ac9d0ebde fold setcc of a setcc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30953 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-14 01:02:29 +00:00
Chris Lattner
51dabfb283 When SimplifySetCC was moved to the DAGCombiner, it was never removed from
SelectionDAG and it has since bitrotted.  Remove the copy from SelectionDAG.
Next, remove the constant folding piece of DAGCombiner::SimplifySetCC into
a new FoldSetCC method which can be used by getNode() and SimplifySetCC.

This fixes obscure bugs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30952 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-14 00:41:01 +00:00
Chris Lattner
8f16eb98ed disable this pass for now, it's causing issues
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30951 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-14 00:30:06 +00:00
Chris Lattner
7821a8afd3 falling off the end of a function is ok with an unreachable instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30950 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-14 00:21:48 +00:00
Jim Laskey
274062c172 Reduce the workload by not adding chain users to work list.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30948 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-13 23:32:28 +00:00
Chris Lattner
dc78cbf457 Fix a bug where we incorrectly turned '(X & 0) == 0' into '(X & 0) >> -1',
which is undefined.  "0" isn't a power of 2.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30947 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-13 22:46:18 +00:00
Evan Cheng
8b2794aeff Merge ISD::TRUNCSTORE to ISD::STORE. Switch to using StoreSDNode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30945 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-13 21:14:26 +00:00
Chris Lattner
4a84ad7a2b add the branch folding pass as a late cleanup pass for all targets. For now
it just deletes empty MBB's.  Soon it will do more :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30941 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-13 20:45:56 +00:00
Chris Lattner
eb15eeec39 disable some objectionable code, maybe we can bring this pass to life
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30939 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-13 20:43:10 +00:00
Jim Laskey
339ec4cb15 Workaround for templates
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30927 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-13 13:02:19 +00:00
Jim Laskey
774f85465e Clean up dump.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30926 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-13 13:01:34 +00:00
Chris Lattner
26d2990e03 Lower X%C into X/C+stuff. This allows the 'division by a constant' logic to
apply to rems as well as divs.  This fixes PR945 and speeds up ReedSolomon
from 14.57s to 10.90s (which is now faster than gcc).

It compiles CodeGen/X86/rem.ll into:

_test1:
        subl $4, %esp
        movl %esi, (%esp)
        movl $2155905153, %ecx
        movl 8(%esp), %esi
        movl %esi, %eax
        imull %ecx
        addl %esi, %edx
        movl %edx, %eax
        shrl $31, %eax
        sarl $7, %edx
        addl %eax, %edx
        imull $255, %edx, %eax
        subl %eax, %esi
        movl %esi, %eax
        movl (%esp), %esi
        addl $4, %esp
        ret
_test2:
        movl 4(%esp), %eax
        movl %eax, %ecx
        sarl $31, %ecx
        shrl $24, %ecx
        addl %eax, %ecx
        andl $4294967040, %ecx
        subl %ecx, %eax
        ret
_test3:
        subl $4, %esp
        movl %esi, (%esp)
        movl $2155905153, %ecx
        movl 8(%esp), %esi
        movl %esi, %eax
        mull %ecx
        shrl $7, %edx
        imull $255, %edx, %eax
        subl %eax, %esi
        movl %esi, %eax
        movl (%esp), %esi
        addl $4, %esp
        ret

instead of div/idiv instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30920 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-12 20:58:32 +00:00
Evan Cheng
130a6471b9 Add RemoveDeadNode to remove a dead node and its (potentially) dead operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30916 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-12 20:34:05 +00:00
Chris Lattner
3657ffe037 add a minor dag combine noticed when looking at PR945
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30915 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-12 20:23:19 +00:00
Chris Lattner
6ec3626be4 restore my previous patch, now that the X86 backend bug has been fixed:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20061009/038518.html


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30906 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-12 17:45:38 +00:00
Jim Laskey
3ad175bd70 D'oh - need to use the rigth kind of store.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30903 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-12 15:22:24 +00:00
Evan Cheng
b870100f2a Backing out Chris' last commit. It's breaking llvm-gcc bootstrapping.
It's turning:
        movl -24(%ebp), %esp
        subl $16, %esp
        movl -24(%ebp), %ecx
into
        movl -24(%ebp), %esp
        subl $16, %esp
        movl %esp, (%esp)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30902 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-12 08:00:47 +00:00
Chris Lattner
f183cabba8 If we see a load from a stack slot into a physreg, consider it as providing
the stack slot.  This fixes PR943.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30898 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-12 02:34:07 +00:00
Jim Laskey
7aed46c25b Alias analysis of TRUNCSTORE.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30889 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-11 18:55:16 +00:00
Jim Laskey
2d84c4c7b3 Typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30884 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-11 17:52:19 +00:00
Jim Laskey
c2b19f3449 Handle aliasing of loadext.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30883 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-11 17:47:52 +00:00
Jim Laskey
7ca56aff22 Fix regression in combiner alias analysis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30880 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-11 13:47:09 +00:00
Evan Cheng
2e49f090f9 Naming consistency.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30878 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-11 07:10:22 +00:00
Andrew Lenharth
82c3d8f81a Jimptables working again on alpha.
As a bonus, use the GOT node instead of the AlphaISD::GOT for internal stuff.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30873 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-11 04:29:42 +00:00
Chris Lattner
755480681c add two helper methods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30869 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-11 03:58:02 +00:00
Evan Cheng
9629abac79 FindModifiedNodeSlot needs to add LoadSDNode ivars to create proper SelectionDAGCSEMap ID.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30866 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-11 01:47:58 +00:00
Evan Cheng
45aeccc1fd Also update getNodeLabel for LoadSDNode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30861 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-10 20:11:26 +00:00
Evan Cheng
0ac1c6ad9a SDNode::dump should also print out extension type and VT.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30860 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-10 20:05:10 +00:00
Chris Lattner
55b5708b6b Fix another bug in extload promotion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30857 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-10 18:54:19 +00:00
Evan Cheng
62f2a3c7aa Fix a bug introduced by my LOAD/LOADX changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30853 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-10 07:51:21 +00:00
Evan Cheng
466685d41a Reflects ISD::LOAD / ISD::LOADX / LoadSDNode changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30844 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-09 20:57:25 +00:00
Chris Lattner
6270f686b3 Eliminate more token factors by taking advantage of transitivity:
if TF depends on A and B, and A depends on B, TF just needs to depend on
A.  With Jim's alias-analysis stuff enabled, this compiles the testcase in
PR892 into:

__Z4test3Val:
        subl $44, %esp
        call L__Z3foov$stub
        movl %edx, 28(%esp)
        movl %eax, 32(%esp)
        movl %eax, 24(%esp)
        movl %edx, 36(%esp)
        movl 52(%esp), %ecx
        movl %ecx, 4(%esp)
        movl %eax, 8(%esp)
        movl %edx, 12(%esp)
        movl 48(%esp), %eax
        movl %eax, (%esp)
        call L__Z3bar3ValS_$stub
        addl $44, %esp
        ret

instead of:

__Z4test3Val:
        subl $44, %esp
        call L__Z3foov$stub
        movl %eax, 24(%esp)
        movl %edx, 28(%esp)
        movl 24(%esp), %eax
        movl %eax, 32(%esp)
        movl 28(%esp), %eax
        movl %eax, 36(%esp)
        movl 32(%esp), %eax
        movl 36(%esp), %ecx
        movl 52(%esp), %edx
        movl %edx, 4(%esp)
        movl %eax, 8(%esp)
        movl %ecx, 12(%esp)
        movl 48(%esp), %eax
        movl %eax, (%esp)
        call L__Z3bar3ValS_$stub
        addl $44, %esp
        ret


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30821 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-08 22:57:01 +00:00
Jim Laskey
7138234baf Combiner alias analysis passes Multisource (release-asserts.)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30818 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-07 23:37:56 +00:00
Chris Lattner
ed83a7019b Fix a bug legalizing zero-extending i64 loads into 32-bit loads. The bottom
part was always forced to be sextload, even when we needed an zextload.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30782 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-07 00:58:36 +00:00
Chris Lattner
cf9668f23d initialize ivar
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30780 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-06 22:52:08 +00:00
Chris Lattner
0336fdba85 If a target uses a GOT, put it in the jt data section, not the text
section.  This will fix alpha when Andrew implements
AlphaTargetMachine::getTargetLowering().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30779 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-06 22:50:56 +00:00
Chris Lattner
e0cfc8b2f2 jump tables handle pic
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30776 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-06 22:32:29 +00:00
Chris Lattner
db3ea6754b print labels even if a MBB doesn't have a corresponding LLVM BB, just don't
print the LLVM BB label.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30775 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-06 21:28:17 +00:00
Chris Lattner
4bdd2753db Fix a miscompilation of:
long long foo(long long X) {
  return (long long)(signed char)(int)X;
}

Instead of:

_foo:
        extsb r2, r4
        srawi r3, r4, 31
        mr r4, r2
        blr

we now produce:

_foo:
        extsb r4, r4
        srawi r3, r4, 31
        blr

This fixes a miscompilation in ConstantFolding.cpp.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30768 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-06 17:34:12 +00:00
Chris Lattner
5504602836 MachineBasicBlock::splice was incorrectly updating parent pointers on
instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30760 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-06 01:12:44 +00:00
Evan Cheng
786225adf0 Make use of getStore().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30759 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-05 23:01:46 +00:00