Commit Graph

18932 Commits

Author SHA1 Message Date
Reid Spencer
29a5bf5f0f * Break tests into individual cases so its easier to see what's going on.
* Add four new cases to handle the new optimizations for strlen, dealing
  with:
    strlen(x) != 0 -> *x != 0
    strlen(x) == 0 -> *x == 0
  for each of two cases: strlen(x) != 0 and strlen(x) == 0


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21767 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-07 20:21:04 +00:00
Reid Spencer
789082af03 * Add two strlen optimizations:
strlen(x) != 0 -> *x != 0
    strlen(x) == 0 -> *x == 0
* Change nested statistics to use style of other LLVM statistics so that
  only the name of the optimization (simplify-libcalls) is used as the
  statistic name, and the description indicates which specific all is
  optimized. Cuts down on some redundancy and saves a few bytes of space.
* Make note of stpcpy optimization that could be done.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21766 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-07 20:15:59 +00:00
Reid Spencer
673c1a9170 Don't increment the counter unless the debug flag is set.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21762 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-07 04:59:45 +00:00
Chris Lattner
0975ed5f4e Convert shifts to muls to assist reassociation. This implements
Reassociate/shifttest.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21761 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-07 04:24:13 +00:00
Chris Lattner
5cc924ac42 test that reassociate can handle shifts
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21760 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-07 04:23:29 +00:00
Chris Lattner
08b43921e1 Simplify the code and rearrange it. No major functionality changes here.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21759 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-07 04:08:02 +00:00
Jeff Cohen
39cef60259 Silence VC++ warnings about unsafe mixing of ints and bools with the | operator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21758 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-07 02:44:04 +00:00
Chris Lattner
7939b78170 add note about bit builtins newly supported
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21757 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-07 02:21:21 +00:00
Chris Lattner
8ccdf7b07a new testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21756 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-07 02:16:08 +00:00
Chris Lattner
cfe6b37b07 fix bugs in my previous commit clarify the return type of the bit ops
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21755 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-07 01:46:40 +00:00
Chris Lattner
8cdc5bccc8 add a couple of notes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21754 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 23:08:23 +00:00
Chris Lattner
bad10eebbe document calling convention extensions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21753 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 22:57:40 +00:00
Chris Lattner
3f6948d686 remove some dead (always dynamically false) flags
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21752 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 22:35:09 +00:00
Chris Lattner
dee199fe82 encode calling conventions for call/invoke instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21751 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 22:34:01 +00:00
Chris Lattner
6dc7e6833b new testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21750 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 22:33:44 +00:00
Chris Lattner
479ffebd73 encode function calling convs in the bytecode file. invoke and call are
still to come.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21749 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 20:42:57 +00:00
Chris Lattner
a8e8f16714 parse new calling conv specifiers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21748 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 20:27:19 +00:00
Chris Lattner
28caccff30 wrap a longline
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21747 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 20:27:03 +00:00
Chris Lattner
d511898b58 add support for explicit calling conventions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21746 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 20:26:43 +00:00
Chris Lattner
3340ffe854 Add support for explicit calling conventions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21745 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 20:26:26 +00:00
Chris Lattner
a62e52ab18 New file
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21744 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 19:59:08 +00:00
Chris Lattner
f924a4c21f use splice instead of remove/insert for a minor speedup
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21743 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 19:58:35 +00:00
Chris Lattner
1f64025d88 remove some ugly hacks that are no longer needed since andrew removed the
varargs munging code


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21742 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 19:49:51 +00:00
Chris Lattner
3799ed83b4 BAD typeo which caused many testsuite failures last night. Note to self, do
not change code after testing it without retesting!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21741 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 17:13:16 +00:00
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