Chris Lattner
eea864472d
Implement simple promotion for cast elimination in instcombine. This is
...
currently very limited, but can be extended in the future. For example,
we now compile:
uint %test30(uint %c1) {
%c2 = cast uint %c1 to ubyte
%c3 = xor ubyte %c2, 1
%c4 = cast ubyte %c3 to uint
ret uint %c4
}
to:
_xor:
movzbl 4(%esp), %eax
xorl $1, %eax
ret
instead of:
_xor:
movb $1, %al
xorb 4(%esp), %al
movzbl %al, %eax
ret
More impressively, we now compile:
struct B { unsigned bit : 1; };
void xor(struct B *b) { b->bit = b->bit ^ 1; }
To (X86/PPC):
_xor:
movl 4(%esp), %eax
xorl $-2147483648, (%eax)
ret
_xor:
lwz r2, 0(r3)
xoris r2, r2, 32768
stw r2, 0(r3)
blr
instead of (X86/PPC):
_xor:
movl 4(%esp), %eax
movl (%eax), %ecx
movl %ecx, %edx
shrl $31, %edx
# TRUNCATE movb %dl, %dl
xorb $1, %dl
movzbl %dl, %edx
andl $2147483647, %ecx
shll $31, %edx
orl %ecx, %edx
movl %edx, (%eax)
ret
_xor:
lwz r2, 0(r3)
srwi r4, r2, 31
xori r4, r4, 1
rlwimi r2, r4, 31, 0, 0
stw r2, 0(r3)
blr
This implements InstCombine/cast.ll:test30.
llvm-svn: 28273
2006-05-13 02:06:03 +00:00
Chris Lattner
5f2a11f1bf
New testcase for instcombine
...
llvm-svn: 28272
2006-05-13 02:00:07 +00:00
Chris Lattner
4bbc1d8e95
Remove some dead variables.
...
Fix a nasty bug in the memcmp optimizer where we used the wrong variable!
llvm-svn: 28269
2006-05-12 23:35:26 +00:00
Chris Lattner
08efc01479
Remove dead stuff
...
llvm-svn: 28268
2006-05-12 23:32:01 +00:00
Chris Lattner
50371a3046
Fix build breakage :(
...
llvm-svn: 28267
2006-05-12 23:26:11 +00:00
Chris Lattner
dbbbabb17b
More coverity fixes
...
llvm-svn: 28266
2006-05-12 21:14:20 +00:00
Chris Lattner
db8caed257
Dead variable
...
llvm-svn: 28265
2006-05-12 21:12:22 +00:00
Chris Lattner
adcb0582d8
Remove dead var, fix bad override.
...
llvm-svn: 28264
2006-05-12 21:09:57 +00:00
Reid Spencer
1a7e67d221
Don't use old-style casts. This prevents compiler warnings when CommandLine.h
...
is used in projects that have stricter warning control than LLVM. This also
helps us find casts more easily if we ever need to.
llvm-svn: 28263
2006-05-12 19:20:55 +00:00
Evan Cheng
772647518f
If the register allocator cannot find a register to spill, try the aliases. If
...
that still fails (because all the register spill weights are inf), just grab
one.
llvm-svn: 28262
2006-05-12 19:07:46 +00:00
Evan Cheng
871a83d4d0
Remove dead code
...
llvm-svn: 28261
2006-05-12 19:03:56 +00:00
Chris Lattner
e020b812f3
Fix accidentally committed patch.
...
llvm-svn: 28260
2006-05-12 18:20:39 +00:00
Chris Lattner
04a8ddfd68
Actually override the right method. :)
...
Bug identified by coverity.
llvm-svn: 28259
2006-05-12 18:19:25 +00:00
Chris Lattner
f741502e85
remove dead variable.
...
llvm-svn: 28258
2006-05-12 18:17:25 +00:00
Chris Lattner
acd1bbfff7
Fix iterator invalidation bug, identified by Coverity.
...
llvm-svn: 28257
2006-05-12 18:13:11 +00:00
Chris Lattner
b1ad13a4bc
Fix a hypothetical memory leak, identified by Coverity. In practice, this
...
object is never deleted though.
llvm-svn: 28256
2006-05-12 18:10:12 +00:00
Chris Lattner
9e29384a4b
Remove dead vars
...
llvm-svn: 28255
2006-05-12 18:06:45 +00:00
Chris Lattner
9a24639afc
remove dead vars
...
llvm-svn: 28254
2006-05-12 18:04:28 +00:00
Chris Lattner
11064741d3
Remove dead variable
...
llvm-svn: 28253
2006-05-12 18:02:04 +00:00
Chris Lattner
474e1b7ef3
Comment out dead variables
...
llvm-svn: 28252
2006-05-12 17:57:54 +00:00
Reid Spencer
ea509eb3ac
When reading the symbol table, make sure to delete the ArchiveMember
...
created by reading the symbol table.
llvm-svn: 28251
2006-05-12 17:56:20 +00:00
Chris Lattner
90527550c1
Remove dead var
...
llvm-svn: 28250
2006-05-12 17:50:35 +00:00
Chris Lattner
9930cf948e
Remove dead variable
...
llvm-svn: 28249
2006-05-12 17:41:45 +00:00
Chris Lattner
9789688d36
remove dead variable.
...
llvm-svn: 28248
2006-05-12 17:33:59 +00:00
Chris Lattner
2c316c91e8
Remove dead variable.
...
llvm-svn: 28247
2006-05-12 17:31:21 +00:00
Chris Lattner
34893c34e5
Avoid defining dead result
...
llvm-svn: 28246
2006-05-12 17:29:40 +00:00
Chris Lattner
60dfdded64
Remove dead return value.
...
llvm-svn: 28245
2006-05-12 17:28:36 +00:00
Chris Lattner
db5b91f6a8
Compile:
...
%tmp152 = setgt uint %tmp144, %tmp149 ; <bool> [#uses=1]
%tmp159 = setlt uint %tmp144, %tmp149 ; <bool> [#uses=1]
%bothcond2 = or bool %tmp152, %tmp159 ; <bool> [#uses=1]
To setne, not setune, which causes an assertion fault.
llvm-svn: 28244
2006-05-12 17:03:46 +00:00
Chris Lattner
bcd2c4f32d
Fix PowerPC/2006-05-12-rlwimi-crash.ll
...
Nate, please verify that if InsertMask is 0, rlwimi shouldn't be used.
This fixes the crash and causes no PPC testsuite regressions.
llvm-svn: 28243
2006-05-12 16:29:37 +00:00
Chris Lattner
436447489d
new testcase for a recent rlwimi crash.
...
llvm-svn: 28242
2006-05-12 16:28:13 +00:00
Evan Cheng
409dd126bf
Noop instruction
...
llvm-svn: 28241
2006-05-12 07:47:00 +00:00
Evan Cheng
3d1e1ffd9b
Unused instruction
...
llvm-svn: 28240
2006-05-12 07:42:01 +00:00
Owen Anderson
1245bd420e
Add a method to generate a string representation from a TargetData.
...
This continues the work on PR 761.
llvm-svn: 28239
2006-05-12 07:01:44 +00:00
Owen Anderson
29e4d70aed
Refactor a bunch of includes so that TargetMachine.h doesn't have to include
...
TargetData.h. This should make recompiles a bit faster with my current
TargetData tinkering.
llvm-svn: 28238
2006-05-12 06:33:49 +00:00
Owen Anderson
a0a9e4584a
Fix some tabbing issues.
...
llvm-svn: 28237
2006-05-12 06:06:55 +00:00
Evan Cheng
f3d7bb7a9e
Backing out fix for PR770. Need to re-apply it after live range splitting is possible
...
llvm-svn: 28236
2006-05-12 06:06:34 +00:00
Evan Cheng
c24d0f281c
Duh. That could take a long time.
...
llvm-svn: 28235
2006-05-12 06:05:18 +00:00
Owen Anderson
30ffff31f2
Add a new constructor to TargetData that builds a TargetData from its
...
string representation.
This is part of PR 761.
llvm-svn: 28234
2006-05-12 05:49:47 +00:00
Chris Lattner
a500852895
Two simplifications for token factor nodes: simplify tf(x,x) -> x.
...
simplify tf(x,y,y,z) -> tf(x,y,z).
llvm-svn: 28233
2006-05-12 05:01:37 +00:00
Evan Cheng
787496ebcd
New scheduling test case.
...
llvm-svn: 28232
2006-05-12 01:59:17 +00:00
Evan Cheng
0b8e4bca80
Add capability to scheduler to commute nodes for profit.
...
If a two-address code whose first operand has uses below, it should be commuted
when possible.
llvm-svn: 28230
2006-05-12 01:58:24 +00:00
Evan Cheng
eb67c0f664
Typo! How did we commute nodes before?!
...
llvm-svn: 28229
2006-05-12 01:46:26 +00:00
Chris Lattner
14cdcc59b8
For extra sanity checking, fill free'd memory with garbage so we know that
...
people aren't reusing machine code buffers at all.
llvm-svn: 28228
2006-05-12 00:03:12 +00:00
Chris Lattner
ecc6d6f334
Fix some bugs in the freelist manipulation code.
...
Finally, implement ExecutionEngine::freeMachineCodeForFunction.
llvm-svn: 28227
2006-05-11 23:56:57 +00:00
Evan Cheng
cb2a0f392c
Refactor scheduler code. Move register-reduction list scheduler to a
...
separate file. Added an initial implementation of top-down register pressure
reduction list scheduler.
llvm-svn: 28226
2006-05-11 23:55:42 +00:00
Chris Lattner
81a3c90080
Significantly revamp allocation of machine code to use free lists, real
...
allocation policies and much more. All this complexity, and we have no
functionality change, woo! :)
llvm-svn: 28225
2006-05-11 23:08:08 +00:00
Chris Lattner
3fad520c62
Refactor some code, making it simpler.
...
When doing the initial pass of constant folding, if we get a constantexpr,
simplify the constant expr like we would do if the constant is folded in the
normal loop.
This fixes the missed-optimization regression in
Transforms/InstCombine/getelementptr.ll last night.
llvm-svn: 28224
2006-05-11 17:11:52 +00:00
Evan Cheng
6a08dd641a
Add MOV16_rm / MOV32_rm and MOV16_mr / MOV32_mr to isLoadFromStackSlot and isStoreToStackSlot
...
llvm-svn: 28223
2006-05-11 07:33:49 +00:00
Evan Cheng
e2cebf972d
Also add super- register class info.
...
llvm-svn: 28222
2006-05-11 07:31:44 +00:00
Evan Cheng
d6549daf76
Also add super- register classes info.
...
llvm-svn: 28221
2006-05-11 07:30:26 +00:00