Commit Graph

31724 Commits

Author SHA1 Message Date
Chris Lattner
efd3051d60 Now that codegen prepare isn't defeating me, I can finally fix what I set
out to do! :)

This fixes a problem where LSR would insert a bunch of code into each MBB
that uses a particular subexpression (e.g. IV+base+C).  The problem is that
this code cannot be CSE'd back together if inserted into different blocks.

This patch changes LSR to attempt to insert a single copy of this code and
share it, allowing codegenprepare to duplicate the code if it can be sunk
into various addressing modes.  On CodeGen/ARM/lsr-code-insertion.ll,
for example, this gives us code like:

        add r8, r0, r5
        str r6, [r8, #+4]
..
        ble LBB1_4      @cond_next
LBB1_3: @cond_true
        str r10, [r8, #+4]
LBB1_4: @cond_next
...
LBB1_5: @cond_true55
        ldr r6, LCPI1_1
        str r6, [r8, #+4]

instead of:

        add r10, r0, r6
        str r8, [r10, #+4]
...
        ble LBB1_4      @cond_next
LBB1_3: @cond_true
        add r8, r0, r6
        str r10, [r8, #+4]
LBB1_4: @cond_next
...
LBB1_5: @cond_true55
        add r8, r0, r6
        ldr r10, LCPI1_1
        str r10, [r8, #+4]

Besides being smaller and more efficient, this makes it immediately
obvious that it is profitable to predicate LBB1_3 now :)

llvm-svn: 35972
2007-04-13 20:42:26 +00:00
Chris Lattner
03bf40e70e new lsr testcase
llvm-svn: 35971
2007-04-13 20:38:14 +00:00
Chris Lattner
feee64e997 Completely rewrite addressing-mode related sinking of code. In particular,
this fixes problems where codegenprepare would sink expressions into load/stores
that are not valid, and fixes cases where it would miss important valid ones.

This fixes several serious codesize and perf issues, particularly on targets
with complex addressing modes like arm and x86.  For example, now we compile
CodeGen/X86/isel-sink.ll to:

_test:
        movl 8(%esp), %eax
        movl 4(%esp), %ecx
        cmpl $1233, %eax
        ja LBB1_2       #F
LBB1_1: #T
        movl $4, (%ecx,%eax,4)
        movl $141, %eax
        ret
LBB1_2: #F
        movl (%ecx,%eax,4), %eax
        ret

instead of:

_test:
        movl 8(%esp), %eax
        leal (,%eax,4), %ecx
        addl 4(%esp), %ecx
        cmpl $1233, %eax
        ja LBB1_2       #F
LBB1_1: #T
        movl $4, (%ecx)
        movl $141, %eax
        ret
LBB1_2: #F
        movl (%ecx), %eax
        ret

llvm-svn: 35970
2007-04-13 20:30:56 +00:00
Chris Lattner
26d9e9c452 New testcase
llvm-svn: 35969
2007-04-13 20:28:08 +00:00
Reid Spencer
9329e7b626 Implement a getBitsNeeded method to determine how many bits are needed to
represent a string in binary form by an APInt.

llvm-svn: 35968
2007-04-13 19:19:07 +00:00
Devang Patel
38705d5494 Remove use of SlowOperationInformer.
llvm-svn: 35967
2007-04-13 18:58:18 +00:00
Devang Patel
b730fe57bf Undo previous check-in.
llvm-svn: 35966
2007-04-13 18:35:15 +00:00
Devang Patel
f929b86140 Hello uses LLVMSupport.a (SlowerOperationInformer)
llvm-svn: 35965
2007-04-13 18:28:23 +00:00
Dan Gohman
a789d31517 Rename Value::getValueType to getValueID, to avoid confusion with
other things named getValueType.

llvm-svn: 35964
2007-04-13 18:12:09 +00:00
Anton Korobeynikov
e288040abf Fix PR1323 : we haven't updated phi nodes in good manner :)
llvm-svn: 35963
2007-04-13 06:53:51 +00:00
Chris Lattner
502c3f48d9 arm has r+r*s and r+i addr modes, but no r+i+r*s addr modes.
llvm-svn: 35962
2007-04-13 06:50:55 +00:00
Zhou Sheng
01c175ec52 Make the apint construction more effective.
llvm-svn: 35960
2007-04-13 05:57:32 +00:00
Chris Lattner
e71f1447f7 CSE simple binary expressions when they are inserted. This makes LSR produce
less huge code that needs to be cleaned up by sdisel.

llvm-svn: 35959
2007-04-13 05:04:18 +00:00
Tanya Lattner
c821a9ac44 Adding target triplet to be passed to database.
llvm-svn: 35958
2007-04-13 04:36:48 +00:00
Reid Spencer
9945235b55 Implement review feedback .. don't double search a set.
llvm-svn: 35957
2007-04-12 21:57:15 +00:00
Reid Spencer
1b9213730f Make sure intrinsics that are lowered to functions make the function weak
linkage so we only end up with one of them in a program. These are, after
all overloaded and templatish in nature.

llvm-svn: 35956
2007-04-12 21:53:38 +00:00
Dale Johannesen
5c87869622 testcases for function linkage
llvm-svn: 35955
2007-04-12 21:01:53 +00:00
Reid Spencer
0ef2ca8da7 Provide support for intrinsics that lower themselves to a function body.
This can happen for intrinsics that are overloaded.  In such cases it is
necessary to emit a function prototype before the body of the function
that calls the intrinsic and to ensure we don't emit it multiple times.

llvm-svn: 35954
2007-04-12 21:00:45 +00:00
Lauro Ramos Venancio
c451ec635f update documentation
llvm-svn: 35953
2007-04-12 20:34:36 +00:00
Lauro Ramos Venancio
0ab204bb36 update documentation
llvm-svn: 35952
2007-04-12 19:52:46 +00:00
Lauro Ramos Venancio
e6818b2549 Implement Thread Local Storage (TLS) in CBackend.
llvm-svn: 35951
2007-04-12 18:42:08 +00:00
Lauro Ramos Venancio
749e4668e7 Implement the "thread_local" keyword.
llvm-svn: 35950
2007-04-12 18:32:50 +00:00
Chris Lattner
ce10cd22c8 vector compares aren't allowed. It doesn't make sense to have an xfailed
test to remind us of this.

llvm-svn: 35949
2007-04-12 18:21:52 +00:00
Chris Lattner
4c964c3aed make this really work on linux :)
llvm-svn: 35948
2007-04-12 18:10:16 +00:00
Chris Lattner
028974508b make this happier on linux hosts
llvm-svn: 35947
2007-04-12 18:09:06 +00:00
Reid Spencer
0f2f65f723 Fix bugs in generated code for part_select and part_set so that llc doesn't
barf when CBE is run with a program that contains these intrinsics.

llvm-svn: 35946
2007-04-12 13:30:14 +00:00
Reid Spencer
83faeb7611 Fix a bug in PartSet. The replacement value needs to be zext or trunc to
the size of the value, not just zext. Also, give better names to two BBs.

llvm-svn: 35945
2007-04-12 12:46:33 +00:00
Chris Lattner
5111499136 the result of an inline asm copy can be an arbitrary VT that the register
class supports.  In the case of vectors, this means we often get the wrong
type (e.g. we get v4f32 instead of v8i16).  Make sure to convert the vector
result to the right type.  This fixes CodeGen/X86/2007-04-11-InlineAsmVectorResult.ll

llvm-svn: 35944
2007-04-12 06:00:20 +00:00
Chris Lattner
a77cb3ce68 fold noop vbitconvert instructions
llvm-svn: 35943
2007-04-12 05:58:43 +00:00
Chris Lattner
9bab80543a new testcase
llvm-svn: 35942
2007-04-12 05:58:21 +00:00
Chris Lattner
784a68a702 Fix weirdness handling single element vectors.
llvm-svn: 35941
2007-04-12 04:44:28 +00:00
Chris Lattner
2805bce656 Fix mmx paddq, add support for the 'y' register class, though it isn't tested.
llvm-svn: 35940
2007-04-12 04:14:49 +00:00
Reid Spencer
09f5000873 Make the shlibext and llvmlibsdir variables accessible.
llvm-svn: 35939
2007-04-12 02:49:30 +00:00
Reid Spencer
c6251a7dfd For PR1284:
Implement the "part_set" intrinsic.

llvm-svn: 35938
2007-04-12 02:48:46 +00:00
Reid Spencer
b817ba74f1 The hello pass actually requires a function to chew on!
llvm-svn: 35937
2007-04-12 01:12:54 +00:00
Reid Spencer
c70afc3818 Fix extra argument in part_set examples. Thanks Zhiru.
llvm-svn: 35936
2007-04-12 01:03:03 +00:00
Chris Lattner
af039c53c0 improve the patch for PR1318 to also support grouped options with custom
handlers (like the pass list).  My previous fix only supported *new* command
line options, not additions to old ones.

This fixes test/Feature/load_module.ll

llvm-svn: 35935
2007-04-12 00:36:29 +00:00
Devang Patel
180ff253ed New test case for PR 1321.
llvm-svn: 35934
2007-04-12 00:32:43 +00:00
Reid Spencer
7972c4758c Fix validation errors.
llvm-svn: 35933
2007-04-11 23:49:50 +00:00
Reid Spencer
14194dc054 Missing end tag. Thanks, Nick.
llvm-svn: 35932
2007-04-11 23:46:06 +00:00
Chris Lattner
8aa5b4545f new testcase.
llvm-svn: 35931
2007-04-11 23:45:16 +00:00
Reid Spencer
3b5856151b Put period inside the paragraph!
llvm-svn: 35930
2007-04-11 23:26:07 +00:00
Reid Spencer
5bf54c868b Document the part_set intrinsic.
llvm-svn: 35929
2007-04-11 23:23:49 +00:00
Reid Spencer
d646073027 Fix a guard that is supposed to guard against mistakes like this patch fixes!
We *really* need to be running these with tcl's "exec" to catch the errors.

llvm-svn: 35928
2007-04-11 22:40:46 +00:00
Chris Lattner
6d87faf14f new testcase
llvm-svn: 35927
2007-04-11 22:36:10 +00:00
Chris Lattner
a5fcd24746 Fix CodeGen/X86/2007-03-24-InlineAsmPModifier.ll
llvm-svn: 35926
2007-04-11 22:29:46 +00:00
Reid Spencer
45fc9400ad The "Hello" message is written on stderr so make sure it is duplicated to
stdout so the grep can match it.

llvm-svn: 35925
2007-04-11 21:30:05 +00:00
Reid Spencer
a28d662816 Add Scott's note about GCC 4.1.2 on OpenSUSE.
llvm-svn: 35924
2007-04-11 21:28:31 +00:00
Reid Spencer
5f89562811 Add a test case for PR1318.
llvm-svn: 35923
2007-04-11 21:14:53 +00:00
Reid Spencer
c78d122a6a Build Hello by default so it can be used in test cases.
llvm-svn: 35922
2007-04-11 21:03:37 +00:00