Commit Graph

31464 Commits

Author SHA1 Message Date
Reid Spencer
0f5aed5648 Make the llvm-runtest function much more amenable by eliminating all the
global variables that needed to be passed in. This makes it possible to
add new global variables with only a couple changes (Makefile and llvm-dg.exp)
instead of touching every single dg.exp file.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35918 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 19:56:59 +00:00
Reid Spencer
6b8a6b50d9 Add a test case for testing basic IR features via llvm2cpp. This helps find
bit rot in llvm2cpp and also tests the LLVM C++ IR in ways that llvm-as
doesn't.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35917 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 19:54:37 +00:00
Reid Spencer
b18cbfe41d Make sure upgrade doesn't fail on this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35916 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 19:36:27 +00:00
Reid Spencer
0aac889d71 Update the way llvm2cpp tests are done:
1. Make sure bytecode/assembly inputs are always redirected stdin so that
   the module name is <stdin>. This helps not get false negatives when the
   diff is done.
2. Scan the test file to determine if llvm-upgrade needs to be run.
3. Avoid running testings that are XFAIL'd because they'll cause a failure
   when run for llvm2cpp.
4. Get some better error message output.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35914 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 17:56:23 +00:00
Reid Spencer
14f6dbff30 Upgrade this file completely instead of downgrading it. Make sure that
false positives aren't made.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35913 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 17:51:03 +00:00
Chris Lattner
c24bbaddf8 fix an infinite loop compiling ldecod, notice by JeffC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35910 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 16:51:53 +00:00
Chris Lattner
e11529438c Fix incorrect fall-throughs in addr mode code. This fixes CodeGen/ARM/arm-negative-stride.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35909 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 16:17:12 +00:00
Chris Lattner
5b456e867b this got better
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35908 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 16:12:27 +00:00
Chris Lattner
865523fa82 adjust test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35907 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 16:04:04 +00:00
Chris Lattner
ab46275683 Fix Transforms/ScalarRepl/union-pointer.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35906 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 15:45:25 +00:00
Chris Lattner
159b0a4340 Fix PR1318 by reacting appropriately to a mutating option list.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35905 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 15:35:18 +00:00
Chris Lattner
593959b9cc change test name.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35904 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 15:24:04 +00:00
Reid Spencer
97c0e2107b Fix a bug where ICmpInst objects instantiated directly with a name would
not retain that name. Not noticed because AsmParser always sets name after
construction. However, llvm2cpp noticed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35903 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 13:04:48 +00:00
Reid Spencer
4d26a0619d Make the generated code for ConstantInt nicer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35902 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 13:02:56 +00:00
Reid Spencer
2cd43e402a Fix an approximate calculation in an assertion not to give false negatives.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35901 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 13:00:04 +00:00
Reid Spencer
98a1a7151e Make sure this test uses llvm-upgrade.
Don't allow false positives.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35900 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 12:46:06 +00:00
Reid Spencer
46fea10881 Teach llvm2cpp about packed structure types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35899 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 12:41:49 +00:00
Reid Spencer
07441666b6 Fix several bugs relating to changes in the LLVM IR API or just outright
typos in the output. This is sufficient to get most of the llvm2cpp tests
working again.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35898 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 12:28:56 +00:00
Reid Spencer
baba98ae88 Regenerate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35897 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 12:10:58 +00:00
Reid Spencer
8486744214 Fix a crash-by-unknown-exception caused by attempting to use a null pointer
as the key for a map insertion.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35896 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 12:10:08 +00:00
Reid Spencer
03703f0817 Fix to not give false positives.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35895 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 12:04:33 +00:00
Reid Spencer
a9297b1a09 Fix some issues with param attrs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35894 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 10:01:32 +00:00
Reid Spencer
6abd3daae1 Add support for parameter attributes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35893 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 09:54:08 +00:00
Chris Lattner
12f591342f sext of compares.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35892 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 06:57:54 +00:00
Chris Lattner
8a9f571052 Turn stuff like:
icmp slt i32 %X, 0              ; <i1>:0 [#uses=1]
        sext i1 %0 to i32               ; <i32>:1 [#uses=1]

into:

        %X.lobit = ashr i32 %X, 31              ; <i32> [#uses=1]

This implements InstCombine/icmp.ll:test[34]


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35891 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 06:57:46 +00:00
Chris Lattner
a2e2c9bbf3 Simplify some comparisons to arithmetic, this implements:
Transforms/InstCombine/icmp.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35890 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 06:53:04 +00:00
Chris Lattner
f6e166b386 new testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35889 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 06:52:24 +00:00
Chris Lattner
1eba01e9a0 Fix this harder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35888 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 06:50:51 +00:00
Chris Lattner
c56a81dff1 don't create shifts by zero, fix some problems with my previous patch
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35887 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 06:43:25 +00:00
Chris Lattner
ba41783dbb canonicalize (x <u 2147483648) -> (x >s -1) and (x >u 2147483647) -> (x <s 0)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35886 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 06:12:58 +00:00
Chris Lattner
66bc325bff fix a miscompilation of:
define i32 @test(i32 %X) {
entry:
        %Y = and i32 %X, 4              ; <i32> [#uses=1]
        icmp eq i32 %Y, 0               ; <i1>:0 [#uses=1]
        sext i1 %0 to i32               ; <i32>:1 [#uses=1]
        ret i32 %1
}

by moving code out of commonIntCastTransforms into visitZExt.  Simplify the
APInt gymnastics in it etc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35885 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 05:45:39 +00:00
Chris Lattner
b062000c23 done
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35884 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 05:34:00 +00:00
Chris Lattner
20a35c3fa5 Teach the codegen to turn [aez]ext (setcc) -> selectcc of 1/0, which often
allows other simplifications.  For example, this compiles:
int isnegative(unsigned int X) {
   return !(X < 2147483648U);
}

Into this code:

x86:
        movl 4(%esp), %eax
        shrl $31, %eax
        ret
arm:
        mov r0, r0, lsr #31
        bx lr
thumb:
        lsr r0, r0, #31
        bx lr

instead of:

x86:
        cmpl $0, 4(%esp)
        sets %al
        movzbl %al, %eax
        ret

arm:
        mov r3, #0
        cmp r0, #0
        movlt r3, #1
        mov r0, r3
        bx lr

thumb:
        mov r2, #1
        mov r1, #0
        cmp r0, #0
        blt LBB1_2      @entry
LBB1_1: @entry
        cpy r2, r1
LBB1_2: @entry
        cpy r0, r2
        bx lr

Testcase here: test/CodeGen/Generic/ispositive.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35883 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 05:32:27 +00:00
Chris Lattner
cb42ba454c new testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35882 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 05:32:13 +00:00
Chris Lattner
1982ef20c4 Codegen integer abs more efficiently using the trick from the PPC CWG. This
improves codegen on many architectures.  Tests committed as CodeGen/*/iabs.ll

X86 Old:			X86 New:
_test:				_test:
   movl 4(%esp), %ecx		   movl 4(%esp), %eax
   movl %ecx, %eax		   movl %eax, %ecx
   negl %eax			   sarl $31, %ecx
   testl %ecx, %ecx		   addl %ecx, %eax
   cmovns %ecx, %eax		   xorl %ecx, %eax
   ret				   ret

PPC Old:			PPC New:
_test:				_test:
   cmpwi cr0, r3, -1		   srawi r2, r3, 31
   neg r2, r3			   add r3, r3, r2
   bgt cr0, LBB1_2 ;		   xor r3, r3, r2
LBB1_1: ;			   blr
   mr r3, r2
LBB1_2: ;
   blr

ARM Old:			ARM New:
_test:				_test:
   rsb r3, r0, #0		   add r3, r0, r0, asr #31
   cmp r0, #0			   eor r0, r3, r0, asr #31
   movge r3, r0			   bx lr
   mov r0, r3
   bx lr

Thumb Old:			Thumb New:
_test:				_test:
   neg r2, r0			   asr r2, r0, #31
   cmp r0, #0			   add r0, r0, r2
   bge LBB1_2			   eor r0, r2
LBB1_1: @			   bx lr
   cpy r0, r2
LBB1_2: @
   bx lr


Sparc Old:			Sparc New:
test:				test:
   save -96, %o6, %o6		   save -96, %o6, %o6
   sethi 0, %l0			   sra %i0, 31, %l0
   sub %l0, %i0, %l0		   add %i0, %l0, %l1
   subcc %i0, -1, %l1		   xor %l1, %l0, %i0
   bg .BB1_2			   restore %g0, %g0, %g0
   nop				   retl
.BB1_1:				   nop
   or %g0, %l0, %i0
.BB1_2:
   restore %g0, %g0, %g0
   retl
   nop

It also helps alpha/ia64 :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35881 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 05:11:38 +00:00
Chris Lattner
603572a771 new testcases for integer abs function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35880 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 05:02:57 +00:00
Chris Lattner
ed4e51e58e fix a regression introduced by my last patch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35879 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 03:27:24 +00:00
Chris Lattner
ade7592085 Hack to get sys::Path to recognize macho dylibs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35878 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 03:15:35 +00:00
Reid Spencer
18da072088 For PR1146:
Put the parameter attributes in their own ParamAttr name space. Adjust the
rest of llvm as a result.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35877 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 02:44:20 +00:00
Reid Spencer
947aa7de67 Teach sys::Path how to recognize different kinds of object files for ELF
and Mach-O systems. Additionally, correct the Mach-O logic code to look at
byte 12 not byte 15. Hopefully this fixes the llvm-ld warning on Darwin.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35876 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 02:02:09 +00:00
Chris Lattner
f4b1818728 Simplify SROA conversion to integer in some ways, make it more general in others.
We now tolerate small amounts of undefined behavior, better emulating what
would happen if the transaction actually occurred in memory.  This fixes
SingleSource/UnitTests/2007-04-10-BitfieldTest.c on PPC, at least until
Devang gets a chance to fix the CFE from doing undefined things with bitfields :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35875 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 00:57:54 +00:00
Reid Spencer
410aa020a2 Make isDynamicLibrary detect more than just an ELF file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35874 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 00:49:39 +00:00
Reid Spencer
c9f1b2d4c6 Hack the shared library extension for dylib. The existing code just looks
plain wrong since $module was never defined so we always get .so which is
broken on Darwin. Just force it to .dylib.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35873 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 00:33:43 +00:00
Reid Spencer
f6390b51e3 Hopefully fix LTDL_SHLIB_EXT on Darwin
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35872 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 00:27:39 +00:00
Bill Wendling
bb1ee05253 Add support for our first SSSE3 instruction "pmulhrsw".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35869 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-10 22:10:25 +00:00
Devang Patel
773fd38553 New test case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35868 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-10 21:43:01 +00:00
Chris Lattner
bae3bd7c19 new micro optzn
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35867 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-10 21:14:01 +00:00
Jeff Cohen
7545422f08 Correctly report version of GCC used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35866 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-10 19:13:43 +00:00
Devang Patel
bfe2c9ccf8 Add test case for PR 1154.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35865 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-10 16:57:08 +00:00
Chris Lattner
2b4c234388 fix a comment bug Reid noticed
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35864 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-10 16:33:06 +00:00