1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 04:22:57 +02:00
Commit Graph

2197 Commits

Author SHA1 Message Date
Owen Anderson
43d4a82d4b Make LoopInfoBase more generic, in preparation for having MachineLoopInfo. This involves a small interface change.
llvm-svn: 44348
2007-11-27 03:43:35 +00:00
Owen Anderson
2aa0218a6c Fix another bug that was causing siod to fail.
llvm-svn: 44325
2007-11-26 07:17:19 +00:00
Owen Anderson
05275b7b14 Allow GVN to eliminate read-only function calls when it can detect that they are redundant.
llvm-svn: 44323
2007-11-26 02:26:36 +00:00
Anton Korobeynikov
14246a2eba Remove another leak. Due to some reason AliasSetTracker didn't had any dtor...
llvm-svn: 44320
2007-11-25 23:52:02 +00:00
Chris Lattner
d1e03b5387 Implement PR1822
llvm-svn: 44318
2007-11-25 21:27:53 +00:00
Duncan Sands
114968a3e8 Fix PR1816. If a bitcast of a function only exists because of a
trivial difference in function attributes, allow calls to it to
be converted to direct calls.  Based on a patch by Török Edwin.
While there, move the various lists of mutually incompatible
parameters etc out of the verifier and into ParameterAttributes.h.

llvm-svn: 44315
2007-11-25 14:10:56 +00:00
Chris Lattner
642ae99085 add a comment.
llvm-svn: 44293
2007-11-23 22:35:18 +00:00
Duncan Sands
0973ae4c8c Remove some logic I thoughtlessly copied over
from the old ADCE implementation (there it was
correct because the transform was being done
for read-only functions).

llvm-svn: 44287
2007-11-23 09:10:17 +00:00
Chris Lattner
bff48b8f0d Fix PR1817.
llvm-svn: 44284
2007-11-22 23:47:13 +00:00
Duncan Sands
e79932aed4 Turn invokes of nounwind functions into ordinary calls.
llvm-svn: 44280
2007-11-22 22:24:59 +00:00
Duncan Sands
6ec98952e0 Readonly/readnone functions are allowed to throw
exceptions, so don't turn invokes of them into
calls.

llvm-svn: 44278
2007-11-22 21:40:06 +00:00
Nick Lewycky
a734aa84f3 typo
llvm-svn: 44262
2007-11-21 05:21:54 +00:00
Dan Gohman
760d574313 Add explicit keywords.
llvm-svn: 44234
2007-11-19 15:30:20 +00:00
Dale Johannesen
c5032e5366 Remove indeterminism from a loop. We think this will
fix an occasional nonrepeatable bootstrap failure we've
been seeing on Darwin.

llvm-svn: 44202
2007-11-17 02:48:01 +00:00
Chris Lattner
5574ba5ce6 Fix PR1800 by correcting mistaken logic.
llvm-svn: 44188
2007-11-16 06:04:17 +00:00
Chris Lattner
3b66875602 Implement PR1796 and Transforms/SimplifyCFG/noreturn-call.ll
by inserting unreachable after no-return calls.

llvm-svn: 44099
2007-11-14 06:19:25 +00:00
Chris Lattner
2d15a52df0 Implement PR1786 by iterating between dead cycle elimination
and simplifycfg in the rare cases when it is needed.

llvm-svn: 44044
2007-11-13 07:32:38 +00:00
Andrew Lenharth
83adca5075 Better check
llvm-svn: 43897
2007-11-08 18:45:15 +00:00
Andrew Lenharth
310a65171d Fix PR1780
llvm-svn: 43893
2007-11-08 17:39:28 +00:00
Chris Lattner
8e982efdc5 fix const correctness, BB is const, so its predecessors are too
llvm-svn: 43780
2007-11-06 22:07:40 +00:00
Chris Lattner
2a909d32b6 don't put erase or query for non-allocainst pointers in an set of allocainsts*'s
llvm-svn: 43779
2007-11-06 22:07:22 +00:00
Chris Lattner
907b9b92fe Implement PR1777 by detecting dependent phis that
all compute the same value.

llvm-svn: 43777
2007-11-06 21:52:06 +00:00
Duncan Sands
59b08debe3 At the point of calculating the shift amount, the
type of SV has changed from what it originally was.
However we need the store width of the original.

llvm-svn: 43775
2007-11-06 20:39:11 +00:00
Chris Lattner
e194944b29 wrap long lines
llvm-svn: 43745
2007-11-06 01:15:27 +00:00
Dan Gohman
adc21ed938 Fix an abort in instcombine when folding creates a vector rem instruction.
llvm-svn: 43743
2007-11-05 23:16:33 +00:00
Devang Patel
963e54c2cf 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
Duncan Sands
7c0f410b42 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
4d157a1bc6 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
662fb070a7 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
493f83eeb1 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
Duncan Sands
eb464e976f 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
594b0fe9e2 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
d29624e11a Fix InstCombine/2007-10-31-RangeCrash.ll
llvm-svn: 43596
2007-11-01 02:18:41 +00:00
Dan Gohman
51cadc3b59 Fix a typo in a comment.
llvm-svn: 43553
2007-10-31 14:35:39 +00:00
Evan Cheng
06ec64fcda 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
5e058e94b5 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
633cd3e84d - 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
1c499173c8 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
8f74d7f5c0 Use an array instead of a fixed-length std::vector.
llvm-svn: 43467
2007-10-29 20:24:00 +00:00
Dan Gohman
0e9e5b6534 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
a309c59972 Update a comment to reflect the current code.
llvm-svn: 43463
2007-10-29 19:32:39 +00:00
Dan Gohman
459bb8cbd2 Remove an unused function argument.
llvm-svn: 43462
2007-10-29 19:31:25 +00:00
Dan Gohman
30b8bd2ad4 Fix a typo in a comment.
llvm-svn: 43461
2007-10-29 19:26:14 +00:00
Dan Gohman
957fd1704a Avoid calling ValidStride when not all uses are addresses.
llvm-svn: 43460
2007-10-29 19:23:53 +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
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