Chris Lattner [Fri, 13 Apr 2007 20:42:26 +0000 (20:42 +0000)]
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 :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35972
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 13 Apr 2007 20:38:14 +0000 (20:38 +0000)]
new lsr testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35971
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 13 Apr 2007 20:30:56 +0000 (20:30 +0000)]
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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35970
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 13 Apr 2007 20:28:08 +0000 (20:28 +0000)]
New testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35969
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Spencer [Fri, 13 Apr 2007 19:19:07 +0000 (19:19 +0000)]
Implement a getBitsNeeded method to determine how many bits are needed to
represent a string in binary form by an APInt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35968
91177308-0d34-0410-b5e6-
96231b3b80d8
Devang Patel [Fri, 13 Apr 2007 18:58:18 +0000 (18:58 +0000)]
Remove use of SlowOperationInformer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35967
91177308-0d34-0410-b5e6-
96231b3b80d8
Devang Patel [Fri, 13 Apr 2007 18:35:15 +0000 (18:35 +0000)]
Undo previous check-in.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35966
91177308-0d34-0410-b5e6-
96231b3b80d8
Devang Patel [Fri, 13 Apr 2007 18:28:23 +0000 (18:28 +0000)]
Hello uses LLVMSupport.a (SlowerOperationInformer)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35965
91177308-0d34-0410-b5e6-
96231b3b80d8
Dan Gohman [Fri, 13 Apr 2007 18:12:09 +0000 (18:12 +0000)]
Rename Value::getValueType to getValueID, to avoid confusion with
other things named getValueType.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35964
91177308-0d34-0410-b5e6-
96231b3b80d8
Anton Korobeynikov [Fri, 13 Apr 2007 06:53:51 +0000 (06:53 +0000)]
Fix PR1323 : we haven't updated phi nodes in good manner :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35963
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 13 Apr 2007 06:50:55 +0000 (06:50 +0000)]
arm has r+r*s and r+i addr modes, but no r+i+r*s addr modes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35962
91177308-0d34-0410-b5e6-
96231b3b80d8
Zhou Sheng [Fri, 13 Apr 2007 05:57:32 +0000 (05:57 +0000)]
Make the apint construction more effective.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35960
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 13 Apr 2007 05:04:18 +0000 (05:04 +0000)]
CSE simple binary expressions when they are inserted. This makes LSR produce
less huge code that needs to be cleaned up by sdisel.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35959
91177308-0d34-0410-b5e6-
96231b3b80d8
Tanya Lattner [Fri, 13 Apr 2007 04:36:48 +0000 (04:36 +0000)]
Adding target triplet to be passed to database.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35958
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Spencer [Thu, 12 Apr 2007 21:57:15 +0000 (21:57 +0000)]
Implement review feedback .. don't double search a set.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35957
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Spencer [Thu, 12 Apr 2007 21:53:38 +0000 (21:53 +0000)]
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35956
91177308-0d34-0410-b5e6-
96231b3b80d8
Dale Johannesen [Thu, 12 Apr 2007 21:01:53 +0000 (21:01 +0000)]
testcases for function linkage
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35955
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Spencer [Thu, 12 Apr 2007 21:00:45 +0000 (21:00 +0000)]
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35954
91177308-0d34-0410-b5e6-
96231b3b80d8
Lauro Ramos Venancio [Thu, 12 Apr 2007 20:34:36 +0000 (20:34 +0000)]
update documentation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35953
91177308-0d34-0410-b5e6-
96231b3b80d8
Lauro Ramos Venancio [Thu, 12 Apr 2007 19:52:46 +0000 (19:52 +0000)]
update documentation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35952
91177308-0d34-0410-b5e6-
96231b3b80d8
Lauro Ramos Venancio [Thu, 12 Apr 2007 18:42:08 +0000 (18:42 +0000)]
Implement Thread Local Storage (TLS) in CBackend.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35951
91177308-0d34-0410-b5e6-
96231b3b80d8
Lauro Ramos Venancio [Thu, 12 Apr 2007 18:32:50 +0000 (18:32 +0000)]
Implement the "thread_local" keyword.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35950
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 12 Apr 2007 18:21:52 +0000 (18:21 +0000)]
vector compares aren't allowed. It doesn't make sense to have an xfailed
test to remind us of this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35949
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 12 Apr 2007 18:10:16 +0000 (18:10 +0000)]
make this really work on linux :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35948
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 12 Apr 2007 18:09:06 +0000 (18:09 +0000)]
make this happier on linux hosts
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35947
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Spencer [Thu, 12 Apr 2007 13:30:14 +0000 (13:30 +0000)]
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35946
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Spencer [Thu, 12 Apr 2007 12:46:33 +0000 (12:46 +0000)]
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35945
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 12 Apr 2007 06:00:20 +0000 (06:00 +0000)]
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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35944
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 12 Apr 2007 05:58:43 +0000 (05:58 +0000)]
fold noop vbitconvert instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35943
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 12 Apr 2007 05:58:21 +0000 (05:58 +0000)]
new testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35942
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 12 Apr 2007 04:44:28 +0000 (04:44 +0000)]
Fix weirdness handling single element vectors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35941
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 12 Apr 2007 04:14:49 +0000 (04:14 +0000)]
Fix mmx paddq, add support for the 'y' register class, though it isn't tested.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35940
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Spencer [Thu, 12 Apr 2007 02:49:30 +0000 (02:49 +0000)]
Make the shlibext and llvmlibsdir variables accessible.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35939
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Spencer [Thu, 12 Apr 2007 02:48:46 +0000 (02:48 +0000)]
For PR1284:
Implement the "part_set" intrinsic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35938
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Spencer [Thu, 12 Apr 2007 01:12:54 +0000 (01:12 +0000)]
The hello pass actually requires a function to chew on!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35937
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Spencer [Thu, 12 Apr 2007 01:03:03 +0000 (01:03 +0000)]
Fix extra argument in part_set examples. Thanks Zhiru.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35936
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 12 Apr 2007 00:36:29 +0000 (00:36 +0000)]
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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35935
91177308-0d34-0410-b5e6-
96231b3b80d8
Devang Patel [Thu, 12 Apr 2007 00:32:43 +0000 (00:32 +0000)]
New test case for PR 1321.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35934
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Spencer [Wed, 11 Apr 2007 23:49:50 +0000 (23:49 +0000)]
Fix validation errors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35933
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Spencer [Wed, 11 Apr 2007 23:46:06 +0000 (23:46 +0000)]
Missing end tag. Thanks, Nick.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35932
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 11 Apr 2007 23:45:16 +0000 (23:45 +0000)]
new testcase.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35931
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Spencer [Wed, 11 Apr 2007 23:26:07 +0000 (23:26 +0000)]
Put period inside the paragraph!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35930
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Spencer [Wed, 11 Apr 2007 23:23:49 +0000 (23:23 +0000)]
Document the part_set intrinsic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35929
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Spencer [Wed, 11 Apr 2007 22:40:46 +0000 (22:40 +0000)]
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35928
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 11 Apr 2007 22:36:10 +0000 (22:36 +0000)]
new testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35927
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 11 Apr 2007 22:29:46 +0000 (22:29 +0000)]
Fix CodeGen/X86/2007-03-24-InlineAsmPModifier.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35926
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Spencer [Wed, 11 Apr 2007 21:30:05 +0000 (21:30 +0000)]
The "Hello" message is written on stderr so make sure it is duplicated to
stdout so the grep can match it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35925
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Spencer [Wed, 11 Apr 2007 21:28:31 +0000 (21:28 +0000)]
Add Scott's note about GCC 4.1.2 on OpenSUSE.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35924
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Spencer [Wed, 11 Apr 2007 21:14:53 +0000 (21:14 +0000)]
Add a test case for PR1318.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35923
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Spencer [Wed, 11 Apr 2007 21:03:37 +0000 (21:03 +0000)]
Build Hello by default so it can be used in test cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35922
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Spencer [Wed, 11 Apr 2007 21:00:00 +0000 (21:00 +0000)]
Use the new %link variable to make this test portable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35921
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Spencer [Wed, 11 Apr 2007 20:57:39 +0000 (20:57 +0000)]
Make new variables available: compile_c, compile_cxx, link to handle tests
that want to use LLVM's notion of compiling and linking programs. This
includes all the -I -L and optimization switches that LLVM would using to
compile or link any of this files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35920
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Spencer [Wed, 11 Apr 2007 20:06:03 +0000 (20:06 +0000)]
The "implementation" keyword is no more!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35919
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Spencer [Wed, 11 Apr 2007 19:56:59 +0000 (19:56 +0000)]
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
Reid Spencer [Wed, 11 Apr 2007 19:54:37 +0000 (19:54 +0000)]
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
Reid Spencer [Wed, 11 Apr 2007 19:36:27 +0000 (19:36 +0000)]
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
Reid Spencer [Wed, 11 Apr 2007 17:56:23 +0000 (17:56 +0000)]
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
Reid Spencer [Wed, 11 Apr 2007 17:51:03 +0000 (17:51 +0000)]
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
Chris Lattner [Wed, 11 Apr 2007 16:51:53 +0000 (16:51 +0000)]
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
Chris Lattner [Wed, 11 Apr 2007 16:17:12 +0000 (16:17 +0000)]
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
Chris Lattner [Wed, 11 Apr 2007 16:12:27 +0000 (16:12 +0000)]
this got better
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35908
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 11 Apr 2007 16:04:04 +0000 (16:04 +0000)]
adjust test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35907
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 11 Apr 2007 15:45:25 +0000 (15:45 +0000)]
Fix Transforms/ScalarRepl/union-pointer.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35906
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 11 Apr 2007 15:35:18 +0000 (15:35 +0000)]
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
Chris Lattner [Wed, 11 Apr 2007 15:24:04 +0000 (15:24 +0000)]
change test name.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35904
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Spencer [Wed, 11 Apr 2007 13:04:48 +0000 (13:04 +0000)]
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
Reid Spencer [Wed, 11 Apr 2007 13:02:56 +0000 (13:02 +0000)]
Make the generated code for ConstantInt nicer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35902
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Spencer [Wed, 11 Apr 2007 13:00:04 +0000 (13:00 +0000)]
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
Reid Spencer [Wed, 11 Apr 2007 12:46:06 +0000 (12:46 +0000)]
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
Reid Spencer [Wed, 11 Apr 2007 12:41:49 +0000 (12:41 +0000)]
Teach llvm2cpp about packed structure types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35899
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Spencer [Wed, 11 Apr 2007 12:28:56 +0000 (12:28 +0000)]
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
Reid Spencer [Wed, 11 Apr 2007 12:10:58 +0000 (12:10 +0000)]
Regenerate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35897
91177308-0d34-0410-b5e6-
96231b3b80d8
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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