Commit Graph

26592 Commits

Author SHA1 Message Date
Nick Lewycky
b156afb791 Enable 'predsimplify' optimization.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30589 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-24 00:08:16 +00:00
Nick Lewycky
8f389d8cd4 Style changes only. Remove dead code, fix a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30588 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-23 15:13:08 +00:00
Chris Lattner
120fce5540 Be far more careful when splitting a loop header, either to form a preheader
or when splitting loops with a common header into multiple loops.  In particular
the old code would always insert the preheader before the old loop header.  This
is disasterous in cases where the loop hasn't been rotated.  For example, it can
produce code like:

        .. outside the loop...
        jmp LBB1_2      #bb13.outer
LBB1_1: #bb1
        movsd 8(%esp,%esi,8), %xmm1
        mulsd (%edi), %xmm1
        addsd %xmm0, %xmm1
        addl $24, %edi
        incl %esi
        jmp LBB1_3      #bb13
LBB1_2: #bb13.outer
        leal (%edx,%eax,8), %edi
        pxor %xmm1, %xmm1
        xorl %esi, %esi
LBB1_3: #bb13
        movapd %xmm1, %xmm0
        cmpl $4, %esi
        jl LBB1_1       #bb1

Note that the loop body is actually LBB1_1 + LBB1_3, which means that the
loop now contains an uncond branch WITHIN it to jump around the inserted
loop header (LBB1_2).  Doh.

This patch changes the preheader insertion code to insert it in the right
spot, producing this code:

        ... outside the loop, fall into the header ...
LBB1_1: #bb13.outer
        leal (%edx,%eax,8), %esi
        pxor %xmm0, %xmm0
        xorl %edi, %edi
        jmp LBB1_3      #bb13
LBB1_2: #bb1
        movsd 8(%esp,%edi,8), %xmm0
        mulsd (%esi), %xmm0
        addsd %xmm1, %xmm0
        addl $24, %esi
        incl %edi
LBB1_3: #bb13
        movapd %xmm0, %xmm1
        cmpl $4, %edi
        jl LBB1_2       #bb1

Totally crazy, no branch in the loop! :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30587 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-23 08:19:21 +00:00
Chris Lattner
c3984578be Teach UpdateDomInfoForRevectoredPreds to handle revectored preds that are not
reachable, making it general purpose enough for use by InsertPreheaderForLoop.
Eliminate custom dominfo updating code in InsertPreheaderForLoop, using
UpdateDomInfoForRevectoredPreds instead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30586 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-23 07:40:52 +00:00
Chris Lattner
e87a4b6cb0 remove misleading comment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30585 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-23 06:09:45 +00:00
Chris Lattner
a71965b1ad add method, correct comment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30584 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-23 04:03:45 +00:00
Evan Cheng
f10c17f986 Delete dead code; fix 80 col violations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30583 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-22 21:43:59 +00:00
Rafael Espindola
75645496fa add a note
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30581 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-22 11:36:17 +00:00
Bill Wendling
17cdf7b0f4 Use "%llvmgxx" instead of "llvm-g++".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30580 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-22 07:09:01 +00:00
Nate Begeman
62929eb3d6 Testcase for better rotate left and mask support
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30579 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-22 05:49:57 +00:00
Bill Wendling
f30e0eed4c Regression testcase for PR855.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30578 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-22 05:34:25 +00:00
Nate Begeman
f42f133938 Fold AND and ROTL more often
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30577 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-22 05:01:56 +00:00
Devang Patel
b71f6728eb remove extra white spaces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30576 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-22 01:07:57 +00:00
Devang Patel
8d3ab25335 Use iterative algorith to assign DFS number. This reduces
call stack depth.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30575 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-22 01:05:33 +00:00
Chris Lattner
ce6e84ca6c don't allow 'imm' or specific imms, like '1' on the LHS of a binop.
This shrinks X86GenDAGISel by ~330 lines.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30574 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-21 20:46:13 +00:00
Evan Cheng
2adffa1f66 Make it work for DAG combine of multi-value nodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30573 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-21 19:04:05 +00:00
Chris Lattner
649069728f Fit to 80 columns.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30572 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-21 18:28:27 +00:00
Jim Laskey
516b0eacff core corrections
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30570 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-21 17:35:47 +00:00
Devang Patel
c7cfbc58ad Use abstract class to facilitate dlopen() interface.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30569 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-21 17:22:55 +00:00
Jim Laskey
d1aed7aaf7 Basic "in frame" alias analysis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30568 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-21 16:28:59 +00:00
Rafael Espindola
ebdabda708 more condition codes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30567 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-21 13:06:26 +00:00
Rafael Espindola
7246d33e2a if a constant can't be an immediate, add it to the constant pool
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30566 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-21 11:29:52 +00:00
Chris Lattner
0e4b922680 fold (aext (and (trunc x), cst)) -> (and x, cst).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30561 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-21 06:40:43 +00:00
Chris Lattner
bf3708794f Check the right value type. This fixes 186.crafty on x86
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30560 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-21 06:17:39 +00:00
Chris Lattner
b13f83eb23 implemented
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30559 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-21 06:14:54 +00:00
Chris Lattner
111c228241 Compile:
int %test(ulong *%tmp) {
        %tmp = load ulong* %tmp         ; <ulong> [#uses=1]
        %tmp.mask = shr ulong %tmp, ubyte 50            ; <ulong> [#uses=1]
        %tmp.mask = cast ulong %tmp.mask to ubyte
        %tmp2 = and ubyte %tmp.mask, 3          ; <ubyte> [#uses=1]
        %tmp2 = cast ubyte %tmp2 to int         ; <int> [#uses=1]
        ret int %tmp2
}

to:

_test:
        movl 4(%esp), %eax
        movl 4(%eax), %eax
        shrl $18, %eax
        andl $3, %eax
        ret

instead of:

_test:
        movl 4(%esp), %eax
        movl 4(%eax), %eax
        shrl $18, %eax
        # TRUNCATE movb %al, %al
        andb $3, %al
        movzbl %al, %eax
        ret


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30558 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-21 06:14:31 +00:00
Chris Lattner
6007b84a5b Generalize (zext (truncate x)) and (sext (truncate x)) folding to work when
the src/dst are not the same size.  This catches things like "truncate
32-bit X to 8 bits, then zext to 16", which happens a bit on X86.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30557 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-21 06:00:20 +00:00
Chris Lattner
60e32b0776 Fit in 80-cols
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30556 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-21 05:46:00 +00:00
Chris Lattner
9ba46c13bf Fix Transforms/IndVarsSimplify/2006-09-20-LFTR-Crash.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30555 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-21 05:12:20 +00:00
Chris Lattner
7ffc328e97 new testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30554 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-21 05:11:01 +00:00
Nick Lewycky
70084fd53a Fix compile error.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30553 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-21 02:08:31 +00:00
Nick Lewycky
009aa1d485 Don't rewrite ConstantExpr::get.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30552 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-21 01:05:35 +00:00
Nick Lewycky
af2f1fe94e Once we're down to "setcc type constant1, constant2", at least come up
with the right answer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30550 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-20 23:02:24 +00:00
Anton Korobeynikov
f824868ed9 Adding codegeneration for StdCall & FastCall calling conventions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30549 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-20 22:03:51 +00:00
Andrew Lenharth
c459bbf0fd Account for pseudo-ops correctly
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30548 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-20 20:08:52 +00:00
Chris Lattner
4da1c82f72 The DarwinAsmPrinter need not check for isDarwin. createPPCAsmPrinterPass
should create the right asmprinter subclass.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30542 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-20 17:12:19 +00:00
Chris Lattner
dadceedbdb Wrap some darwin'isms with isDarwin checks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30541 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-20 17:07:15 +00:00
Nick Lewycky
406fc0cb49 Use a total ordering to compare instructions.
Fixes infinite loop in resolve().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30540 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-20 17:04:01 +00:00
Andrew Lenharth
4563326472 simplify
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30535 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-20 15:37:57 +00:00
Andrew Lenharth
6b634037b3 catch constants more often
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30534 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-20 15:05:49 +00:00
Andrew Lenharth
0ddae493e9 catch another constant
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30533 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-20 15:04:55 +00:00
Andrew Lenharth
886f98e6f9 clarify with test case
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30531 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-20 14:48:00 +00:00
Andrew Lenharth
0b78f3e4b4 Add Note
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30530 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-20 14:40:01 +00:00
Jim Laskey
01d7bcf03d Trim the home directory from the dejagnu test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30519 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-20 09:20:22 +00:00
Chris Lattner
f142713a30 item done
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30518 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-20 06:41:56 +00:00
Chris Lattner
e3152e54b5 Compile:
int test3(int a, int b) { return (a < 0) ? a : 0; }

to:

_test3:
        srawi r2, r3, 31
        and r3, r2, r3
        blr

instead of:

_test3:
        cmpwi cr0, r3, 1
        li r2, 0
        blt cr0, LBB2_2 ;entry
LBB2_1: ;entry
        mr r3, r2
LBB2_2: ;entry
        blr


This implements: PowerPC/select_lt0.ll:seli32_a_a


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30517 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-20 06:41:35 +00:00
Chris Lattner
72475c04ed new testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30516 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-20 06:40:37 +00:00
Chris Lattner
7e932de7f5 add a note
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30515 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-20 06:32:10 +00:00
Chris Lattner
84750587bf Fold the full generality of (any_extend (truncate x))
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30514 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-20 06:29:17 +00:00
Chris Lattner
5f42a240ba Two things:
1. teach SimplifySetCC that '(srl (ctlz x), 5) == 0' is really x != 0.
2. Teach visitSELECT_CC to use SimplifySetCC instead of calling it and
   ignoring the result.  This allows us to compile:

bool %test(ulong %x) {
  %tmp = setlt ulong %x, 4294967296
  ret bool %tmp
}

to:

_test:
        cntlzw r2, r3
        cmplwi cr0, r3, 1
        srwi r2, r2, 5
        li r3, 0
        beq cr0, LBB1_2 ;
LBB1_1: ;
        mr r3, r2
LBB1_2: ;
        blr

instead of:

_test:
        addi r2, r3, -1
        cntlzw r2, r2
        cntlzw r3, r3
        srwi r2, r2, 5
        cmplwi cr0, r2, 0
        srwi r2, r3, 5
        li r3, 0
        bne cr0, LBB1_2 ;
LBB1_1: ;
        mr r3, r2
LBB1_2: ;
        blr

This isn't wonderful, but it's an improvement.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30513 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-20 06:19:26 +00:00