Commit Graph

1663 Commits

Author SHA1 Message Date
Chris Lattner
9907cb12ae Fix PR1774 and BasicAA/2007-11-05-SizeCrash.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43756 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-06 05:58:42 +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
Dan Gohman
9962054775 Add explicit keywords.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43464 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-29 19:52:04 +00:00
Owen Anderson
ef15029258 Make a comment better.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43379 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-26 03:47:14 +00:00
Hartmut Kaiser
081fdf238b Silenced a VC++ warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43374 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-25 23:49:14 +00:00
Owen Anderson
f92ff03f71 Fix for PR1741.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43326 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-25 02:36:18 +00:00
Owen Anderson
d20cc14dbf Make DomTree and PostDomTree thin wrappers around DomTreeBase, rather than inheriting from it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43259 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-23 20:58:37 +00:00
Dan Gohman
246b2564d3 Move the SCEV object factors from being static members of the individual
SCEV subclasses to being non-static member functions of the ScalarEvolution
class.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43224 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-22 18:31:58 +00:00
Owen Anderson
49b653aa6a Template DominatorTreeBase by node type. This is the next major step towards
having dominator information on MBB's.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43036 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-16 19:59:25 +00:00
Gordon Henriksen
c0491ac8b6 Bindings for the verifier.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42707 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-06 21:00:36 +00:00
Owen Anderson
9cb7f49ee9 Completely merge the implementation details of DomTree and PostDomTree.
Also, add a FIXME for a bug in PostDomTree calculation I noticed while writing this,


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42593 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-03 21:25:45 +00:00
Dan Gohman
cb406c2597 Use empty() member functions when that's what's being tested for instead
of comparing begin() and end().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42585 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-03 19:26:29 +00:00
Owen Anderson
471ab54df7 Factor some code from the DomTree and PostDomTree calculate methods up into
each one's runOnFunction method.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42563 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-03 03:20:17 +00:00
Dale Johannesen
9ab7fb3ba4 Rewrite sqrt and powi to use anyfloat. By popular demand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42537 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-02 17:43:59 +00:00
Owen Anderson
ab528fe0fb Template-ize more of the DomTree internal implementation details. Only the calculate() methods for DomTree and PostDomTree remain to be merged/template-ized.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42476 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-30 04:17:16 +00:00
Chris Lattner
be207738d3 Add a new DenseSet abstraction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42474 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-30 00:47:20 +00:00
Daniel Berlin
336c6c0486 Switch to densemap rather than std::set
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42462 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-29 00:50:40 +00:00
Owen Anderson
2824121cf1 Remove unneeded #include.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42428 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-28 01:25:07 +00:00
Owen Anderson
303f47b1dd Have PostDomTree use the newly templated DFSPass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42427 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-28 01:23:47 +00:00
Dale Johannesen
317096ab37 Add sqrt and powi intrinsics for long double.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42423 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-28 01:08:20 +00:00
Daniel Berlin
c7a12ae24a Ignore redundant constraints
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42397 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-27 15:42:23 +00:00
Nick Lewycky
9a2f93121b Build the correct range for loops with unusual bounds. Fix from Jay Foad.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42394 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-27 14:12:54 +00:00
Duncan Sands
2a3876d885 Add a newline to the end of this file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42314 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-25 20:08:48 +00:00
Bill Wendling
cab5f5d269 Don't execute dump unless NDEBUG isn't defined.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42280 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-24 22:43:48 +00:00
Daniel Berlin
e6f0479aee Comment fixups
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42279 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-24 22:20:45 +00:00
Daniel Berlin
d81ccc2806 Implement offline variable substitution in order to reduce memory
and time usage.
Fixup operator == to make this work, and add a resize method to DenseMap
so we can resize our hashtable once we know how big it should be.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42269 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-24 19:45:49 +00:00
Owen Anderson
68099d58cb Merge significant portions of the DomTree and PostDomTree implementations.
The two remaining unmerged parts are DFSPass, and the Calculate().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42255 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-24 02:29:29 +00:00
Owen Anderson
04fa569320 Factor the calculation details for PostDomTree out of PostDominators.cpp and
into a separate header file.

Next step: merging PostDominatorCalculation.h with DominatorCalculation.h.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42251 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-23 22:21:00 +00:00
Owen Anderson
ce4d88aa64 Add partial caching of non-local memory dependence queries. This provides a modest
speedup for GVN.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42185 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-21 03:53:52 +00:00
Owen Anderson
742f9b6682 Add a flag to mark a dirty cache entry. This is not yet used, but will eventually
help non-local memdep caching.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42137 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-19 16:13:57 +00:00
Devang Patel
0f2fb60a18 ooops...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42118 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-18 23:58:14 +00:00
Daniel Berlin
c6d939818b Fix bug in andersen's related to test_and_set.
Add operator == and != to SparseBitVector.
Simplify code for test_and_set


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42018 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-16 23:59:53 +00:00
Daniel Berlin
aad158891c Rewrite of andersen's to be about 100x faster, cleaner, and begin to support field sensitivity
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42016 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-16 21:45:02 +00:00
Dan Gohman
693f541526 Change "tmp." to "tmp" for temporaries created by ScalarEvolutionExpander
for consistency with many other transforms.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41957 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-14 20:11:40 +00:00
Owen Anderson
0a890e2fb5 Fix a typo in memdep, which was causing PR1648.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41833 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-11 04:31:00 +00:00
Owen Anderson
7fad7e3db8 Remove an un-needed dependence query. This improves compile time marginally on 401.bzip2.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41792 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-09 21:43:49 +00:00
Owen Anderson
718cb665ca Add lengthof and endof templates that hide a lot of sizeof computations.
Patch by Sterling Stein!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41758 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-07 04:06:50 +00:00
Dale Johannesen
43421b3dd7 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.)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41747 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-06 18:13:44 +00:00
Evan Cheng
df344febe2 Missing break. Patch by Wojciech Matyjewicz.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41727 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-05 21:36:14 +00:00
Devang Patel
e79bad66e0 Use SmallVector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41230 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-21 16:54:51 +00:00
Devang Patel
7c6c55db4d No need to hardcode SmallVector size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41228 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-21 16:39:43 +00:00
Devang Patel
b7211a2ce1 Use SmallVector instead of std::vector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41207 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-21 00:31:24 +00:00
Anton Korobeynikov
96fea337d2 - Use correct header for SCEV inside LoopPass.cpp
- Move SCEVExpander::expand() out-of-line workarounding possible toolchain bug


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41197 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-20 21:17:26 +00:00
Owen Anderson
4d13de4e3b Cache non-local memory dependence analysis. This is a significant compile
time performance win in most cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41126 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-16 21:27:05 +00:00
Chris Lattner
001f7534e0 constant fold ptrtoint(inttoptr) with target data when available. This allows
us to fold the entry block of PR1602 to false instead of:

br i1 icmp eq (i32 and (i32 ptrtoint (void (%struct.S*)* inttoptr (i64
1 to void (%struct.S*)*) to i32), i32 1), i32 0), label %cond_next, label
%cond_true



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41023 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-11 23:49:01 +00:00
Devang Patel
6b4af744b8 Do not overuse std::string. Pass around char * directly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41001 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-10 18:29:32 +00:00
Owen Anderson
9528f11481 Make NonLocal and None const in the right way. :-)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40961 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-09 04:42:44 +00:00
Owen Anderson
642a9e3436 Add more comments to memdep.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40953 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-08 22:26:03 +00:00
Owen Anderson
80b1f09693 Make memdep fit in 80 cols.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40950 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-08 22:01:54 +00:00
Owen Anderson
8cad423d94 Change the None and NonLocal markers in memdep to be const.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40946 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-08 21:39:39 +00:00