Jeff Cohen
5959f42498
Comment out usage of write() for now.
...
llvm-svn: 36287
2007-04-20 22:40:10 +00:00
Devang Patel
83a3adcc3f
Avoid recursion.
...
llvm-svn: 36272
2007-04-20 20:04:37 +00:00
Owen Anderson
2da606c757
Move more passes to using ETForest instead of DominatorTree.
...
llvm-svn: 36271
2007-04-20 06:27:13 +00:00
Zhou Sheng
aafe4e216e
Make use of ConstantInt::isZero instead of ConstantInt::isNullValue.
...
llvm-svn: 36261
2007-04-19 05:39:12 +00:00
Zhou Sheng
82fcf3cb5f
Make the operations of APInt variables more efficient.
...
llvm-svn: 36260
2007-04-19 05:35:00 +00:00
Evan Cheng
db9b65d67a
Revert Owen's last check-in. This is breaking Mac OS X / PPC llvm-gcc bootstrap.
...
llvm-svn: 36258
2007-04-18 22:39:00 +00:00
Owen Anderson
9421f03959
Revert changes that caused breakage.
...
llvm-svn: 36255
2007-04-18 06:46:57 +00:00
Owen Anderson
9a6091dec1
Switch more uses of DominatorTree over to ETForest.
...
llvm-svn: 36254
2007-04-18 05:43:13 +00:00
Owen Anderson
550e8db9c7
Use ETForest instead of DominatorTree.
...
llvm-svn: 36252
2007-04-18 05:25:43 +00:00
Owen Anderson
fc40d446c9
Use ETForest instead of DominatorTree.
...
llvm-svn: 36249
2007-04-18 04:55:33 +00:00
Owen Anderson
08293fd6d1
Use new ETForest accessor.
...
llvm-svn: 36248
2007-04-18 04:46:35 +00:00
Owen Anderson
f38f2f2394
Use ETForest instead of DominatorTree.
...
llvm-svn: 36247
2007-04-18 04:39:32 +00:00
Dan Gohman
2ce1116b33
Spell doFinalization right, so that it is a proper virtual override and
...
gets called.
llvm-svn: 36208
2007-04-17 18:21:36 +00:00
Chris Lattner
233f97ac6a
remove use of BasicBlock::getNext
...
llvm-svn: 36205
2007-04-17 18:09:47 +00:00
Chris Lattner
24e2d9ca03
remove use of BasicBlock::getNext
...
llvm-svn: 36202
2007-04-17 17:54:12 +00:00
Chris Lattner
cd9bda71a0
eliminate use of Instruction::getNext()
...
llvm-svn: 36200
2007-04-17 17:51:03 +00:00
Chris Lattner
77a3edcb92
remove use of Instruction::getNext
...
llvm-svn: 36199
2007-04-17 17:47:54 +00:00
Devang Patel
abdff3fecd
Fix
...
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070416/047888.html
llvm-svn: 36182
2007-04-16 23:03:45 +00:00
Anton Korobeynikov
fb80151c42
Removed tabs everywhere except autogenerated & external files. Add make
...
target for tabs checking.
llvm-svn: 36146
2007-04-16 18:10:23 +00:00
Chris Lattner
343c88cdb9
Fix PR1335 and Transforms/Inline/2007-04-15-InlineEH.ll
...
llvm-svn: 36090
2007-04-15 21:38:06 +00:00
Owen Anderson
f35a1dbc7a
Remove ImmediateDominator analysis. The same information can be obtained from DomTree. A lot of code for
...
constructing ImmediateDominator is now folded into DomTree construction.
This is part of the ongoing work for PR217.
llvm-svn: 36063
2007-04-15 08:47:27 +00:00
Chris Lattner
f8a7bf317e
fix SimplifyLibCalls/IsDigit.ll
...
llvm-svn: 36047
2007-04-15 05:38:40 +00:00
Chris Lattner
4a6e0cbd41
Extend store merging to support the 'if/then' version in addition to if/then/else.
...
This sinks the two stores in this example into a single store in cond_next. In this
case, it allows elimination of the load as well:
store double 0.000000e+00, double* @s.3060
%tmp3 = fcmp ogt double %tmp1, 5.000000e-01 ; <i1> [#uses=1]
br i1 %tmp3, label %cond_true, label %cond_next
cond_true: ; preds = %entry
store double 1.000000e+00, double* @s.3060
br label %cond_next
cond_next: ; preds = %entry, %cond_true
%tmp6 = load double* @s.3060 ; <double> [#uses=1]
This implements Transforms/InstCombine/store-merge.ll:test2
llvm-svn: 36040
2007-04-15 01:02:18 +00:00
Chris Lattner
14a251b937
refactor some code, no functionality change.
...
llvm-svn: 36037
2007-04-15 00:07:55 +00:00
Chris Lattner
28d921d04f
fix long lines
...
llvm-svn: 36031
2007-04-14 23:32:02 +00:00
Chris Lattner
7bfdd0abe1
Implement Transforms/InstCombine/vec_extract_elt.ll, transforming:
...
define i32 @test(float %f) {
%tmp7 = insertelement <4 x float> undef, float %f, i32 0
%tmp17 = bitcast <4 x float> %tmp7 to <4 x i32>
%tmp19 = extractelement <4 x i32> %tmp17, i32 0
ret i32 %tmp19
}
into:
define i32 @test(float %f) {
%tmp19 = bitcast float %f to i32 ; <i32> [#uses=1]
ret i32 %tmp19
}
On PPC, this is the difference between:
_test:
mfspr r2, 256
oris r3, r2, 8192
mtspr 256, r3
stfs f1, -16(r1)
addi r3, r1, -16
addi r4, r1, -32
lvx v2, 0, r3
stvx v2, 0, r4
lwz r3, -32(r1)
mtspr 256, r2
blr
and:
_test:
stfs f1, -4(r1)
nop
nop
nop
lwz r3, -4(r1)
blr
llvm-svn: 36025
2007-04-14 23:02:14 +00:00
Chris Lattner
b37fb6a0da
Implement InstCombine/vec_demanded_elts.ll:test2. This allows us to turn
...
unsigned test(float f) {
return _mm_cvtsi128_si32( (__m128i) _mm_set_ss( f*f ));
}
into:
_test:
movss 4(%esp), %xmm0
mulss %xmm0, %xmm0
movd %xmm0, %eax
ret
instead of:
_test:
movss 4(%esp), %xmm0
mulss %xmm0, %xmm0
xorps %xmm1, %xmm1
movss %xmm0, %xmm1
movd %xmm1, %eax
ret
GCC gets:
_test:
subl $28, %esp
movss 32(%esp), %xmm0
mulss %xmm0, %xmm0
xorps %xmm1, %xmm1
movss %xmm0, %xmm1
movaps %xmm1, %xmm0
movd %xmm0, 12(%esp)
movl 12(%esp), %eax
addl $28, %esp
ret
llvm-svn: 36020
2007-04-14 22:29:23 +00:00
Chris Lattner
a6b5660209
avoid copying sets and vectors around.
...
llvm-svn: 36017
2007-04-14 22:10:17 +00:00
Chris Lattner
6f58839b20
avoid iterator invalidation.
...
llvm-svn: 36002
2007-04-14 18:06:52 +00:00
Jeff Cohen
4bd0fd367a
An even better fix.
...
llvm-svn: 35998
2007-04-14 17:18:29 +00:00
Jeff Cohen
7233aa9369
Fix recent regression that broke several llvm-tests.
...
llvm-svn: 35996
2007-04-14 16:55:19 +00:00
Chris Lattner
49fa8d2bff
Implement a few missing xforms: printf("foo\n") -> puts. printf("x") -> putchar
...
printf("") -> noop. Still need to do the xforms for fprintf.
This implements Transforms/SimplifyLibCalls/Printf.ll
llvm-svn: 35984
2007-04-14 01:17:48 +00:00
Chris Lattner
02137eec8f
in addition to merging, constantmerge should also delete trivially dead globals,
...
in order to clean up after simplifylibcalls.
llvm-svn: 35982
2007-04-14 01:11:54 +00:00
Chris Lattner
efb33d28c6
Implement PR1201 and test/Transforms/InstCombine/malloc-free-delete.ll
...
llvm-svn: 35981
2007-04-14 00:20:02 +00:00
Chris Lattner
164b76565b
use an accessor to simplify code.
...
llvm-svn: 35979
2007-04-14 00:17:39 +00:00
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
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
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
Lauro Ramos Venancio
749e4668e7
Implement the "thread_local" keyword.
...
llvm-svn: 35950
2007-04-12 18:32:50 +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
Chris Lattner
5ee4d0726a
Fix Transforms/ScalarRepl/union-pointer.ll
...
llvm-svn: 35906
2007-04-11 15:45:25 +00:00
Chris Lattner
74ff60ff84
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]
llvm-svn: 35891
2007-04-11 06:57:46 +00:00
Chris Lattner
d0f7942e23
Simplify some comparisons to arithmetic, this implements:
...
Transforms/InstCombine/icmp.ll
llvm-svn: 35890
2007-04-11 06:53:04 +00:00
Chris Lattner
20f2372a7c
canonicalize (x <u 2147483648) -> (x >s -1) and (x >u 2147483647) -> (x <s 0)
...
llvm-svn: 35886
2007-04-11 06:12:58 +00:00
Chris Lattner
7ddbff090a
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.
llvm-svn: 35885
2007-04-11 05:45:39 +00:00
Chris Lattner
32104034f8
fix a regression introduced by my last patch.
...
llvm-svn: 35879
2007-04-11 03:27:24 +00:00
Chris Lattner
daa012d1fb
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 :)
llvm-svn: 35875
2007-04-11 00:57:54 +00:00
Chris Lattner
467b69cabb
Strengthen the boundary conditions of this fold, implementing
...
InstCombine/set.ll:test25
llvm-svn: 35852
2007-04-09 23:52:13 +00:00
Owen Anderson
3c7867935e
Re-constify things that don't break the build. Last patch in this
...
series, I promise.
llvm-svn: 35848
2007-04-09 23:38:18 +00:00
Chris Lattner
3e9690f987
eliminate the last uses of some TLI methods.
...
llvm-svn: 35844
2007-04-09 23:29:07 +00:00
Owen Anderson
f1ca1376d3
Unconst-ify stuff that broke the build.
...
llvm-svn: 35843
2007-04-09 23:08:26 +00:00
Owen Anderson
5917716146
Const-ify some parameters, and some cosmetic cleanups. No functionality
...
change.
llvm-svn: 35842
2007-04-09 22:54:50 +00:00
Owen Anderson
e0ef5ac6bd
Tabs -> Spaces
...
llvm-svn: 35841
2007-04-09 22:31:43 +00:00
Owen Anderson
83efbc84f7
Improve some _slow_ behavior introduced in my patches the last few days.
...
llvm-svn: 35839
2007-04-09 22:25:09 +00:00
Chris Lattner
780c009756
switch LSR to use isLegalAddressingMode instead of other simpler hooks
...
llvm-svn: 35837
2007-04-09 22:20:14 +00:00
Devang Patel
bca0d57179
Check _all_ PHINodes.
...
llvm-svn: 35836
2007-04-09 22:20:10 +00:00
Devang Patel
8eb8eeada9
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.
llvm-svn: 35833
2007-04-09 21:40:43 +00:00
Devang Patel
854197884b
Preserve canonical loop form.
...
llvm-svn: 35829
2007-04-09 20:19:46 +00:00
Reid Spencer
8436cdfda2
Don't link against System or Support library. These things will already
...
be in the opt tool.
llvm-svn: 35827
2007-04-09 19:17:47 +00:00
Devang Patel
b9af5747a5
Do not create new pre-header. Reuse original pre-header.
...
llvm-svn: 35825
2007-04-09 19:04:21 +00:00
Devang Patel
03d7ae3a74
Simpler for() loops.
...
llvm-svn: 35822
2007-04-09 17:09:13 +00:00
Devang Patel
d6ba41e02d
Fix future bug. Of course, Chris spotted this.
...
Handle Argument or Undef as an incoming PHI value.
llvm-svn: 35821
2007-04-09 16:41:46 +00:00
Devang Patel
b28a391a8d
More cosmetic changes.
...
llvm-svn: 35820
2007-04-09 16:21:29 +00:00
Devang Patel
88bc2c6f82
Only cosmetic changes. Zero functionality Change.
...
llvm-svn: 35819
2007-04-09 16:11:48 +00:00
Chris Lattner
a87c9f6114
Fix PR1304 and Transforms/InstCombine/2007-04-08-SingleEltVectorCrash.ll
...
llvm-svn: 35792
2007-04-09 01:37:55 +00:00
Chris Lattner
4ca9cbb170
Eliminate useless insertelement instructions. This implements
...
Transforms/InstCombine/vec_insertelt.ll and fixes PR1286.
We now compile the code from that bug into:
_foo:
movl 4(%esp), %eax
movdqa (%eax), %xmm0
movl 8(%esp), %ecx
psllw (%ecx), %xmm0
movdqa %xmm0, (%eax)
ret
instead of:
_foo:
subl $4, %esp
movl %ebp, (%esp)
movl %esp, %ebp
movl 12(%ebp), %eax
movdqa (%eax), %xmm0
#IMPLICIT_DEF %eax
pinsrw $2, %eax, %xmm0
xorl %ecx, %ecx
pinsrw $3, %ecx, %xmm0
pinsrw $4, %eax, %xmm0
pinsrw $5, %ecx, %xmm0
pinsrw $6, %eax, %xmm0
pinsrw $7, %ecx, %xmm0
movl 8(%ebp), %eax
movdqa (%eax), %xmm1
psllw %xmm0, %xmm1
movdqa %xmm1, (%eax)
movl %ebp, %esp
popl %ebp
ret
woo :)
llvm-svn: 35788
2007-04-09 01:11:16 +00:00
Owen Anderson
ae39ca037a
Cleanup some from my DomSet-removal changes. Add a new
...
isReachableFromEntry
test to ETForest to factor a common test out of code.
llvm-svn: 35786
2007-04-09 00:52:49 +00:00
Chris Lattner
aa8ad10c2f
Fix a typo that broke SimplifyLibCalls/SPrintF.ll (pr1315)
...
llvm-svn: 35768
2007-04-08 18:11:26 +00:00
Chris Lattner
c8d3788f71
reenable this xform, whoops :)
...
llvm-svn: 35765
2007-04-08 08:01:49 +00:00
Chris Lattner
7621a031d8
Fix regression on Instcombine/apint-or2.ll
...
llvm-svn: 35763
2007-04-08 07:55:22 +00:00
Chris Lattner
1150df9cc4
Generalize the code that handles (A&B)|(A&C) to work where B/C are not constants.
...
Add a new xform to simplify (A&B)|(~A&C). THis implements InstCombine/or2.ll:test1
llvm-svn: 35760
2007-04-08 07:47:01 +00:00
Chris Lattner
5717981e5d
implement a fixme: move optimizations for fwrite out of fputs into a new
...
fwrite optimizer.
llvm-svn: 35758
2007-04-08 07:00:35 +00:00
Nick Lewycky
e6c64466c7
Remove DominatorSet usage from LoopSimplify. Patch from Owen Anderson.
...
llvm-svn: 35757
2007-04-08 01:04:30 +00:00
Chris Lattner
182a945fb5
Significantly simplify the clients of GetConstantStringInfo, by having it
...
just return the string itself.
llvm-svn: 35755
2007-04-07 21:58:02 +00:00
Chris Lattner
08c0b8b3c8
Fix problems in the sprintf optimizer
...
llvm-svn: 35754
2007-04-07 21:17:51 +00:00
Chris Lattner
bed184cbcf
Change CastToCStr to take a pointer instead of a reference.
...
Fix some miscompilations in fprintf optimizer.
llvm-svn: 35753
2007-04-07 21:04:50 +00:00
Chris Lattner
898d698d9f
Fix an off-by-one error that broke Prolangs/deriv2 with llc on x86
...
and Prolangs-C/cdecl
llvm-svn: 35749
2007-04-07 20:19:08 +00:00
Owen Anderson
f7ebea1b9f
Add DomSet back, and revert the changes to LoopSimplify. Apparently the
...
ETForest updating mechanisms don't work as I thought they did. These changes
will be reapplied once the issue is worked out.
llvm-svn: 35741
2007-04-07 18:23:27 +00:00
Nick Lewycky
d4f51a8ae3
Add support for cast instructions.
...
llvm-svn: 35734
2007-04-07 15:48:32 +00:00
Owen Anderson
8763ba1b88
Completely purge DomSet. This is the (hopefully) final patch for PR1171.
...
llvm-svn: 35731
2007-04-07 07:17:27 +00:00
Owen Anderson
706e97049d
Completely purge DomSet from LoopSimplify. This is part of the
...
continuing work on PR1171.
llvm-svn: 35730
2007-04-07 06:56:47 +00:00
Owen Anderson
d03a646f06
BreakCriticalEdges does still preserve DominatorTree.
...
llvm-svn: 35729
2007-04-07 05:57:09 +00:00
Owen Anderson
b39d9ca902
Expunge DomSet from BreakCriticalEdges. This is part of the continuing
...
work for PR 1171.
llvm-svn: 35728
2007-04-07 05:49:29 +00:00
Owen Anderson
f095bf3ac4
Expunge DomSet from CodeExtractor. This is part of the continuing work
...
on PR1171.
llvm-svn: 35726
2007-04-07 05:31:27 +00:00
Nick Lewycky
93f541057b
Support NE inequality in ValueRanges.
...
llvm-svn: 35724
2007-04-07 04:49:12 +00:00
Owen Anderson
910419596e
Expunge a bunch of uses of DomSet from LoopSimplify. Many more remain.
...
This is the beginning of work for PR1171.
llvm-svn: 35720
2007-04-07 04:37:14 +00:00
Nick Lewycky
3bb6de85d1
Cleanup. Refactor out the applying of value ranges to its own method.
...
llvm-svn: 35719
2007-04-07 03:36:51 +00:00
Nick Lewycky
12d44abe0f
Use TargetData to find the size of a type.
...
llvm-svn: 35718
2007-04-07 03:16:12 +00:00
Nick Lewycky
eeb01b41ef
Strengthen icmp snuggling by doing 'compare-or-equal-to' to 'compare'
...
first and then range testing second.
llvm-svn: 35715
2007-04-07 02:30:14 +00:00
Devang Patel
f42389ffe5
Add loop rotation pass.
...
llvm-svn: 35714
2007-04-07 01:25:15 +00:00
Chris Lattner
0f1509511e
fix a miscompilation in printf optimizer.
...
llvm-svn: 35713
2007-04-07 01:18:36 +00:00
Chris Lattner
6a36d636e9
trunc to bool no longer compares against zero
...
llvm-svn: 35712
2007-04-07 01:03:46 +00:00
Chris Lattner
e8829aa9dd
cleanups for strlen optimizer
...
llvm-svn: 35711
2007-04-07 01:02:00 +00:00
Chris Lattner
485b6415b1
Introduce a new ReplaceCallWith method, which simplifies a lot of code.
...
llvm-svn: 35710
2007-04-07 00:42:32 +00:00
Chris Lattner
6a6c1f1c30
fixes for strcpy optimizer
...
llvm-svn: 35709
2007-04-07 00:26:18 +00:00
Chris Lattner
f9ee647e86
Fix bugs in strncmp.
...
llvm-svn: 35708
2007-04-07 00:06:57 +00:00
Chris Lattner
c9ccc30212
fix 3 miscompilations and several compielr crashes in strcmp optimizer.
...
llvm-svn: 35707
2007-04-07 00:01:51 +00:00
Chris Lattner
39f0bb9670
Fix several nasty bugs in the strchr optimizer, this fixes
...
SimplifyLibCalls/2007-04-06-strchr-miscompile.ll and PR1307
llvm-svn: 35706
2007-04-06 23:38:55 +00:00
Chris Lattner
56b7fc7768
clean up strcat optimizer, no functionality change.
...
llvm-svn: 35704
2007-04-06 22:59:33 +00:00
Chris Lattner
9b2b8abd20
rename getConstantStringLength -> GetConstantStringInfo. Make it return
...
the start index of the array as well as the length. No functionality change.
llvm-svn: 35703
2007-04-06 22:54:17 +00:00
Chris Lattner
3dbe65f80a
implement Transforms/InstCombine/malloc2.ll and PR1313
...
llvm-svn: 35700
2007-04-06 18:57:34 +00:00
Chris Lattner
1a9a760318
Fix Transforms/GlobalOpt/2007-04-05-Crash.ll
...
llvm-svn: 35689
2007-04-05 21:09:42 +00:00
Chris Lattner
108083edff
Use a worklist-driven algorithm instead of a recursive one.
...
llvm-svn: 35680
2007-04-05 01:27:02 +00:00
Dale Johannesen
7c2001d014
Prevent transformConstExprCastCall from generating conversions that assert
...
elsewhere.
llvm-svn: 35668
2007-04-04 19:16:42 +00:00
Jeff Cohen
5a1c750f31
Fix 2007-04-04-BadFoldBitcastIntoMalloc.ll
...
llvm-svn: 35665
2007-04-04 16:58:57 +00:00
Duncan Sands
f01a47c93c
Fix comment.
...
llvm-svn: 35655
2007-04-04 06:42:45 +00:00
Chris Lattner
e5bbb3cb1a
Fix a bug I introduced with my patch yesterday which broke Qt (I converted
...
some constant exprs to apints).
Thanks to Anton for tracking down a small testcase that triggered this!
llvm-svn: 35633
2007-04-03 23:29:39 +00:00
Chris Lattner
a74deafb13
reinstate the previous two patches, with a bugfix :)
...
ldecod now passes.
llvm-svn: 35626
2007-04-03 17:43:25 +00:00
Evan Cheng
7511fa280d
Reverting back to 1.723. The last two commits broke JM (and possibily others) on ARM.
...
llvm-svn: 35620
2007-04-03 08:11:50 +00:00
Chris Lattner
81e0707552
split some code out into a helper function
...
llvm-svn: 35615
2007-04-03 05:11:24 +00:00
Chris Lattner
64c764cebc
Split a whole ton of code out of visitICmpInst into visitICmpInstWithInstAndIntCst.
...
llvm-svn: 35614
2007-04-03 04:46:52 +00:00
Chris Lattner
8b2ec5f506
Fix PR1253 and xor2.ll:test[01]
...
llvm-svn: 35612
2007-04-03 01:47:41 +00:00
Chris Lattner
f3197a7d53
allow -1 strides to reuse "1" strides.
...
llvm-svn: 35607
2007-04-02 22:51:58 +00:00
Zhou Sheng
9bc8ab100d
1. Make use of APInt operation instead of using ConstantExpr::getXXX.
...
2. Use cheaper APInt methods.
llvm-svn: 35594
2007-04-02 13:45:30 +00:00
Zhou Sheng
56cda95658
Use uint32_t for bitwidth instead of unsigned.
...
llvm-svn: 35593
2007-04-02 08:20:41 +00:00
Chris Lattner
28e0e4e11e
Pass the type of the store access, not the type of the store, into the
...
target hook. This allows us to codegen a loop as:
LBB1_1: @cond_next
mov r2, #0
str r2, [r0, +r3, lsl #2 ]
add r3, r3, #1
cmn r3, #1
bne LBB1_1 @cond_next
instead of:
LBB1_1: @cond_next
mov r2, #0
str r2, [r0], #+4
add r3, r3, #1
cmn r3, #1
bne LBB1_1 @cond_next
This looks the same, but has one fewer induction variable (and therefore,
one fewer register) live in the loop.
llvm-svn: 35592
2007-04-02 06:34:44 +00:00
Chris Lattner
9d5aacee92
Wrap long line
...
llvm-svn: 35588
2007-04-02 05:48:58 +00:00
Chris Lattner
50490d54f2
use more obvious function name.
...
llvm-svn: 35587
2007-04-02 05:42:22 +00:00
Chris Lattner
b24acc7bee
simplify (x+c)^signbit as (x+c+signbit), pointed out by PR1288. This implements
...
test/Transforms/InstCombine/xor.ll:test28
llvm-svn: 35584
2007-04-02 05:36:22 +00:00
Chris Lattner
b7b75145f1
reduce use of std::set
...
llvm-svn: 35576
2007-04-02 01:44:59 +00:00
Chris Lattner
c3748562bd
Various passes before isel split edges and do other CFG-restructuring changes.
...
isel has its own particular features that it wants in the CFG, in order to
reduce the number of times a constant is computed, etc. Make sure that we
clean up the CFG before doing any other things for isel. Doing so can
dramatically reduce the number of split edges and reduce the number of
places that constants get computed. For example, this shrinks
CodeGen/Generic/phi-immediate-factoring.ll from 44 to 37 instructions on X86,
and from 21 to 17 MBB's in the output. This is primarily a code size win,
not a performance win.
This implements CodeGen/Generic/phi-immediate-factoring.ll and PR1296.
llvm-svn: 35575
2007-04-02 01:35:34 +00:00
Chris Lattner
8fe3cbe6bd
print the type of an inserted IV in -debug mode.
...
llvm-svn: 35563
2007-04-01 22:21:39 +00:00
Chris Lattner
c3eeb42809
simplify this code, make it work for ap ints
...
llvm-svn: 35561
2007-04-01 20:57:36 +00:00
Zhou Sheng
150f3bbab2
Avoid unnecessary APInt construction.
...
llvm-svn: 35555
2007-04-01 17:13:37 +00:00
Reid Spencer
6bba6c8143
For PR1297:
...
Support overloaded intrinsics bswap, ctpop, cttz, ctlz.
llvm-svn: 35547
2007-04-01 07:35:23 +00:00
Chris Lattner
0427799531
Fix InstCombine/2007-03-31-InfiniteLoop.ll
...
llvm-svn: 35536
2007-04-01 05:36:37 +00:00
Chris Lattner
f2836d17b6
Split the sdisel code munging stuff out into its own opt-pass, CodeGenPrepare.
...
llvm-svn: 35528
2007-03-31 04:06:36 +00:00
Zhou Sheng
82c42284f4
Delete dead code.
...
llvm-svn: 35525
2007-03-31 02:50:26 +00:00
Zhou Sheng
4f16402e0d
Use APInt operators to calculate the carry bits, remove this loop.
...
llvm-svn: 35524
2007-03-31 02:38:39 +00:00
Zhou Sheng
fd28a33031
Make sure the use of ConstantInt::getZExtValue() for shift amount safe.
...
llvm-svn: 35510
2007-03-30 17:20:39 +00:00
Zhou Sheng
b25806fa5f
1. Make sure the use of ConstantInt::getZExtValue() for getting shift
...
amount is safe.
2. Use new method on ConstantInt instead of (? :) operator.
3. Use new method uge() on ConstantInt to simplify codes.
llvm-svn: 35505
2007-03-30 09:29:48 +00:00
Zhou Sheng
5e60a4a6b0
Use APInt operation instead of ConstantExpr::getXX.
...
llvm-svn: 35503
2007-03-30 05:45:18 +00:00
Zhou Sheng
b3a80b1d70
1. Make more use of APInt::getHighBitsSet/getLowBitsSet.
...
2. Let APInt variable do the binary operation stuff instead of using
ConstantExpr::getXXX.
llvm-svn: 35450
2007-03-29 08:15:12 +00:00
Zhou Sheng
444af49cc0
Clean up some codes in InstCombiner::SimplifyDemandedBits().
...
llvm-svn: 35446
2007-03-29 04:45:55 +00:00
Zhou Sheng
a4475575c0
Clean up codes in InstCombiner::SimplifyDemandedBits():
...
1. Line out nested call of APInt::zext/trunc.
2. Make more use of APInt::getHighBitsSet/getLowBitsSet.
3. Use APInt[] operator instead of expression like "APIntVal & SignBit".
llvm-svn: 35444
2007-03-29 02:26:30 +00:00
Zhou Sheng
4961cf1c06
1. Make the APInt variable do the binary operation stuff if possible
...
instead of using ConstantExpr::getXX.
2. Use constant reference to APInt if possible instead of expensive
APInt copy.
llvm-svn: 35443
2007-03-29 01:57:21 +00:00
Zhou Sheng
117477e28b
Avoid unnecessary APInt construction.
...
llvm-svn: 35431
2007-03-28 17:38:21 +00:00
Zhou Sheng
23f7a1c947
1. Make more use of getLowBitsSet/getHighBitsSet.
...
2. Use APInt[] instead of "X & SignBit".
3. Clean up some codes.
4. Make the expression like "ShiftAmt = ShiftAmtC->getZExtValue()" safe.
llvm-svn: 35424
2007-03-28 15:02:20 +00:00
Zhou Sheng
2777a31850
1. Make more use of getLowBitsSet/getHighBitsSet.
...
2. Make the APInt value do the zext/trunc stuff instead of using
ConstantExpr::getZExt().
llvm-svn: 35422
2007-03-28 09:19:01 +00:00
Zhou Sheng
c2d3309b99
Use UnknownBIts[BitWidth-1] instead of UnknownBIts & SignBits.
...
llvm-svn: 35418
2007-03-28 05:15:57 +00:00
Zhou Sheng
18570b1f14
Remove unused APInt variable.
...
llvm-svn: 35414
2007-03-28 03:02:21 +00:00
Zhou Sheng
57e3f7324b
Clean up codes in ComputeMaskedBits():
...
1. Line out nested use of zext/trunc.
2. Make more use of getHighBitsSet/getLowBitsSet.
3. Use APInt[] != 0 instead of "(APInt & SignBit) != 0".
llvm-svn: 35408
2007-03-28 02:19:03 +00:00
Reid Spencer
a5c18bf798
For PR1280:
...
When converting an add/xor/and triplet into a trunc/sext, only do so if the
intermediate integer type is a bitwidth that the targets can handle.
llvm-svn: 35400
2007-03-28 01:36:16 +00:00
Evan Cheng
a4ed8a512a
Unbreaks non-debug builds.
...
llvm-svn: 35383
2007-03-27 16:44:48 +00:00
Reid Spencer
54d5b1b8f8
Implement some minor review feedback.
...
llvm-svn: 35373
2007-03-26 23:58:26 +00:00
Reid Spencer
441486c172
For PR1271:
...
Fix another incorrectly converted shift mask.
llvm-svn: 35371
2007-03-26 23:45:51 +00:00
Devang Patel
4398e242dd
Reduce malloc/free traffic.
...
llvm-svn: 35370
2007-03-26 23:19:29 +00:00
Chris Lattner
d2602d5054
eliminate use of std::set
...
llvm-svn: 35361
2007-03-26 20:40:50 +00:00