Devang Patel
b98d2050a2
If a value is incoming from outside the loop then the value does not need remapping and the value is never tracked through LastValueMap.
...
llvm-svn: 43728
2007-11-05 19:32:30 +00:00
Gordon Henriksen
2ed067a0d9
Deleting redundant copy of block extractor pass. See also PR1775.
...
llvm-svn: 43694
2007-11-05 01:54:05 +00:00
Duncan Sands
f07fa24289
If a long double is in a packed struct, it may be
...
that there is no padding.
llvm-svn: 43691
2007-11-05 00:35:07 +00:00
Gordon Henriksen
d568767ecb
Finishing initial docs for all transformations in Passes.html.
...
Also cleaned up some comments in source files.
llvm-svn: 43674
2007-11-04 16:15:04 +00:00
Duncan Sands
399d97987b
Change uses of getTypeSize to getABITypeSize, getTypeStoreSize
...
or getTypeSizeInBits as appropriate in ScalarReplAggregates.
The right change to make was not always obvious, so it would
be good to have an sroa guru review this. While there I noticed
some bugs, and fixed them: (1) arrays of x86 long double have
holes due to alignment padding, but this wasn't being spotted
by HasStructPadding (renamed to HasPadding). The same goes
for arrays of oddly sized ints. Vectors also suffer from this,
in fact the problem for vectors is much worse because basic
vector assumptions seem to be broken by vectors of type with
alignment padding. I didn't try to fix any of these vector
problems. (2) The code for extracting smaller integers from
larger ones (in the "int union" case) was wrong on big-endian
machines for integers with size not a multiple of 8, like i1.
Probably this is impossible to hit via llvm-gcc, but I fixed
it anyway while there and added a testcase. I also got rid of
some trailing whitespace and changed a function name which
had an obvious typo in it.
llvm-svn: 43672
2007-11-04 14:43:57 +00:00
Chris Lattner
ce8c62665a
Disable tail duplication of call instructions. The cost
...
metric is way off for these in general, and this works around
buggy code like that in PR1764. we'll see if there is a big
performance impact of this. If so, I'll revert it tomorrow.
llvm-svn: 43668
2007-11-04 06:37:55 +00:00
Dan Gohman
d7917b6248
Add std:: to sort calls.
...
llvm-svn: 43652
2007-11-02 22:24:01 +00:00
Dan Gohman
c981d72d1a
Change illegal uses of ++ to uses of STLExtra.h's next function.
...
llvm-svn: 43651
2007-11-02 22:22:02 +00:00
Duncan Sands
44b8721de8
Executive summary: getTypeSize -> getTypeStoreSize / getABITypeSize.
...
The meaning of getTypeSize was not clear - clarifying it is important
now that we have x86 long double and arbitrary precision integers.
The issue with long double is that it requires 80 bits, and this is
not a multiple of its alignment. This gives a primitive type for
which getTypeSize differed from getABITypeSize. For arbitrary precision
integers it is even worse: there is the minimum number of bits needed to
hold the type (eg: 36 for an i36), the maximum number of bits that will
be overwriten when storing the type (40 bits for i36) and the ABI size
(i.e. the storage size rounded up to a multiple of the alignment; 64 bits
for i36).
This patch removes getTypeSize (not really - it is still there but
deprecated to allow for a gradual transition). Instead there is:
(1) getTypeSizeInBits - a number of bits that suffices to hold all
values of the type. For a primitive type, this is the minimum number
of bits. For an i36 this is 36 bits. For x86 long double it is 80.
This corresponds to gcc's TYPE_PRECISION.
(2) getTypeStoreSizeInBits - the maximum number of bits that is
written when storing the type (or read when reading it). For an
i36 this is 40 bits, for an x86 long double it is 80 bits. This
is the size alias analysis is interested in (getTypeStoreSize
returns the number of bytes). There doesn't seem to be anything
corresponding to this in gcc.
(3) getABITypeSizeInBits - this is getTypeStoreSizeInBits rounded
up to a multiple of the alignment. For an i36 this is 64, for an
x86 long double this is 96 or 128 depending on the OS. This is the
spacing between consecutive elements when you form an array out of
this type (getABITypeSize returns the number of bytes). This is
TYPE_SIZE in gcc.
Since successive elements in a SequentialType (arrays, pointers
and vectors) need to be aligned, the spacing between them will be
given by getABITypeSize. This means that the size of an array
is the length times the getABITypeSize. It also means that GEP
computations need to use getABITypeSize when computing offsets.
Furthermore, if an alloca allocates several elements at once then
these too need to be aligned, so the size of the alloca has to be
the number of elements multiplied by getABITypeSize. Logically
speaking this doesn't have to be the case when allocating just
one element, but it is simpler to also use getABITypeSize in this
case. So alloca's and mallocs should use getABITypeSize. Finally,
since gcc's only notion of size is that given by getABITypeSize, if
you want to output assembler etc the same as gcc then getABITypeSize
is the size you want.
Since a store will overwrite no more than getTypeStoreSize bytes,
and a read will read no more than that many bytes, this is the
notion of size appropriate for alias analysis calculations.
In this patch I have corrected all type size uses except some of
those in ScalarReplAggregates, lib/Codegen, lib/Target (the hard
cases). I will get around to auditing these too at some point,
but I could do with some help.
Finally, I made one change which I think wise but others might
consider pointless and suboptimal: in an unpacked struct the
amount of space allocated for a field is now given by the ABI
size rather than getTypeStoreSize. I did this because every
other place that reserves memory for a type (eg: alloca) now
uses getABITypeSize, and I didn't want to make an exception
for unpacked structs, i.e. I did it to make things more uniform.
This only effects structs containing long doubles and arbitrary
precision integers. If someone wants to pack these types more
tightly they can always use a packed struct.
llvm-svn: 43620
2007-11-01 20:53:16 +00:00
Owen Anderson
2ed651ace7
Fix test/Transforms/DeadStoreElimination/PartialStore.ll, which had been
...
silently failing because of an incorrect run line for some time.
llvm-svn: 43605
2007-11-01 05:29:16 +00:00
Chris Lattner
74709473ed
Fix InstCombine/2007-10-31-RangeCrash.ll
...
llvm-svn: 43596
2007-11-01 02:18:41 +00:00
Dan Gohman
54048ec9e0
Fix a typo in a comment.
...
llvm-svn: 43553
2007-10-31 14:35:39 +00:00
Evan Cheng
240c1adade
At end of LSR, replace uses of now constant (as result of SplitCriticalEdge) PHI node with the constant value.
...
llvm-svn: 43533
2007-10-30 23:45:15 +00:00
Evan Cheng
c2dbfee43f
It's not safe to tell SplitCriticalEdge to merge identical edges. It may delete the phi instruction that's being processed.
...
llvm-svn: 43524
2007-10-30 22:27:26 +00:00
Evan Cheng
b024c4c81d
- Bug fixes.
...
- Allow icmp rewrite using an iv / stride of a smaller integer type.
llvm-svn: 43480
2007-10-29 22:07:18 +00:00
Dan Gohman
2aec186dd0
Don't bitcast from pointer-to-vector to pointer-to-array when
...
lowering load and store instructions.
llvm-svn: 43468
2007-10-29 20:34:35 +00:00
Dan Gohman
3bcd5fe9f1
Use an array instead of a fixed-length std::vector.
...
llvm-svn: 43467
2007-10-29 20:24:00 +00:00
Dan Gohman
d9911e21df
Do a real assert if there is an unhandled vector instruction instead
...
of just printing to cerr.
llvm-svn: 43466
2007-10-29 20:14:29 +00:00
Dan Gohman
7414e21ec0
Update a comment to reflect the current code.
...
llvm-svn: 43463
2007-10-29 19:32:39 +00:00
Dan Gohman
f5feb01056
Remove an unused function argument.
...
llvm-svn: 43462
2007-10-29 19:31:25 +00:00
Dan Gohman
50d42224d0
Fix a typo in a comment.
...
llvm-svn: 43461
2007-10-29 19:26:14 +00:00
Dan Gohman
8e8adada83
Avoid calling ValidStride when not all uses are addresses.
...
llvm-svn: 43460
2007-10-29 19:23:53 +00:00
Chris Lattner
4a15e04aee
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
9dbe99dcd6
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
d78a3e5555
Fix a crash. Make sure TLI is not null.
...
llvm-svn: 43384
2007-10-26 17:24:46 +00:00
Gordon Henriksen
78c63ac41e
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
7f3d02471d
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
29e29e63bd
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
5a38108374
Remove code that's commented out.
...
llvm-svn: 43356
2007-10-25 18:38:24 +00:00
Evan Cheng
133694db06
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
4d06391c47
Fix off by 1 bug in printf->puts lowering.
...
llvm-svn: 43309
2007-10-24 20:14:50 +00:00
Chris Lattner
55b8302dfe
simplify some code by using the new isNaN predicate
...
llvm-svn: 43305
2007-10-24 18:54:45 +00:00
Chris Lattner
c62877e9da
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
e0c3d9f338
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
a37eaf2bf9
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
7499a3b092
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
df49cf52e2
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
09b83ba6f1
Allow GVN to eliminate redundant calls to functions without side effects.
...
llvm-svn: 43147
2007-10-18 19:39:33 +00:00
Chris Lattner
9715d9fb59
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
ca831a829d
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
cdcc1d0444
Reverting r43070 for now. It's causing llc test failures.
...
llvm-svn: 43103
2007-10-17 23:51:13 +00:00
Devang Patel
b3dac3f5d9
Do not raise free() call that is called through invoke instruction.
...
llvm-svn: 43083
2007-10-17 20:12:58 +00:00
Hartmut Kaiser
2f842e613f
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
91ff13edcc
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
8d818f5e80
Use immediate stores.
...
llvm-svn: 43055
2007-10-16 23:44:18 +00:00
Devang Patel
bff4aea328
Achieve same result but use fewer lines of code.
...
llvm-svn: 42985
2007-10-15 15:31:35 +00:00
Devang Patel
371e6ca690
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
ad618f66e6
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
5d8f7e0cc7
eliminate warning
...
llvm-svn: 42892
2007-10-12 07:44:54 +00:00
Chris Lattner
d8675e4915
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
899cc56612
Lower memcpy if it makes sense.
...
llvm-svn: 42864
2007-10-11 17:21:57 +00:00
Devang Patel
2af23f976b
Do not walk invalid iterator.
...
llvm-svn: 42812
2007-10-09 21:31:36 +00:00
Devang Patel
a69f987b66
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
3574759d85
Fix 80 col violation.
...
llvm-svn: 42591
2007-10-03 21:17:43 +00:00
Devang Patel
e192e32577
Refactor code in a separate method.
...
llvm-svn: 42590
2007-10-03 21:16:08 +00:00
Dan Gohman
c731c97fac
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
9d559cfff5
Tone down an overzealous optimization.
...
llvm-svn: 42582
2007-10-03 17:45:27 +00:00
Tanya Lattner
30f65fe4a7
Fix PR1719, by not marking llvm.global.annotations internal.
...
llvm-svn: 42578
2007-10-03 17:05:40 +00:00
Chris Lattner
d66e0cd6c0
Fix PR1719, by not marking llvm.noinline internal.
...
llvm-svn: 42565
2007-10-03 03:59:15 +00:00
Dale Johannesen
b6c05b1f90
Fix stride computations for long double arrays.
...
llvm-svn: 42508
2007-10-01 23:08:35 +00:00
Devang Patel
2a60ff1aeb
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
6bf69ed3cc
minor long double related changes
...
llvm-svn: 42439
2007-09-28 18:06:58 +00:00
Dale Johannesen
1d1d0e7735
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
7bba386f72
Handle multiple induction variables.
...
This fixes PR714.
llvm-svn: 42309
2007-09-25 18:24:48 +00:00
Devang Patel
440d13b55b
Do not reserve DOM check for GetElementPtrInst.
...
llvm-svn: 42306
2007-09-25 17:55:50 +00:00
Devang Patel
5e1651d270
doh..
...
llvm-svn: 42300
2007-09-25 17:43:08 +00:00
Devang Patel
87d7e8ebcb
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
9e30e1a3be
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
75470c3bf1
explicit keywords.
...
llvm-svn: 42262
2007-09-24 15:48:49 +00:00
Devang Patel
361e52f39c
Fix PR1692
...
llvm-svn: 42209
2007-09-21 21:18:19 +00:00
Owen Anderson
46da2a6262
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
83cc3f8f51
Update aux. info associated with an instruction before erasing instruction.
...
llvm-svn: 42180
2007-09-20 23:45:50 +00:00
Devang Patel
6117a3b696
Don't increment invalid iterator.
...
llvm-svn: 42178
2007-09-20 23:01:50 +00:00
Nick Lewycky
eae7e7d00b
Fix optimization. %x = sub %x, %y does not imply that %y is zero.
...
llvm-svn: 42157
2007-09-20 00:48:36 +00:00
Devang Patel
464276f831
Avoid unsafe promotion.
...
llvm-svn: 42149
2007-09-19 20:18:51 +00:00
Duncan Sands
d31649bc59
Improve comment.
...
llvm-svn: 42132
2007-09-19 10:25:38 +00:00
Duncan Sands
56df7dec2b
A global variable with external weak linkage can be null, while
...
an alias could alias such a global variable.
llvm-svn: 42130
2007-09-19 10:10:31 +00:00
Devang Patel
69a55a38ed
Relax loop ExitCondition predicate restriction.
...
llvm-svn: 42122
2007-09-19 00:28:47 +00:00
Devang Patel
455a53b7db
Filter loops where split condition's false branch is not empty. For example
...
for (int i = 0; i < N; ++i) {
if (i == somevalue)
dosomething();
else
dosomethingelse();
}
llvm-svn: 42121
2007-09-19 00:15:16 +00:00
Devang Patel
4c238c451f
Bail out early, before modifying anything.
...
llvm-svn: 42120
2007-09-19 00:11:01 +00:00
Devang Patel
31f2c8592c
Work is incomplete. Loop is not modified at all right now.
...
llvm-svn: 42119
2007-09-19 00:08:13 +00:00
Devang Patel
fcda998ab2
Fix PR1657
...
llvm-svn: 42075
2007-09-18 01:54:42 +00:00
Devang Patel
267c07b51f
Do not eliminate loop when it is invalid to do so. For example,
...
for(int i = 0; i < N; i++) {
if ( i == XYZ) {
A;
else
B;
}
C;
D;
}
llvm-svn: 42058
2007-09-17 21:01:05 +00:00
Devang Patel
712dbe9d13
Skeleton for transformations to truncate loop's iteration space.
...
llvm-svn: 42054
2007-09-17 20:39:48 +00:00
Devang Patel
9d1af9b63d
Fix comment.
...
llvm-svn: 42048
2007-09-17 20:07:40 +00:00
Chris Lattner
0625bd6472
Merge DenseMapKeyInfo & DenseMapValueInfo into DenseMapInfo
...
Add a new DenseMapInfo::isEqual method to allow clients to redefine
the equality predicate used when probing the hash table.
llvm-svn: 42042
2007-09-17 18:34:04 +00:00
Dan Gohman
2ac2652779
Instcombine x-((x/y)*y) into a remainder operator.
...
llvm-svn: 42035
2007-09-17 17:31:57 +00:00
Duncan Sands
6d5da71288
Factor the trampoline transformation into a subroutine.
...
llvm-svn: 42021
2007-09-17 10:26:40 +00:00
Owen Anderson
4cd516b50b
Be more careful when constant-folding PHI nodes.
...
llvm-svn: 41998
2007-09-16 08:04:16 +00:00
Owen Anderson
8d0cb881e5
Remove RLE. It is subsumed by GVN.
...
llvm-svn: 41968
2007-09-14 22:33:52 +00:00
Dale Johannesen
98d3a08d8f
Remove the assumption that FP's are either float or
...
double from some of the many places in the optimizers
it appears, and do something reasonable with x86
long double.
Make APInt::dump() public, remove newline, use it to
dump ConstantSDNode's.
Allow APFloats in FoldingSet.
Expand X86 backend handling of long doubles (conversions
to/from int, mostly).
llvm-svn: 41967
2007-09-14 22:26:36 +00:00
Chris Lattner
5d13fb538f
Fix a logic error in ValueIsOnlyUsedLocallyOrStoredToOneGlobal that caused
...
miscompilation of 188.ammp. Reject select and bitcast in
ValueIsOnlyUsedLocallyOrStoredToOneGlobal because RewriteHeapSROALoadUser can't handle it.
llvm-svn: 41950
2007-09-14 03:41:21 +00:00
Chris Lattner
d9111b88d1
silence a bogus gcc warning.
...
llvm-svn: 41949
2007-09-14 03:07:24 +00:00
Bill Wendling
264d4813c7
Temporary reverting r41817
...
(http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070910/053370.html ). It's
causing SPASS to fail.
llvm-svn: 41938
2007-09-14 01:13:55 +00:00
Chris Lattner
011f91b5b2
Teach GlobalLoadUsesSimpleEnoughForHeapSRA and the SROA rewriter how to handle
...
a limited form of PHI nodes. This finally fixes PR1639, speeding 179.art up
from 7.84s to 3.13s on PPC.
llvm-svn: 41933
2007-09-13 21:31:36 +00:00
Chris Lattner
ba98f89388
be tolerant of PHI nodes when rewriting heap SROA code. This is a step
...
along the way of PR1639
llvm-svn: 41930
2007-09-13 18:00:31 +00:00
Chris Lattner
f315d4f1a7
refactor some code, no functionality change. On the path to PR1639
...
llvm-svn: 41929
2007-09-13 17:29:05 +00:00
Chris Lattner
6eed0e7366
Make ValueIsOnlyUsedLocallyOrStoredToOneGlobal smart enough to see through
...
bitcasts and phis. This is a step to fixing PR1639.
llvm-svn: 41928
2007-09-13 16:37:20 +00:00
Chris Lattner
2d2892ee6e
Make AllUsesOfLoadedValueWillTrapIfNull strong enough to see through PHI
...
nodes. This is the first step of the fix for PR1639.
llvm-svn: 41927
2007-09-13 16:30:19 +00:00
Chris Lattner
7b412cb823
Change llvm.gcroot to not init the root to null at runtime, this prevents
...
using it for live-in values etc.
llvm-svn: 41879
2007-09-12 17:53:10 +00:00
Duncan Sands
9204663bcb
Turn calls to trampolines into calls to the underlying
...
nested function.
llvm-svn: 41844
2007-09-11 14:35:41 +00:00
Devang Patel
7ed6eb8992
Avoid negative logic.
...
llvm-svn: 41829
2007-09-11 01:10:45 +00:00
Devang Patel
8c95373ced
Refactor code into a separate method.
...
llvm-svn: 41826
2007-09-11 00:42:56 +00:00
Devang Patel
d67479b6ee
Clear split info object.
...
llvm-svn: 41823
2007-09-11 00:23:56 +00:00
Devang Patel
a28a7f1b2d
Split condition does not have to be ICmpInst in all cases.
...
llvm-svn: 41822
2007-09-11 00:12:56 +00:00
Devang Patel
f4202e91f8
Check all terminators inside loop.
...
llvm-svn: 41821
2007-09-10 23:57:58 +00:00
Chris Lattner
e804567cd8
remove some dead code, this is handled by constant folding.
...
llvm-svn: 41819
2007-09-10 23:46:29 +00:00
Devang Patel
2181b8e86a
Swap exit condition operands if it works.
...
llvm-svn: 41817
2007-09-10 23:34:06 +00:00
Chris Lattner
c75cbe6473
Prevent tailcallelim from breaking "recursive" calls to builtins.
...
llvm-svn: 41804
2007-09-10 20:58:55 +00:00
Devang Patel
f8ab0a9acc
Filter exit conditions which are not yet handled.
...
llvm-svn: 41800
2007-09-10 18:33:42 +00:00
Devang Patel
d7409fdce5
Require SCEV before LCSSA.
...
llvm-svn: 41798
2007-09-10 18:08:23 +00:00
Chris Lattner
85a51e0060
Don't zap back to back volatile load/stores
...
llvm-svn: 41759
2007-09-07 05:33:03 +00:00
Dale Johannesen
bed9dc423c
Next round of APFloat changes.
...
Use APFloat in UpgradeParser and AsmParser.
Change all references to ConstantFP to use the
APFloat interface rather than double. Remove
the ConstantFP double interfaces.
Use APFloat functions for constant folding arithmetic
and comparisons.
(There are still way too many places APFloat is
just a wrapper around host float/double, but we're
getting there.)
llvm-svn: 41747
2007-09-06 18:13:44 +00:00
Nick Lewycky
0c5c47944a
Use isTrueWhenEqual. Thanks Chris!
...
llvm-svn: 41741
2007-09-06 02:40:25 +00:00
Nick Lewycky
b0b066eaaa
When the two operands of an icmp are equal, there are five possible predicates
...
that would make the icmp true. Fixes PR1637.
llvm-svn: 41740
2007-09-06 01:10:22 +00:00
Chuck Rose III
2320323647
Forgot to obey 80 column rule. Fixing that.
...
llvm-svn: 41725
2007-09-05 20:36:41 +00:00
Chuck Rose III
e58572233d
Added default parameters to GetElementPtrInstr constructor call. Visual Studio 2k5 was getting confused and was unable to compile it. Suspected compiler error.
...
llvm-svn: 41721
2007-09-05 16:54:38 +00:00
Devang Patel
f6ef552f3d
Insert cloned loop basic blocks before original loop header.
...
llvm-svn: 41713
2007-09-04 20:46:35 +00:00
David Greene
c656cbb8c2
Update GEP constructors to use an iterator interface to fix
...
GLIBCXX_DEBUG issues.
llvm-svn: 41697
2007-09-04 15:46:09 +00:00
Anton Korobeynikov
35322d745c
Silence warning while compiling with gcc 4.2
...
llvm-svn: 41676
2007-09-02 22:11:14 +00:00
Evan Cheng
ffac17a223
Fix a gcroot lowering bug.
...
llvm-svn: 41668
2007-09-01 02:00:51 +00:00
Chris Lattner
0e258b8518
Cut off crazy computation. This helps PR1622 slightly.
...
llvm-svn: 41522
2007-08-28 04:23:55 +00:00
Devang Patel
d2456a171d
Use simpler test to filter loops.
...
llvm-svn: 41516
2007-08-27 21:34:31 +00:00
David Greene
703623d571
Update InvokeInst to work like CallInst
...
llvm-svn: 41506
2007-08-27 19:04:21 +00:00
Dan Gohman
71eaf62e5f
Change comments to refer to @malloc and @free instead of %malloc and %free.
...
llvm-svn: 41488
2007-08-27 16:11:48 +00:00
Anton Korobeynikov
24fb6b2f8c
Don't promote volatile loads/stores. This is needed (for example) to handle setjmp/longjmp properly.
...
This fixes PR1520.
llvm-svn: 41461
2007-08-26 21:43:30 +00:00
Owen Anderson
2b9ec7ff33
Don't DSe volatile stores.
...
llvm-svn: 41456
2007-08-26 21:14:47 +00:00
Devang Patel
6114751544
Move exit condition and exit branch from exiting block into loop header and dominator info. This avoid execution of dead iteration. Loop is already filter in the beginning such that this change is safe.
...
llvm-svn: 41394
2007-08-25 02:39:24 +00:00
Devang Patel
c1ef32ef3d
Constant split values needs upper bound and lower bound check, just like any other split value.
...
llvm-svn: 41389
2007-08-25 01:09:14 +00:00
Devang Patel
4e63e1f5b5
While calculating upper loop bound for first loop and lower loop bound for second loop, take care of edge cases.
...
llvm-svn: 41387
2007-08-25 00:56:38 +00:00
Devang Patel
f5a01bf025
Fix regression that I caused yesterday night while adding logic to select appropriate split condition branch.
...
llvm-svn: 41365
2007-08-24 19:32:26 +00:00
Devang Patel
4bc9298f2a
It is not safe to execute split condition's true branch first all the time. If split
...
condition predicate is GT or GE then execute false branch first.
llvm-svn: 41358
2007-08-24 06:17:19 +00:00
Devang Patel
4be56a5d12
Reject ICMP_NE as index split condition.
...
llvm-svn: 41357
2007-08-24 06:02:25 +00:00
Devang Patel
5e46fac6de
Tightenup loop filter.
...
llvm-svn: 41356
2007-08-24 05:36:56 +00:00
Devang Patel
504dc0aaed
Remove incomplete cost analysis.
...
llvm-svn: 41354
2007-08-24 05:21:13 +00:00
Chris Lattner
b0f158cfdf
rename APInt::toString -> toStringUnsigned for symmetry with toStringSigned()
...
Add an APSInt::toString() method.
llvm-svn: 41309
2007-08-23 05:15:32 +00:00
Devang Patel
887db2d832
Remove dead code.
...
llvm-svn: 41295
2007-08-22 21:07:41 +00:00
Devang Patel
6f4f23320d
Fix typo.
...
llvm-svn: 41292
2007-08-22 20:55:18 +00:00
Devang Patel
31206b56d5
Cosmetic change
...
"True Loop" and "False Loop" naming terminology to refer two loops
after loop cloning is confusing. Instead just use A_Loop and B_Loop.
llvm-svn: 41287
2007-08-22 19:33:29 +00:00
Devang Patel
90da534987
Refactor loop condition check in a separate function.
...
llvm-svn: 41282
2007-08-22 18:27:01 +00:00
Devang Patel
cd8beb7645
Fix thinko.
...
Starting value of second loop's induction variable can not be lower
then starting value of original loop's induction variable.
llvm-svn: 41280
2007-08-22 18:07:47 +00:00
Devang Patel
a12000d572
Rename bunch of variables.
...
llvm-svn: 41250
2007-08-21 21:12:02 +00:00
Devang Patel
f98db5e62a
Preserve LCSSA.
...
llvm-svn: 41246
2007-08-21 19:47:46 +00:00
Devang Patel
b5933bbbd5
Use SmallVector instead of std::vector.
...
llvm-svn: 41207
2007-08-21 00:31:24 +00:00
Devang Patel
8f4228d619
s/ExitBlock/ExitingBlock/g
...
llvm-svn: 41204
2007-08-20 23:51:18 +00:00
Devang Patel
49c4f9a889
Replace indunction variable with split value in loop body.
...
This fixes art miscompile.
llvm-svn: 41195
2007-08-20 20:49:01 +00:00
Devang Patel
c2e2d15f45
Do not split loops rejected by processOneIterationLoop().
...
llvm-svn: 41194
2007-08-20 20:24:15 +00:00
Nick Lewycky
bfa9499a88
Oops, remove assert that wasn't meant to be committed.
...
llvm-svn: 41170
2007-08-18 23:21:28 +00:00
Nick Lewycky
5b5b1ab9e0
Never insert duplicate edges.
...
llvm-svn: 41169
2007-08-18 23:18:03 +00:00
Nick Lewycky
a0d49dac26
Typo.
...
llvm-svn: 41168
2007-08-18 15:08:56 +00:00
Devang Patel
1282b6e181
Avoid spliting loops where two split condition branches are not independent.
...
llvm-svn: 41148
2007-08-18 00:00:32 +00:00
Devang Patel
d1fcfcc76c
When one branch of condition is eliminated then head of the other
...
branch is not necessary immediate dominators of merge blcok in all cases.
llvm-svn: 41144
2007-08-17 21:59:16 +00:00
Owen Anderson
f5023a7a84
Factor out some code into a helper function.
...
llvm-svn: 41131
2007-08-16 22:51:56 +00:00
Owen Anderson
221a43604e
Add some more comments to GVN.
...
llvm-svn: 41129
2007-08-16 22:02:55 +00:00
Devang Patel
3640e78057
Dominance frontier is now required.
...
llvm-svn: 41096
2007-08-15 03:34:53 +00:00
Devang Patel
b81bcbde09
Cleanup removeBlocks.
...
Use dominance frontier to fixup incoming edges of successor blocks not domianted by DeadBB.
Use df_iterator to walk and delete basic blocks dominated by DeadBB.
llvm-svn: 41095
2007-08-15 03:31:47 +00:00
Reid Spencer
0db035567c
Remove unneeded header file.
...
llvm-svn: 41094
2007-08-15 03:01:04 +00:00
Devang Patel
f55b79fa71
Avoid triangle loops.
...
llvm-svn: 41093
2007-08-15 02:14:55 +00:00
Devang Patel
22c7993ecf
Break infinite loop.
...
llvm-svn: 41091
2007-08-14 23:59:17 +00:00
Devang Patel
7cad917160
Avoid nested loops at the moment.
...
llvm-svn: 41090
2007-08-14 23:53:57 +00:00
Devang Patel
33ba97d747
Fix dominance frontier update while removing blocks.
...
llvm-svn: 41082
2007-08-14 18:35:57 +00:00
Owen Anderson
bc271a02fd
Eliminate PHI nodes with constant values during normal GVN processing, even when
...
they're not related to eliminating a load.
llvm-svn: 41081
2007-08-14 18:33:27 +00:00
Owen Anderson
398602a6eb
Be more aggressive in pruning unnecessary PHI nodes when doing PHI construction.
...
llvm-svn: 41080
2007-08-14 18:16:29 +00:00
Owen Anderson
676070d503
Make GVN iterative.
...
llvm-svn: 41078
2007-08-14 18:04:11 +00:00
Owen Anderson
a7b220f23a
Fix a case where GVN was failing to return true when it had, in fact, modified
...
the function.
llvm-svn: 41077
2007-08-14 17:59:48 +00:00
Devang Patel
dbe8497d45
Handle last value assignments.
...
llvm-svn: 41063
2007-08-14 01:30:57 +00:00
Devang Patel
f74ccbb4e8
StartValue is already calculated.
...
llvm-svn: 41062
2007-08-14 00:15:45 +00:00
Devang Patel
948653915f
Preserve simple analysis.
...
llvm-svn: 41054
2007-08-13 22:22:13 +00:00
Devang Patel
b8a41bb4f1
Preserve dominator info.
...
llvm-svn: 41053
2007-08-13 22:13:24 +00:00
Devang Patel
da48cf40db
If NewBB dominates DestBB then DestBB is not part of NewBB's dominance frontier.
...
llvm-svn: 41051
2007-08-13 21:59:17 +00:00
Devang Patel
f258578206
Split loops and do CFG cleanup.
...
llvm-svn: 41029
2007-08-12 07:02:51 +00:00
Reid Spencer
9f90f965de
Remove unused variables.
...
llvm-svn: 41028
2007-08-12 04:45:36 +00:00
Chris Lattner
99c8ee2977
Transform a load from an undef/zero global into an undef/global even if we
...
have complex pointer manipulation going on. This allows us to compile
stuff like this:
__m128i foo(__m128i x){
static const unsigned int c_0[4] = { 0, 0, 0, 0 };
__m128i v_Zero = _mm_loadu_si128((__m128i*)c_0);
x = _mm_unpacklo_epi8(x, v_Zero);
return x;
}
into:
_foo:
xorps %xmm1, %xmm1
punpcklbw %xmm1, %xmm0
ret
llvm-svn: 41022
2007-08-11 18:48:48 +00:00
Devang Patel
f417c2cc34
Clone loop.
...
llvm-svn: 40998
2007-08-10 18:07:13 +00:00
Devang Patel
aa36a43908
Add utility to clone loops.
...
llvm-svn: 40997
2007-08-10 17:59:47 +00:00
Devang Patel
9a4761464f
Remove unncessary duplication.
...
llvm-svn: 40979
2007-08-10 00:59:03 +00:00
Devang Patel
7bdf4531bb
Calculate exit and start value of true loop and false loop respectively.
...
llvm-svn: 40978
2007-08-10 00:53:35 +00:00
Devang Patel
67af6cd7ea
ExitCondition and Induction variable are loop constraints
...
not split condition constraints.
llvm-svn: 40977
2007-08-10 00:33:50 +00:00
Chris Lattner
a8e4b4bc7b
when we see a unaligned load from an insufficiently aligned global or
...
alloca, increase the alignment of the load, turning it into an aligned load.
This allows us to compile:
#include <xmmintrin.h>
__m128i foo(__m128i x){
static const unsigned int c_0[4] = { 0, 0, 0, 0 };
__m128i v_Zero = _mm_loadu_si128((__m128i*)c_0);
x = _mm_unpacklo_epi8(x, v_Zero);
return x;
}
into:
_foo:
punpcklbw _c_0.5944, %xmm0
ret
.data
.lcomm _c_0.5944,16,4 # c_0.5944
instead of:
_foo:
movdqu _c_0.5944, %xmm1
punpcklbw %xmm1, %xmm0
ret
.data
.lcomm _c_0.5944,16,2 # c_0.5944
llvm-svn: 40971
2007-08-09 19:05:49 +00:00
Owen Anderson
9b1cc8cac0
Make NonLocal and None const in the right way. :-)
...
llvm-svn: 40961
2007-08-09 04:42:44 +00:00
Devang Patel
42e3e5bec1
Traverse loop blocks' terminators to find split candidates.
...
llvm-svn: 40960
2007-08-09 01:39:01 +00:00
Devang Patel
0183c797c4
Add cost analysis.
...
llvm-svn: 40952
2007-08-08 22:25:28 +00:00
Devang Patel
0e34ee25ab
Preserve dom info while processing one iteration loop.
...
llvm-svn: 40947
2007-08-08 21:39:47 +00:00
Owen Anderson
b84d3b1c92
Change the None and NonLocal markers in memdep to be const.
...
llvm-svn: 40946
2007-08-08 21:39:39 +00:00
Devang Patel
8abc5c82b7
Clear split info.
...
llvm-svn: 40944
2007-08-08 21:18:27 +00:00
Devang Patel
593bf9ceb3
Handle multiple split conditions.
...
llvm-svn: 40941
2007-08-08 21:02:17 +00:00
Owen Anderson
680862880d
Global values also don't undead-ify pointers in our dead alloca's set.
...
llvm-svn: 40936
2007-08-08 19:12:31 +00:00
Owen Anderson
ddf4aee543
Make handleEndBlock significantly faster with one trivial improvement,
...
and one hack to avoid hitting a bad case when the alias analysis is imprecise.
llvm-svn: 40935
2007-08-08 18:38:28 +00:00
Owen Anderson
50df9685b0
Small improvement: if a function doesn't access memory, we don't need to scan
...
it for potentially undeading pointers.
llvm-svn: 40933
2007-08-08 17:58:56 +00:00
Owen Anderson
52aaabf74d
Add some comments, remove a dead argument, and simplify some control flow.
...
No functionality change.
llvm-svn: 40932
2007-08-08 17:50:09 +00:00
Owen Anderson
b17ab03081
A few more small cleanups.
...
llvm-svn: 40922
2007-08-08 06:06:02 +00:00
Owen Anderson
0aecf0ebef
First round of cleanups from Chris' feedback.
...
llvm-svn: 40919
2007-08-08 04:52:29 +00:00
Devang Patel
68de1ae816
Embrace patch review feedback.
...
llvm-svn: 40915
2007-08-08 01:51:27 +00:00
Devang Patel
c7e53bdcfd
Fix new compare instruction's signness. Caught by Chris during review.
...
llvm-svn: 40912
2007-08-07 23:17:52 +00:00
Owen Anderson
0cc1a76283
Don't insert nearly as many redundant phi nodes.
...
llvm-svn: 40909
2007-08-07 23:12:31 +00:00
Devang Patel
19211b6528
Use eraseFromParent().
...
llvm-svn: 40903
2007-08-07 17:45:35 +00:00
David Greene
bacdbaa0da
Fix comment typo
...
llvm-svn: 40898
2007-08-07 16:52:03 +00:00
David Greene
816a190cdf
Fix GLIBCXX_DEBUG error triggered by incrementing erased iterator.
...
llvm-svn: 40897
2007-08-07 16:44:38 +00:00
Devang Patel
c70106cb30
Begin loop index split pass.
...
llvm-svn: 40883
2007-08-07 00:25:56 +00:00
Nick Lewycky
8052019a20
It's safe to fold not of fcmp.
...
llvm-svn: 40870
2007-08-06 20:04:16 +00:00