Commit Graph

2100 Commits

Author SHA1 Message Date
Duncan Sands
cbb8badce8 Make PruneEH update the nounwind/noreturn attributes
on functions as it calculates them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44802 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10 19:09:40 +00:00
Owen Anderson
5fc4abac3d Fix several cache coherence bugs in MemDep/GVN that were found. Also add some (disabled) debugging code
to make such problems easier to diagnose in the future, written by Duncan Sands.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44695 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 01:37:09 +00:00
Chris Lattner
c95ba44b30 simplify some code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44655 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-06 06:25:04 +00:00
Chris Lattner
348f665ee2 move some ashr-specific code out of commonShiftTransforms into visitAShr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44650 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-06 01:59:46 +00:00
Evan Cheng
bdcb726fca If both result of the {s|z}xt and its source are live out, rewrite all uses of the source with result of extension.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44643 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 23:58:20 +00:00
Duncan Sands
a3355ffb3d Rather than having special rules like "intrinsics cannot
throw exceptions", just mark intrinsics with the nounwind
attribute.  Likewise, mark intrinsics as readnone/readonly
and get rid of special aliasing logic (which didn't use
anything more than this anyway).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44544 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-03 20:06:50 +00:00
Chris Lattner
4cf4b69330 update file comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44543 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-03 19:43:18 +00:00
Devang Patel
5ffdc56f53 If ExitValue operand is also defined in Loop header then
insert new ExitValue after this operand definition.

This fixes PR1828.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44539 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-03 19:17:21 +00:00
Duncan Sands
dff6710717 Integrate the readonly/readnone logic more deeply
into alias analysis.  This meant updating the API
which now has versions of the getModRefBehavior,
doesNotAccessMemory and onlyReadsMemory methods
which take a callsite parameter.  These should be
used unless the callsite is not known, since in
general they can do a better job than the versions
that take a function.  Also, users should no longer
call the version of getModRefBehavior that takes
both a function and a callsite.  To reduce the
chance of misuse it is now protected.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44487 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-01 07:51:45 +00:00
Owen Anderson
1fb136464d Fix a miscompilation in spiff on PPC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44437 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-29 18:02:22 +00:00
Duncan Sands
afa3b6da11 Add some convenience methods for querying attributes, and
use them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44403 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-28 17:07:01 +00:00
Duncan Sands
dc024674ff Fix PR1146: parameter attributes are longer part of
the function type, instead they belong to functions
and function calls.  This is an updated and slightly
corrected version of Reid Spencer's original patch.
The only known problem is that auto-upgrading of
bitcode files doesn't seem to work properly (see
test/Bitcode/AutoUpgradeIntrinsics.ll).  Hopefully
a bitcode guru (who might that be? :) ) will fix it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44359 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-27 13:23:08 +00:00
Owen Anderson
d735ee85db Make LoopInfoBase more generic, in preparation for having MachineLoopInfo. This involves a small interface change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44348 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-27 03:43:35 +00:00
Owen Anderson
a16bbc9aa7 Fix another bug that was causing siod to fail.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44325 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-26 07:17:19 +00:00
Owen Anderson
00a6d1448d Allow GVN to eliminate read-only function calls when it can detect that they are redundant.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44323 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-26 02:26:36 +00:00
Anton Korobeynikov
fd94dd58ff Remove another leak. Due to some reason AliasSetTracker didn't had any dtor...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44320 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-25 23:52:02 +00:00
Chris Lattner
cfa597569d Implement PR1822
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44318 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-25 21:27:53 +00:00
Duncan Sands
827cde1c83 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44315 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-25 14:10:56 +00:00
Chris Lattner
148083a529 add a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44293 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-23 22:35:18 +00:00
Duncan Sands
bb65098d2c 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).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44287 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-23 09:10:17 +00:00
Chris Lattner
eec8b9a7d6 Fix PR1817.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44284 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-22 23:47:13 +00:00
Duncan Sands
73d4bb6676 Turn invokes of nounwind functions into ordinary calls.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44280 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-22 22:24:59 +00:00
Duncan Sands
5ef7be79e0 Readonly/readnone functions are allowed to throw
exceptions, so don't turn invokes of them into
calls.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44278 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-22 21:40:06 +00:00
Nick Lewycky
79a2c4f7a9 typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44262 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-21 05:21:54 +00:00
Dan Gohman
adf3eab773 Add explicit keywords.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44234 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-19 15:30:20 +00:00
Dale Johannesen
b51b4b5fdf Remove indeterminism from a loop. We think this will
fix an occasional nonrepeatable bootstrap failure we've
been seeing on Darwin.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44202 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-17 02:48:01 +00:00
Chris Lattner
a7d1ab0ab3 Fix PR1800 by correcting mistaken logic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44188 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-16 06:04:17 +00:00
Chris Lattner
1b12d8855d Implement PR1796 and Transforms/SimplifyCFG/noreturn-call.ll
by inserting unreachable after no-return calls.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44099 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-14 06:19:25 +00:00
Chris Lattner
b42c8f7101 Implement PR1786 by iterating between dead cycle elimination
and simplifycfg in the rare cases when it is needed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44044 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-13 07:32:38 +00:00
Andrew Lenharth
b410df995c Better check
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43897 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-08 18:45:15 +00:00
Andrew Lenharth
ab9338eb9f Fix PR1780
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43893 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-08 17:39:28 +00:00
Chris Lattner
f67f73a519 fix const correctness, BB is const, so its predecessors are too
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43780 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-06 22:07:40 +00:00
Chris Lattner
6390ae0a4a don't put erase or query for non-allocainst pointers in an set of allocainsts*'s
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43779 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-06 22:07:22 +00:00
Chris Lattner
cf5008a792 Implement PR1777 by detecting dependent phis that
all compute the same value.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43777 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-06 21:52:06 +00:00
Duncan Sands
91508a490b 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43775 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-06 20:39:11 +00:00
Chris Lattner
bde90f0fc1 wrap long lines
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43745 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-06 01:15:27 +00:00
Dan Gohman
cff550995b Fix an abort in instcombine when folding creates a vector rem instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43743 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-05 23:16:33 +00:00
Devang Patel
5d01aa484f If a value is incoming from outside the loop then the value does not need remapping and the value is never tracked through LastValueMap.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43728 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-05 19:32:30 +00:00
Duncan Sands
18b0ca854f If a long double is in a packed struct, it may be
that there is no padding.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43691 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-05 00:35:07 +00:00
Gordon Henriksen
c86b67742a Finishing initial docs for all transformations in Passes.html.
Also cleaned up some comments in source files.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43674 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-04 16:15:04 +00:00
Duncan Sands
3cb3650a27 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43672 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-04 14:43:57 +00:00
Chris Lattner
0647ebf1dc 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43668 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-04 06:37:55 +00:00
Duncan Sands
514ab348fd 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43620 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-01 20:53:16 +00:00
Owen Anderson
7ebba512c3 Fix test/Transforms/DeadStoreElimination/PartialStore.ll, which had been
silently failing because of an incorrect run line for some time.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43605 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-01 05:29:16 +00:00
Chris Lattner
74e012afd3 Fix InstCombine/2007-10-31-RangeCrash.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43596 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-01 02:18:41 +00:00
Dan Gohman
a24b294e74 Fix a typo in a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43553 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-31 14:35:39 +00:00
Evan Cheng
0e0014d049 At end of LSR, replace uses of now constant (as result of SplitCriticalEdge) PHI node with the constant value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43533 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-30 23:45:15 +00:00
Evan Cheng
8392772727 It's not safe to tell SplitCriticalEdge to merge identical edges. It may delete the phi instruction that's being processed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43524 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-30 22:27:26 +00:00
Evan Cheng
af62c09437 - Bug fixes.
- Allow icmp rewrite using an iv / stride of a smaller integer type.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43480 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-29 22:07:18 +00:00
Dan Gohman
a8cc4d3d3c Don't bitcast from pointer-to-vector to pointer-to-array when
lowering load and store instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43468 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-29 20:34:35 +00:00