Commit Graph

18758 Commits

Author SHA1 Message Date
Chris Lattner
50a8a17e65 clean up the CBE output a bit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21740 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 06:58:42 +00:00
Chris Lattner
fe673d9351 add tail marker as a comment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21739 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 06:53:07 +00:00
Chris Lattner
a471e045b7 Make the stub functions be tail calls
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21738 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 06:48:54 +00:00
Chris Lattner
a9e9211bbb Preserve tail marker
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21737 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 06:48:21 +00:00
Chris Lattner
1b49141821 Implement Transforms/Inline/inline-tail.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21736 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 06:47:52 +00:00
Chris Lattner
2f4251bfbe Make sure to not accidentally get a bogus tail marker
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21735 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 06:47:37 +00:00
Chris Lattner
1430ef134d preserve the tail marker
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21734 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 06:46:58 +00:00
Chris Lattner
cfae2e80c8 add a default arg
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21733 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 06:22:10 +00:00
Chris Lattner
f6b5c1abce Don't forget these are calls
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21730 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 06:21:59 +00:00
Chris Lattner
c28ade4266 lex tail
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21729 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 06:20:33 +00:00
Chris Lattner
d100d4c3e9 test that tail call survives bytecodification
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21728 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 06:18:33 +00:00
Chris Lattner
38287bdfde add bytecode reader support for tail calls
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21727 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 06:13:34 +00:00
Chris Lattner
653488d166 Hilight tail
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21726 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 06:07:34 +00:00
Chris Lattner
47968e4dfd These are legal for tail calls
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21723 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 05:59:50 +00:00
Chris Lattner
ddb6db4fa1 Add a 'tail' marker for call instructions, patch contributed by
Alexander Friedman.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21722 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 05:51:46 +00:00
Chris Lattner
2bff524501 Add info on new 'tail' marker
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21721 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 05:47:36 +00:00
Chris Lattner
19bdc03adc Wrap long lines
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21720 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 05:34:40 +00:00
Chris Lattner
ec710c5b12 DCE intrinsic instructions without side effects.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21719 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 05:27:34 +00:00
Chris Lattner
998fffdda1 These intrinsics do not access memory
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21718 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 05:21:04 +00:00
Chris Lattner
eabfa4787a Teach instcombine propagate zeroness through shl instructions, implementing
and.ll:test31


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21717 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 04:53:20 +00:00
Chris Lattner
5962b3b0bf new testcases
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21716 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 04:52:46 +00:00
Chris Lattner
d7115b01a0 Implement shift.ll:test23. If we are shifting right then immediately truncating
the result, turn signed shift rights into unsigned shift rights if possible.

This leads to later simplification and happens *often* in 176.gcc.  For example,
this testcase:

struct xxx { unsigned int code : 8; };
enum codes { A, B, C, D, E, F };
int foo(struct xxx *P) {
  if ((enum codes)P->code == A)
     bar();
}

used to be compiled to:

int %foo(%struct.xxx* %P) {
        %tmp.1 = getelementptr %struct.xxx* %P, int 0, uint 0           ; <uint*> [#uses=1]
        %tmp.2 = load uint* %tmp.1              ; <uint> [#uses=1]
        %tmp.3 = cast uint %tmp.2 to int                ; <int> [#uses=1]
        %tmp.4 = shl int %tmp.3, ubyte 24               ; <int> [#uses=1]
        %tmp.5 = shr int %tmp.4, ubyte 24               ; <int> [#uses=1]
        %tmp.6 = cast int %tmp.5 to sbyte               ; <sbyte> [#uses=1]
        %tmp.8 = seteq sbyte %tmp.6, 0          ; <bool> [#uses=1]
        br bool %tmp.8, label %then, label %UnifiedReturnBlock

Now it is compiled to:

        %tmp.1 = getelementptr %struct.xxx* %P, int 0, uint 0           ; <uint*> [#uses=1]
        %tmp.2 = load uint* %tmp.1              ; <uint> [#uses=1]
        %tmp.2 = cast uint %tmp.2 to sbyte              ; <sbyte> [#uses=1]
        %tmp.8 = seteq sbyte %tmp.2, 0          ; <bool> [#uses=1]
        br bool %tmp.8, label %then, label %UnifiedReturnBlock

which is the difference between this:

foo:
        subl $4, %esp
        movl 8(%esp), %eax
        movl (%eax), %eax
        shll $24, %eax
        sarl $24, %eax
        testb %al, %al
        jne .LBBfoo_2

and this:

foo:
        subl $4, %esp
        movl 8(%esp), %eax
        movl (%eax), %eax
        testb %al, %al
        jne .LBBfoo_2

This occurs 3243 times total in the External tests, 215x in povray,
6x in each f2c'd program, 1451x in 176.gcc, 7x in crafty, 20x in perl,
25x in gap, 3x in m88ksim, 25x in ijpeg.

Maybe this will cause a little jump on gcc tommorow :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21715 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 04:18:52 +00:00
Chris Lattner
1b50d062c8 new testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21714 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 04:11:32 +00:00
Chris Lattner
7aed7ac5e1 Implement xor.ll:test22
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21713 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 02:07:39 +00:00
Chris Lattner
d152380ba8 implement and.ll:test30 and set.ll:test21
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21712 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 01:53:19 +00:00
Chris Lattner
cb94575bc6 new testcase for unneeded and
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21711 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 01:52:52 +00:00
Chris Lattner
564d20cb9b new testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21710 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 01:51:05 +00:00
Chris Lattner
828eeddb38 implement or.ll:test20
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21709 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 00:58:50 +00:00
Chris Lattner
056ea904a7 new testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21708 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 00:58:09 +00:00
Misha Brukman
d7a10c8566 * Order #includes alphabetically
* Remove commented-out debug printouts


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21707 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-05 23:45:17 +00:00
Misha Brukman
f4f85998bf Remove extra blank line
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21706 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-05 23:43:47 +00:00
Misha Brukman
827e8f0ffa * Use consistent spacing for function arguments
* Output single-character strings as chars


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21705 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-05 22:38:21 +00:00
Misha Brukman
6b8a63ae58 Remove vim settings from source code; people should use llvm/utils/vim/vimrc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21704 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-05 22:33:09 +00:00
Misha Brukman
e25bc8c957 Convert tabs to spaces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21703 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-05 22:30:40 +00:00
Chris Lattner
554a4dc987 new testcase for PR541
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21702 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-05 22:23:10 +00:00
Chris Lattner
9e60d8dbdc add support for undef values of opaque type, addressing PR541
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21701 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-05 22:21:19 +00:00
Chris Lattner
aba5ff5671 Add some extra checks. Opaque types don't have a null marker.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21700 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-05 20:57:00 +00:00
Chris Lattner
fd38787a8b new testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21699 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-05 17:57:24 +00:00
Chris Lattner
7ea0ade1b6 When hitting an unsupported intrinsic, actually print it
Lower debug info to noops.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21698 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-05 17:55:17 +00:00
Andrew Lenharth
ded10bfb46 ctpop lowering in legalize
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21697 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-05 15:55:21 +00:00
Chris Lattner
3987abdfe3 Fix a bug compimling Ruby, fixing this testcase:
LowerSetJmp/2005-05-05-OldUses.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21696 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-05 15:47:43 +00:00
Chris Lattner
ac0630ff75 new testcase for a bug Jim found
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21695 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-05 15:47:16 +00:00
Andrew Lenharth
b5884d3116 fix typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21693 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-04 19:25:37 +00:00
Andrew Lenharth
590091975c Well, add support for ct* for 21264 only.
21164 is broken until expand works.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21692 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-04 19:12:09 +00:00
Andrew Lenharth
fecf095292 Make promoteOp work for CT*
Proof?

ubyte %bar(ubyte %x) {
entry:
        %tmp.1 = call ubyte %llvm.ctlz( ubyte %x )
        ret ubyte %tmp.1
}

==>

zapnot $16,1,$0
CTLZ $0,$0
subq $0,56,$0
zapnot $0,1,$0
ret $31,($26),1


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21691 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-04 19:11:05 +00:00
Chris Lattner
693787a5ec Instcombine: cast (X != 0) to int, cast (X == 1) to int -> X iff X has only the low bit set.
This implements set.ll:test20.

This triggers 2x on povray, 9x on mesa, 11x on gcc, 2x on crafty, 1x on eon,
6x on perlbmk and 11x on m88ksim.

It allows us to compile these two functions into the same code:

struct s { unsigned int bit : 1; };
unsigned foo(struct s *p) {
  if (p->bit)
    return 1;
  else
    return 0;
}
unsigned bar(struct s *p) { return p->bit; }


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21690 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-04 19:10:26 +00:00
Chris Lattner
3a9a7701f0 new testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21689 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-04 19:05:02 +00:00
Reid Spencer
cea6559f60 Implement the IsDigitOptimization for simplifying calls to the isdigit
library function:
  isdigit(chr) -> 0 or 1 if chr is constant
  isdigit(chr) -> chr - '0' <= 9 otherwise

Although there are many calls to isdigit in llvm-test, most of them are
compiled away by macros leaving only this:

2 MultiSource/Applications/hexxagon


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21688 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-04 18:58:28 +00:00
Reid Spencer
3ec93c593c Make sure both optimization cases get tested.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21687 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-04 17:45:10 +00:00
Reid Spencer
57ff221e24 Add a test case for the IsDigitOptimization class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21686 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-04 17:34:55 +00:00