oota-llvm.git
17 years agoFix a crash-by-unknown-exception caused by attempting to use a null pointer
Reid Spencer [Wed, 11 Apr 2007 12:10:08 +0000 (12:10 +0000)]
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

17 years agoFix to not give false positives.
Reid Spencer [Wed, 11 Apr 2007 12:04:33 +0000 (12:04 +0000)]
Fix to not give false positives.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35895 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix some issues with param attrs.
Reid Spencer [Wed, 11 Apr 2007 10:01:32 +0000 (10:01 +0000)]
Fix some issues with param attrs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35894 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdd support for parameter attributes.
Reid Spencer [Wed, 11 Apr 2007 09:54:08 +0000 (09:54 +0000)]
Add support for parameter attributes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35893 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agosext of compares.
Chris Lattner [Wed, 11 Apr 2007 06:57:54 +0000 (06:57 +0000)]
sext of compares.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35892 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoTurn stuff like:
Chris Lattner [Wed, 11 Apr 2007 06:57:46 +0000 (06:57 +0000)]
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

17 years agoSimplify some comparisons to arithmetic, this implements:
Chris Lattner [Wed, 11 Apr 2007 06:53:04 +0000 (06:53 +0000)]
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

17 years agonew testcase
Chris Lattner [Wed, 11 Apr 2007 06:52:24 +0000 (06:52 +0000)]
new testcase

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35889 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix this harder.
Chris Lattner [Wed, 11 Apr 2007 06:50:51 +0000 (06:50 +0000)]
Fix this harder.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35888 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agodon't create shifts by zero, fix some problems with my previous patch
Chris Lattner [Wed, 11 Apr 2007 06:43:25 +0000 (06:43 +0000)]
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

17 years agocanonicalize (x <u 2147483648) -> (x >s -1) and (x >u 2147483647) -> (x <s 0)
Chris Lattner [Wed, 11 Apr 2007 06:12:58 +0000 (06:12 +0000)]
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

17 years agofix a miscompilation of:
Chris Lattner [Wed, 11 Apr 2007 05:45:39 +0000 (05:45 +0000)]
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

17 years agodone
Chris Lattner [Wed, 11 Apr 2007 05:34:00 +0000 (05:34 +0000)]
done

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35884 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoTeach the codegen to turn [aez]ext (setcc) -> selectcc of 1/0, which often
Chris Lattner [Wed, 11 Apr 2007 05:32:27 +0000 (05:32 +0000)]
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

17 years agonew testcase
Chris Lattner [Wed, 11 Apr 2007 05:32:13 +0000 (05:32 +0000)]
new testcase

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35882 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoCodegen integer abs more efficiently using the trick from the PPC CWG. This
Chris Lattner [Wed, 11 Apr 2007 05:11:38 +0000 (05:11 +0000)]
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

17 years agonew testcases for integer abs function
Chris Lattner [Wed, 11 Apr 2007 05:02:57 +0000 (05:02 +0000)]
new testcases for integer abs function

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35880 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agofix a regression introduced by my last patch.
Chris Lattner [Wed, 11 Apr 2007 03:27:24 +0000 (03:27 +0000)]
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

17 years agoHack to get sys::Path to recognize macho dylibs.
Chris Lattner [Wed, 11 Apr 2007 03:15:35 +0000 (03:15 +0000)]
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

17 years agoFor PR1146:
Reid Spencer [Wed, 11 Apr 2007 02:44:20 +0000 (02:44 +0000)]
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

17 years agoTeach sys::Path how to recognize different kinds of object files for ELF
Reid Spencer [Wed, 11 Apr 2007 02:02:09 +0000 (02:02 +0000)]
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

17 years agoSimplify SROA conversion to integer in some ways, make it more general in others.
Chris Lattner [Wed, 11 Apr 2007 00:57:54 +0000 (00:57 +0000)]
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

17 years agoMake isDynamicLibrary detect more than just an ELF file.
Reid Spencer [Wed, 11 Apr 2007 00:49:39 +0000 (00:49 +0000)]
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

17 years agoHack the shared library extension for dylib. The existing code just looks
Reid Spencer [Wed, 11 Apr 2007 00:33:43 +0000 (00:33 +0000)]
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

17 years agoHopefully fix LTDL_SHLIB_EXT on Darwin
Reid Spencer [Wed, 11 Apr 2007 00:27:39 +0000 (00:27 +0000)]
Hopefully fix LTDL_SHLIB_EXT on Darwin

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35872 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdd support for our first SSSE3 instruction "pmulhrsw".
Bill Wendling [Tue, 10 Apr 2007 22:10:25 +0000 (22:10 +0000)]
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

17 years agoNew test case.
Devang Patel [Tue, 10 Apr 2007 21:43:01 +0000 (21:43 +0000)]
New test case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35868 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agonew micro optzn
Chris Lattner [Tue, 10 Apr 2007 21:14:01 +0000 (21:14 +0000)]
new micro optzn

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35867 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoCorrectly report version of GCC used.
Jeff Cohen [Tue, 10 Apr 2007 19:13:43 +0000 (19:13 +0000)]
Correctly report version of GCC used.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35866 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdd test case for PR 1154.
Devang Patel [Tue, 10 Apr 2007 16:57:08 +0000 (16:57 +0000)]
Add test case for PR 1154.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35865 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agofix a comment bug Reid noticed
Chris Lattner [Tue, 10 Apr 2007 16:33:06 +0000 (16:33 +0000)]
fix a comment bug Reid noticed

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35864 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoEnable loop rotate pass.
Devang Patel [Tue, 10 Apr 2007 15:43:36 +0000 (15:43 +0000)]
Enable loop rotate pass.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35863 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoadd missing methods, mark stuff const
Chris Lattner [Tue, 10 Apr 2007 07:06:21 +0000 (07:06 +0000)]
add missing methods, mark stuff const

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35862 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agogetLimitedValue now just forward to APInt's getLimitedValue. Mark it const.
Chris Lattner [Tue, 10 Apr 2007 06:44:12 +0000 (06:44 +0000)]
getLimitedValue now just forward to APInt's getLimitedValue.  Mark it const.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35861 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoadd a method
Chris Lattner [Tue, 10 Apr 2007 06:43:18 +0000 (06:43 +0000)]
add a method

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35860 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agorestore support for negative strides
Chris Lattner [Tue, 10 Apr 2007 03:48:29 +0000 (03:48 +0000)]
restore support for negative strides

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35859 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoapparently some people commit without building the tree, or they forget to
Chris Lattner [Tue, 10 Apr 2007 03:20:39 +0000 (03:20 +0000)]
apparently some people commit without building the tree, or they forget to
commit a LOT of files.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35858 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agounbreak the build :(
Chris Lattner [Tue, 10 Apr 2007 03:18:19 +0000 (03:18 +0000)]
unbreak the build :(

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35857 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix build problem.
Jeff Cohen [Tue, 10 Apr 2007 03:10:46 +0000 (03:10 +0000)]
Fix build problem.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35856 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoDrop the "bit" prefix for the part.select intrinsic.
Reid Spencer [Tue, 10 Apr 2007 02:52:46 +0000 (02:52 +0000)]
Drop the "bit" prefix for the part.select intrinsic.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35854 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix name of an intrinsic: bit.part_select -> part.select
Reid Spencer [Tue, 10 Apr 2007 02:51:31 +0000 (02:51 +0000)]
Fix name of an intrinsic: bit.part_select -> part.select

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35853 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoStrengthen the boundary conditions of this fold, implementing
Chris Lattner [Mon, 9 Apr 2007 23:52:13 +0000 (23:52 +0000)]
Strengthen the boundary conditions of this fold, implementing
InstCombine/set.ll:test25

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35852 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agonew testcase
Chris Lattner [Mon, 9 Apr 2007 23:51:49 +0000 (23:51 +0000)]
new testcase

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35851 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoNo longer needed.
Jeff Cohen [Mon, 9 Apr 2007 23:42:32 +0000 (23:42 +0000)]
No longer needed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35850 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdd check for opt crash.
Devang Patel [Mon, 9 Apr 2007 23:40:15 +0000 (23:40 +0000)]
Add check for opt crash.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35849 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoRe-constify things that don't break the build. Last patch in this
Owen Anderson [Mon, 9 Apr 2007 23:38:18 +0000 (23:38 +0000)]
Re-constify things that don't break the build.  Last patch in this
series, I promise.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35848 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoremove dead target hooks.
Chris Lattner [Mon, 9 Apr 2007 23:34:08 +0000 (23:34 +0000)]
remove dead target hooks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35847 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoremove dead target hooks
Chris Lattner [Mon, 9 Apr 2007 23:33:39 +0000 (23:33 +0000)]
remove dead target hooks

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35846 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoremove some dead hooks
Chris Lattner [Mon, 9 Apr 2007 23:31:19 +0000 (23:31 +0000)]
remove some dead hooks

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35845 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoeliminate the last uses of some TLI methods.
Chris Lattner [Mon, 9 Apr 2007 23:29:07 +0000 (23:29 +0000)]
eliminate the last uses of some TLI methods.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35844 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoUnconst-ify stuff that broke the build.
Owen Anderson [Mon, 9 Apr 2007 23:08:26 +0000 (23:08 +0000)]
Unconst-ify stuff that broke the build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35843 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoConst-ify some parameters, and some cosmetic cleanups. No functionality
Owen Anderson [Mon, 9 Apr 2007 22:54:50 +0000 (22:54 +0000)]
Const-ify some parameters, and some cosmetic cleanups.  No functionality
change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35842 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoTabs -> Spaces
Owen Anderson [Mon, 9 Apr 2007 22:31:43 +0000 (22:31 +0000)]
Tabs -> Spaces

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35841 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoremove some dead target hooks, subsumed by isLegalAddressingMode
Chris Lattner [Mon, 9 Apr 2007 22:27:04 +0000 (22:27 +0000)]
remove some dead target hooks, subsumed by isLegalAddressingMode

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35840 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoImprove some _slow_ behavior introduced in my patches the last few days.
Owen Anderson [Mon, 9 Apr 2007 22:25:09 +0000 (22:25 +0000)]
Improve some _slow_ behavior introduced in my patches the last few days.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35839 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdd Loop Rotate test cases.
Devang Patel [Mon, 9 Apr 2007 22:22:42 +0000 (22:22 +0000)]
Add Loop Rotate test cases.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35838 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoswitch LSR to use isLegalAddressingMode instead of other simpler hooks
Chris Lattner [Mon, 9 Apr 2007 22:20:14 +0000 (22:20 +0000)]
switch LSR to use isLegalAddressingMode instead of other simpler hooks

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35837 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoCheck _all_ PHINodes.
Devang Patel [Mon, 9 Apr 2007 22:20:10 +0000 (22:20 +0000)]
Check _all_ PHINodes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35836 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix a bug in PPCTargetLowering::isLegalAddressingMode, scales other than 0/1/2
Chris Lattner [Mon, 9 Apr 2007 22:10:05 +0000 (22:10 +0000)]
Fix a bug in PPCTargetLowering::isLegalAddressingMode, scales other than 0/1/2
are always unsupported.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35835 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoUse integer log for metric calculation
Anton Korobeynikov [Mon, 9 Apr 2007 21:57:03 +0000 (21:57 +0000)]
Use integer log for metric calculation

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35834 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoInsert new pre-header before new header. Original pre-header may
Devang Patel [Mon, 9 Apr 2007 21:40:43 +0000 (21:40 +0000)]
Insert new pre-header before new header. Original pre-header may
happen to be an entry, in such case, it is not a good idea to
insert new block before entry.

Also fix typo in assertion check.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35833 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoadd a default ctor for AddrMode.
Chris Lattner [Mon, 9 Apr 2007 21:18:34 +0000 (21:18 +0000)]
add a default ctor for AddrMode.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35832 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix a bug where calling materializeModule could corrupt the module, reading
Chris Lattner [Mon, 9 Apr 2007 20:28:40 +0000 (20:28 +0000)]
Fix a bug where calling materializeModule could corrupt the module, reading
multiple copies of the function into the Function*.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35831 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoPreserve canonical loop form.
Devang Patel [Mon, 9 Apr 2007 20:19:46 +0000 (20:19 +0000)]
Preserve canonical loop form.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35829 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoWhen the number of elements is zero, don't malloc 32GB on 64-bit systems.
Jeff Cohen [Mon, 9 Apr 2007 19:26:30 +0000 (19:26 +0000)]
When the number of elements is zero, don't malloc 32GB on 64-bit systems.

Fixes unexpected failures on FreeBSD/amd64 of:
  CFrontend/2005-09-24-BitFieldCrash.c:
  CFrontend/2007-02-04-EmptyStruct.c:
  CFrontend/2007-03-26-ZeroWidthBitfield.c:
  CodeGen/Generic/2005-10-18-ZeroSizeStackObject.ll:

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35828 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoDon't link against System or Support library. These things will already
Reid Spencer [Mon, 9 Apr 2007 19:17:47 +0000 (19:17 +0000)]
Don't link against System or Support library. These things will already
be in the opt tool.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35827 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoSpeed up installation a bit by ignoring .svn directories.
Reid Spencer [Mon, 9 Apr 2007 19:08:58 +0000 (19:08 +0000)]
Speed up installation a bit by ignoring .svn directories.

Patch by Scott Michel.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35826 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoDo not create new pre-header. Reuse original pre-header.
Devang Patel [Mon, 9 Apr 2007 19:04:21 +0000 (19:04 +0000)]
Do not create new pre-header. Reuse original pre-header.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35825 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFor PR1146:
Reid Spencer [Mon, 9 Apr 2007 18:00:57 +0000 (18:00 +0000)]
For PR1146:
* Add ParamAttrs to InvokeInst class too.
* Make sure all initializes of ParamAttrs in CallInst and InvokeInst are 0
* Destruct the ParamAttrs in Call/Invoke destructors to avoid memory
  leaks. This will change when ParamAttrsList is uniquified but needs to
  be correct until then.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35824 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoRemove a memory leak, until ParamAttrsList is uniqued.
Reid Spencer [Mon, 9 Apr 2007 17:20:18 +0000 (17:20 +0000)]
Remove a memory leak, until ParamAttrsList is uniqued.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35823 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoSimpler for() loops.
Devang Patel [Mon, 9 Apr 2007 17:09:13 +0000 (17:09 +0000)]
Simpler for() loops.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35822 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix future bug. Of course, Chris spotted this.
Devang Patel [Mon, 9 Apr 2007 16:41:46 +0000 (16:41 +0000)]
Fix future bug. Of course, Chris spotted this.
Handle Argument or Undef as an incoming PHI value.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35821 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoMore cosmetic changes.
Devang Patel [Mon, 9 Apr 2007 16:21:29 +0000 (16:21 +0000)]
More cosmetic changes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35820 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoOnly cosmetic changes. Zero functionality Change.
Devang Patel [Mon, 9 Apr 2007 16:11:48 +0000 (16:11 +0000)]
Only cosmetic changes. Zero functionality Change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35819 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFor PR1146:
Reid Spencer [Mon, 9 Apr 2007 15:01:12 +0000 (15:01 +0000)]
For PR1146:
* Add ParamAttrList pointers to Function and CallInst.
* Move the implementation of ParamAttrList from Type.cpp to Function.cpp

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35818 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoUnbreak VC++ build.
Jeff Cohen [Mon, 9 Apr 2007 14:32:59 +0000 (14:32 +0000)]
Unbreak VC++ build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35817 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoNext stage into switch lowering refactoring
Anton Korobeynikov [Mon, 9 Apr 2007 12:31:58 +0000 (12:31 +0000)]
Next stage into switch lowering refactoring
1. Fix some bugs in the jump table lowering threshold
2. Implement much better metric for optimal pivot selection
3. Tune thresholds for different lowering methods
4. Implement shift-and trick for lowering small (<machine word
length) cases with few destinations. Good testcase will follow.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35816 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoConvert ImmediateDominators::DFSPass from being recursive to being iterative.
Chris Lattner [Mon, 9 Apr 2007 06:44:42 +0000 (06:44 +0000)]
Convert ImmediateDominators::DFSPass from being recursive to being iterative.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35815 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFor PR1146:
Reid Spencer [Mon, 9 Apr 2007 06:17:21 +0000 (06:17 +0000)]
For PR1146:
Adapt handling of parameter attributes to use the new ParamAttrsList class.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35814 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoRegenerate
Reid Spencer [Mon, 9 Apr 2007 06:16:21 +0000 (06:16 +0000)]
Regenerate

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35813 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFor PR1146:
Reid Spencer [Mon, 9 Apr 2007 06:15:59 +0000 (06:15 +0000)]
For PR1146:
Adapt handling of parameter attributes to use ParamAttrsList class.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35812 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFor PR1146:
Reid Spencer [Mon, 9 Apr 2007 06:14:31 +0000 (06:14 +0000)]
For PR1146:
Use ParamAttrsList for writing parameter attributes. Since they are sparse
now, we also write them sparsely (saves a few bytes). Unfortunately, this
is a bytecode file format change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35811 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFor PR1146:
Reid Spencer [Mon, 9 Apr 2007 06:12:07 +0000 (06:12 +0000)]
For PR1146:
Simplify construction of FunctionType to use default arguments.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35810 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFor PR1146:
Reid Spencer [Mon, 9 Apr 2007 06:11:23 +0000 (06:11 +0000)]
For PR1146:
Parameter attributes can now be defaulted for intrinsics.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35809 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFor PR1146:
Reid Spencer [Mon, 9 Apr 2007 06:10:42 +0000 (06:10 +0000)]
For PR1146:
Adjust writing of parameter attributes to use ParamAttrList class.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35808 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agominor cleanups
Chris Lattner [Mon, 9 Apr 2007 06:10:06 +0000 (06:10 +0000)]
minor cleanups

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35807 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFor PR1146:
Reid Spencer [Mon, 9 Apr 2007 06:07:52 +0000 (06:07 +0000)]
For PR1146:
Move parameter attributes functionality to ParamAttrsList class.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35806 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFor PR1146:
Reid Spencer [Mon, 9 Apr 2007 06:06:57 +0000 (06:06 +0000)]
For PR1146:
Remove the handling of ParameterAttributes from FunctionType as they are
their own object defined in ParameterAttributes.h now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35805 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agomove a bunch of register constraints from being handled by
Chris Lattner [Mon, 9 Apr 2007 05:49:22 +0000 (05:49 +0000)]
move a bunch of register constraints from being handled by
getRegClassForInlineAsmConstraint to being handled by
getRegForInlineAsmConstraint.  This allows us to let the llvm register allocator
allocate, which gives us better code.  For example, X86/2007-01-29-InlineAsm-ir.ll
used to compile to:

_run_init_process:
        subl $4, %esp
        movl %ebx, (%esp)
        xorl %ebx, %ebx
        movl $11, %eax
        movl %ebx, %ecx
        movl %ebx, %edx
        # InlineAsm Start
        push %ebx ; movl %ebx,%ebx ; int $0x80 ; pop %ebx
        # InlineAsm End

Now we get:
_run_init_process:
        xorl %ecx, %ecx
        movl $11, %eax
        movl %ecx, %edx
        # InlineAsm Start
        push %ebx ; movl %ecx,%ebx ; int $0x80 ; pop %ebx
        # InlineAsm End

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35804 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoimplement support for CodeGen/X86/inline-asm-x-scalar.ll:test3 - i32/i64 values
Chris Lattner [Mon, 9 Apr 2007 05:31:48 +0000 (05:31 +0000)]
implement support for CodeGen/X86/inline-asm-x-scalar.ll:test3 - i32/i64 values
used with x constraints.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35803 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoimplement CodeGen/X86/inline-asm-x-scalar.ll:test3
Chris Lattner [Mon, 9 Apr 2007 05:31:20 +0000 (05:31 +0000)]
implement CodeGen/X86/inline-asm-x-scalar.ll:test3

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35802 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoadd another test
Chris Lattner [Mon, 9 Apr 2007 05:26:48 +0000 (05:26 +0000)]
add another test

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35801 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoadd some assertions
Chris Lattner [Mon, 9 Apr 2007 05:23:13 +0000 (05:23 +0000)]
add some assertions

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35800 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoimplement CodeGen/X86/inline-asm-x-scalar.ll
Chris Lattner [Mon, 9 Apr 2007 05:11:28 +0000 (05:11 +0000)]
implement CodeGen/X86/inline-asm-x-scalar.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35799 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoThe x constraint allows scalar FP values as well as vectors.
Chris Lattner [Mon, 9 Apr 2007 05:11:03 +0000 (05:11 +0000)]
The x constraint allows scalar FP values as well as vectors.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35798 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoMove isReachableFromEntry out of line to avoid an unnecessary #include
Owen Anderson [Mon, 9 Apr 2007 04:07:36 +0000 (04:07 +0000)]
Move isReachableFromEntry out of line to avoid an unnecessary #include

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35797 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix a bug that caused alignment information to occasionally get stripped off
Chris Lattner [Mon, 9 Apr 2007 03:37:36 +0000 (03:37 +0000)]
Fix a bug that caused alignment information to occasionally get stripped off
of an allocation instruction when writing to bytecode.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35796 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoRegenerate
Reid Spencer [Mon, 9 Apr 2007 01:56:05 +0000 (01:56 +0000)]
Regenerate

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35795 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoDrop the implementation keyword.
Reid Spencer [Mon, 9 Apr 2007 01:55:42 +0000 (01:55 +0000)]
Drop the implementation keyword.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35794 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoChris convinced me that the default size of the SmallVector (2) was too
Reid Spencer [Mon, 9 Apr 2007 01:53:54 +0000 (01:53 +0000)]
Chris convinced me that the default size of the SmallVector (2) was too
small.  Since it doesn't cost much to have 2 more (8 bytes), but not having
them would require a malloc as soon as the third one is needed. Setting
the default to 4 delays the malloc until the 5th parameter attribute.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35793 91177308-0d34-0410-b5e6-96231b3b80d8