Chris Lattner
891066cfff
Fix PR1752 and LoopSimplify/2007-10-28-InvokeCrash.ll: terminators
...
can have uses too. Wouldn't it be nice if invoke didn't exist? :)
llvm-svn: 43426
2007-10-29 02:30:37 +00:00
Evan Cheng
c8adcda731
A number of LSR fixes:
...
- ChangeCompareStride only reuse stride that is larger than current stride. It
will let the general reuse mechanism to try to reuse a smaller stride.
- Watch out for multiplication overflow in ChangeCompareStride.
- Replace std::set with SmallPtrSet.
llvm-svn: 43408
2007-10-26 23:08:19 +00:00
Evan Cheng
53b2e7f3ca
Fix a crash. Make sure TLI is not null.
...
llvm-svn: 43384
2007-10-26 17:24:46 +00:00
Gordon Henriksen
609997aa7d
More fleshing out of docs/Passes.html, plus some typo fixes and
...
improved wording in source files.
llvm-svn: 43377
2007-10-26 03:03:51 +00:00
Evan Cheng
53696b7e9f
Loosen up iv reuse to allow reuse of the same stride but a larger type when truncating from the larger type to smaller type is free.
...
e.g.
Turns this loop:
LBB1_1: # entry.bb_crit_edge
xorl %ecx, %ecx
xorw %dx, %dx
movw %dx, %si
LBB1_2: # bb
movl L_X$non_lazy_ptr, %edi
movw %si, (%edi)
movl L_Y$non_lazy_ptr, %edi
movw %dx, (%edi)
addw $4, %dx
incw %si
incl %ecx
cmpl %eax, %ecx
jne LBB1_2 # bb
into
LBB1_1: # entry.bb_crit_edge
xorl %ecx, %ecx
xorw %dx, %dx
LBB1_2: # bb
movl L_X$non_lazy_ptr, %esi
movw %cx, (%esi)
movl L_Y$non_lazy_ptr, %esi
movw %dx, (%esi)
addw $4, %dx
incl %ecx
cmpl %eax, %ecx
jne LBB1_2 # bb
llvm-svn: 43375
2007-10-26 01:56:11 +00:00
Evan Cheng
d7eab3a984
Do not rewrite compare instruction using iv of a different stride if the new
...
stride may be rewritten using the stride of the compare instruction.
llvm-svn: 43367
2007-10-25 22:45:20 +00:00
Evan Cheng
c25c4276a6
Remove code that's commented out.
...
llvm-svn: 43356
2007-10-25 18:38:24 +00:00
Evan Cheng
66cbf54030
If a loop termination compare instruction is the only use of its stride,
...
and the compaison is against a constant value, try eliminate the stride
by moving the compare instruction to another stride and change its
constant operand accordingly. e.g.
loop:
...
v1 = v1 + 3
v2 = v2 + 1
if (v2 < 10) goto loop
=>
loop:
...
v1 = v1 + 3
if (v1 < 30) goto loop
llvm-svn: 43336
2007-10-25 09:11:16 +00:00
Dale Johannesen
414ad5d4a4
Fix off by 1 bug in printf->puts lowering.
...
llvm-svn: 43309
2007-10-24 20:14:50 +00:00
Chris Lattner
ae9cfd2fb0
simplify some code by using the new isNaN predicate
...
llvm-svn: 43305
2007-10-24 18:54:45 +00:00
Chris Lattner
483c471daa
Implement a couple of foldings for ordered and unordered comparisons,
...
implementing cases related to PR1738.
llvm-svn: 43289
2007-10-24 05:38:08 +00:00
Dan Gohman
df1f166e4a
Strength reduction improvements.
...
- Avoid attempting stride-reuse in the case that there are users that
aren't addresses. In that case, there will be places where the
multiplications won't be folded away, so it's better to try to
strength-reduce them.
- Several SSE intrinsics have operands that strength-reduction can
treat as addresses. The previous item makes this more visible, as
any non-address use of an IV can inhibit stride-reuse.
- Make ValidStride aware of whether there's likely to be a base
register in the address computation. This prevents it from thinking
that things like stride 9 are valid on x86 when the base register is
already occupied.
Also, XFAIL the 2007-08-10-LEA16Use32.ll test; the new logic to avoid
stride-reuse elimintes the LEA in the loop, so the test is no longer
testing what it was intended to test.
llvm-svn: 43231
2007-10-22 20:40:42 +00:00
Dan Gohman
68fc6d7395
Move the SCEV object factors from being static members of the individual
...
SCEV subclasses to being non-static member functions of the ScalarEvolution
class.
llvm-svn: 43224
2007-10-22 18:31:58 +00:00
Anton Korobeynikov
bcee4726bf
Reg2Mem cleanup and optimizations:
...
- enable phi instructions demotion to stack
- create alloca instructions in the entry block
llvm-svn: 43208
2007-10-21 23:05:16 +00:00
Devang Patel
eff4619cc8
Try again.
...
Instead of loading small global string from memory, use
integer constant.
llvm-svn: 43148
2007-10-18 19:52:32 +00:00
Owen Anderson
f0e040a0c7
Allow GVN to eliminate redundant calls to functions without side effects.
...
llvm-svn: 43147
2007-10-18 19:39:33 +00:00
Chris Lattner
efaf4ba65d
Fix PR1735 and Transforms/DeadArgElim/2007-10-18-VarargsReturn.ll by
...
fixing some obviously broken code :(
llvm-svn: 43141
2007-10-18 18:49:29 +00:00
Owen Anderson
4b407757d0
Move Split<...>() into DomTreeBase. This should make the #include's of DominatorInternals.h
...
in CodeExtractor and LoopSimplify unnecessary.
Hartmut, could you confirm that this fixes the issues you were seeing?
llvm-svn: 43115
2007-10-18 05:13:52 +00:00
Evan Cheng
1c34d807ce
Reverting r43070 for now. It's causing llc test failures.
...
llvm-svn: 43103
2007-10-17 23:51:13 +00:00
Devang Patel
9cb3c09156
Do not raise free() call that is called through invoke instruction.
...
llvm-svn: 43083
2007-10-17 20:12:58 +00:00
Hartmut Kaiser
4cbb4f081b
Fixed linker errors (unresolved externals: split<>(...)) when compiling with VC++. Please review.
...
llvm-svn: 43081
2007-10-17 18:37:09 +00:00
Devang Patel
cf2f9d6daa
Apply "Instead of loading small c string constant, use integer constant directly" transformation while processing load instruction.
...
llvm-svn: 43070
2007-10-17 07:24:40 +00:00
Devang Patel
c3d0477a0e
Use immediate stores.
...
llvm-svn: 43055
2007-10-16 23:44:18 +00:00
Devang Patel
7d1d5d6bf6
Achieve same result but use fewer lines of code.
...
llvm-svn: 42985
2007-10-15 15:31:35 +00:00
Devang Patel
f65c028dad
Dest type is always i8 *. This allows some simplification.
...
Do not filter memmove.
llvm-svn: 42930
2007-10-12 20:10:21 +00:00
Chris Lattner
3af877f26a
Fix a bug in my patch last night that broke InstCombine/2007-10-12-Crash.ll
...
llvm-svn: 42920
2007-10-12 18:05:47 +00:00
Gabor Greif
cbfb655705
eliminate warning
...
llvm-svn: 42892
2007-10-12 07:44:54 +00:00
Chris Lattner
3c23c37233
Fix some 80 column violations.
...
Fix DecomposeSimpleLinearExpr to handle simple constants better.
Don't nuke gep(bitcast(allocation)) if the bitcast(allocation) will
fold the allocation. This fixes PR1728 and Instcombine/malloc3.ll
llvm-svn: 42891
2007-10-12 05:30:59 +00:00
Devang Patel
15d6257fa8
Lower memcpy if it makes sense.
...
llvm-svn: 42864
2007-10-11 17:21:57 +00:00
Devang Patel
b13057acf6
Do not walk invalid iterator.
...
llvm-svn: 42812
2007-10-09 21:31:36 +00:00
Devang Patel
36b68478cb
Fix bug in updating dominance frontier after loop
...
unswitch when frontier includes basic blocks that
are not inside loop.
llvm-svn: 42654
2007-10-05 22:29:34 +00:00
Devang Patel
5efcf79cf3
Fix 80 col violation.
...
llvm-svn: 42591
2007-10-03 21:17:43 +00:00
Devang Patel
1e2cced8b9
Refactor code in a separate method.
...
llvm-svn: 42590
2007-10-03 21:16:08 +00:00
Dan Gohman
30ba45b569
Use empty() member functions when that's what's being tested for instead
...
of comparing begin() and end().
llvm-svn: 42585
2007-10-03 19:26:29 +00:00
Dale Johannesen
529cc16893
Tone down an overzealous optimization.
...
llvm-svn: 42582
2007-10-03 17:45:27 +00:00
Tanya Lattner
1400027d41
Fix PR1719, by not marking llvm.global.annotations internal.
...
llvm-svn: 42578
2007-10-03 17:05:40 +00:00
Chris Lattner
21b1f72d4c
Fix PR1719, by not marking llvm.noinline internal.
...
llvm-svn: 42565
2007-10-03 03:59:15 +00:00
Dale Johannesen
d94f00234f
Fix stride computations for long double arrays.
...
llvm-svn: 42508
2007-10-01 23:08:35 +00:00
Devang Patel
42f006a51a
Relax unsafe use check. If there is one unconditional use inside the loop then it is safe to promote value even if there is another conditional use inside the loop.
...
llvm-svn: 42493
2007-10-01 18:12:58 +00:00
Dale Johannesen
a30678c8f0
minor long double related changes
...
llvm-svn: 42439
2007-09-28 18:06:58 +00:00
Dale Johannesen
412575891e
Don't do SRA for unions with long double fields.
...
Fixes a SWB crash.
llvm-svn: 42422
2007-09-28 00:21:38 +00:00
Devang Patel
d98abb62ce
Handle multiple induction variables.
...
This fixes PR714.
llvm-svn: 42309
2007-09-25 18:24:48 +00:00
Devang Patel
ab58843813
Do not reserve DOM check for GetElementPtrInst.
...
llvm-svn: 42306
2007-09-25 17:55:50 +00:00
Devang Patel
f35e6c1181
doh..
...
llvm-svn: 42300
2007-09-25 17:43:08 +00:00
Devang Patel
de9d1c3654
Add transformation to update loop interation space. Now,
...
for (i=A; i<N; i++) {
if (i < X && i > Y)
do_something();
}
is transformed into
U=min(N,X); L=max(A,Y);
for (i=L;i<U;i++)
do_somethihg();
llvm-svn: 42299
2007-09-25 17:31:19 +00:00
Devang Patel
65f8d0c2d7
Do not promote null values because it may be unsafe to do so.
...
llvm-svn: 42270
2007-09-24 20:02:42 +00:00
Dan Gohman
ed361aa114
explicit keywords.
...
llvm-svn: 42262
2007-09-24 15:48:49 +00:00
Devang Patel
b741c56cfc
Fix PR1692
...
llvm-svn: 42209
2007-09-21 21:18:19 +00:00
Owen Anderson
9070cf6dea
Add partial caching of non-local memory dependence queries. This provides a modest
...
speedup for GVN.
llvm-svn: 42185
2007-09-21 03:53:52 +00:00
Devang Patel
632653ce8f
Update aux. info associated with an instruction before erasing instruction.
...
llvm-svn: 42180
2007-09-20 23:45:50 +00:00