1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 12:02:58 +02:00
Commit Graph

1411 Commits

Author SHA1 Message Date
Benjamin Kramer
29c0b4a9f7 SmallVector::erase: Assert that iterators are actually inside the vector.
The rationale here is that it's hard to write loops containing vector erases and
it only shows up if the vector contains non-trivial objects leading to crashes
when forming them out of garbage memory.

llvm-svn: 160854
2012-07-27 09:10:25 +00:00
Richard Trieu
6fd83cc91a Add operator== to APSInt. This will compare the signed bit before doing
the comparison.  This prevents large unsigned integers from being equal to
signed negative integers of the same bit width.

llvm-svn: 160642
2012-07-23 20:24:23 +00:00
Sylvestre Ledru
bf8acb65ac Fix a typo (the the => the)
llvm-svn: 160621
2012-07-23 08:51:15 +00:00
Bill Wendling
f720eb7a94 Remove tabs.
llvm-svn: 160471
2012-07-18 23:58:37 +00:00
Jordan Rose
18d21debd3 Allow PointerIntPairs to be created from const void *.
For a measure of safety, this conversion is only permitted if the
stored pointer type can also be created from a const void *.

llvm-svn: 160456
2012-07-18 21:58:49 +00:00
Jakob Stoklund Olesen
05ab4e5615 Fix broken ipo_ext_iterator constructors.
These functions have obviously never been used before.
They should be identical to the idf_ext_iterator counterparts.

llvm-svn: 160381
2012-07-17 17:57:25 +00:00
Jakob Stoklund Olesen
d489632f94 Allow for customized graph edge pruning in PostOrderIterator.h
Make it possible to prune individual graph edges from a post-order
traversal by specializing the po_iterator_storage template. Previously,
it was only possible to prune full graph nodes. Edge pruning makes it
possible to remove loop back-edges, for example.

Also replace the existing DFSetTraits customization hook with a
po_iterator_storage method for observing the post-order. DFSetTraits was
only used by LoopIterator.h which now provides a po_iterator_storage
specialization.

Thanks to Sean and Chandler for reviewing.

llvm-svn: 160366
2012-07-17 15:35:40 +00:00
Eric Christopher
73191af11c Move IsSameValue from clang's ASTImporter to be methods on the
APInt/APSInt classes.

Part of rdar://11875995

llvm-svn: 160223
2012-07-15 00:23:36 +00:00
Galina Kistanova
77f96f54b4 Fixed few warnings.
llvm-svn: 160192
2012-07-13 21:06:54 +00:00
Benjamin Kramer
abb64d7556 SmallVector: Make use of move semantics to speed up moving objects in erase() and insert()
llvm-svn: 159914
2012-07-08 12:06:35 +00:00
Chandler Carruth
22eafcefb4 Micro-optimize this function a bit. This shrinks the generated code
some, and allows the routine to be inlined into common callers. The
various bits that hit this code in their hotpath seem slightly lower on
the profile, but I can't really measure a performance improvement as
everything seems to still be bottlenecked on likely cache misses. =/

llvm-svn: 159648
2012-07-03 07:16:13 +00:00
Benjamin Kramer
19c2badc83 Avoid sign compare warning.
llvm-svn: 159481
2012-06-30 10:02:08 +00:00
Chandler Carruth
6f8cc37074 Remove 'static' from inline functions defined in header files.
There is a pretty staggering amount of this in LLVM's header files, this
is not all of the instances I'm afraid. These include all of the
functions that (in my build) are used by a non-static inline (or
external) function. Specifically, these issues were caught by the new
'-Winternal-linkage-in-inline' warning.

I'll try to just clean up the remainder of the clearly redundant "static
inline" cases on functions (not methods!) defined within headers if
I can do so in a reliable way.

There were even several cases of a missing 'inline' altogether, or my
personal favorite "static bool inline". Go figure. ;]

llvm-svn: 158800
2012-06-20 08:39:33 +00:00
David Blaikie
9205346d93 Don't copy a potentially-uninitialized variable.
Based on review discussion of r158638 with Chandler Carruth, Tobias von Koch, and Duncan Sands and a -Wmaybe-uninitialized warning from GCC.

llvm-svn: 158685
2012-06-18 22:31:28 +00:00
Benjamin Kramer
d408a3b134 Bring the return value of SmallVector::insert in line with std::vector::insert.
It always returns the iterator for the first inserted element, or the passed in
iterator if the inserted range was empty. Flesh out the unit test more and fix
all the cases it uncovered so far.

llvm-svn: 158645
2012-06-17 12:46:13 +00:00
Chandler Carruth
f0352b4be5 Remove SmallMap, and the several files that were used to implement it.
We have SmallDenseMap now that has more correct and predictable
semantics, even though it is a more narrow abstraction.

llvm-svn: 158644
2012-06-17 12:07:42 +00:00
Benjamin Kramer
f78d0a14b0 SmallVector: return a valid iterator for the rare case of inserting an empty range into a SmallVector.
Patch by Johannes Schaub!

llvm-svn: 158643
2012-06-17 11:52:22 +00:00
Chandler Carruth
5b13784777 Add a unit test for 'swap', and fix a pile of bugs in
SmallDenseMap::swap.

First, make it parse cleanly. Yay for uninstantiated methods.

Second, make the inline-buckets case work correctly. This is way
trickier than it should be due to the uninitialized values in empty and
tombstone buckets.

Finally fix a few typos that caused construction/destruction mismatches
in the counting unittest.

llvm-svn: 158641
2012-06-17 11:28:13 +00:00
Chandler Carruth
ea5804adca Add tests for *DenesMap for both key and value types' construction and
destruction and fix a bug in SmallDenseMap they caught.

This is kind of a poor-man's version of the testing that just adds the
addresses to a set on construction and removes them on destruction. We
check that double construction and double destruction don't occur.
Amusingly enough, this is enough to catch a lot of SmallDenseMap issues
because we spend a lot of time with fixed stable addresses in the inline
buffer.

The SmallDenseMap bug fix included makes grow() not double-destroy in
some cases. It also fixes a FIXME there, the code was pretty crappy. We
now don't have any wasted initialization, but we do move the entries in
inline bucket array an extra time. It's probably a better tradeoff, and
is much easier to get correct.

llvm-svn: 158639
2012-06-17 10:33:51 +00:00
Chandler Carruth
1501b6be37 Introduce a SmallDenseMap container that re-uses the existing DenseMap
implementation.

This type includes an inline bucket array which is used initially. Once
it is exceeded, an array of 64 buckets is allocated on the heap. The
bucket count grows from there as needed. Some highlights of this
implementation:

- The inline buffer is very carefully aligned, and so supports types
  with alignment constraints.
- It works hard to avoid aliasing issues.
- Supports types with non-trivial constructors, destructors, copy
  constructions, etc. It works reasonably hard to minimize copies and
  unnecessary initialization. The most common initialization is to set
  keys to the empty key, and so that should be fast if at all possible.

This class has a performance / space trade-off. It tries to optimize for
relatively small maps, and so packs the inline bucket array densely into
the object. It will be marginally slower than a normal DenseMap in a few
use patterns, so it isn't appropriate everywhere.

The unit tests for DenseMap have been generalized a bit to support
running over different map implementations in addition to different
key/value types. They've then been automatically extended to cover the
new container through the magic of GoogleTest's typed tests.

All of this is still a bit rough though. I'm going to be cleaning up
some aspects of the implementation, documenting things better, and
adding tests which include non-trivial types. As soon as I'm comfortable
with the correctness, I plan to switch existing users of SmallMap over
to this class as it is already more correct w.r.t. construction and
destruction of objects iin the map.

Thanks to Benjamin Kramer for all the reviews of this and the lead-up
patches. That said, more review on this would really be appreciated. As
I've noted a few times, I'm quite surprised how hard it is to get the
semantics for a hashtable-based map container with a small buffer
optimization correct. =]

llvm-svn: 158638
2012-06-17 09:05:09 +00:00
Benjamin Kramer
ed052699c6 Merge the SmallBitVector and BitVector unit tests with gtest's typed test magic and bring SmallBitVector up to date.
llvm-svn: 158600
2012-06-16 10:51:07 +00:00
Chandler Carruth
bdeac17070 Lift the NumElements and NumTombstones members into the super class
rather than the base class. Add a pile of boilerplate to indirect around
this.

This is pretty ugly, but it allows the super class to change the
representation of these values, which will be key for doing
a SmallDenseMap.

Suggestions on better method structuring / naming are welcome, but keep
in mind that SmallDenseMap won't have an 'unsigned' member to expose
a reference to... =/

llvm-svn: 158586
2012-06-16 01:18:07 +00:00
Chandler Carruth
d3d541a9d2 Factor DenseMap into a base class that implements the hashtable logic,
and a derived class that provides the allocation and growth strategy.

This is the first (and biggest) step toward building a SmallDenseMap
that actually behaves exactly the same as DenseMap, and supports all the
same types and interface points with the same semantics.

llvm-svn: 158585
2012-06-16 01:05:01 +00:00
Stepan Dyatkovskiy
bb6d2dc9da SmallMap, FlatArrayMap::copyFrom
Replaced memcpy with std::copy, since the first one may work improperly with non POD data.

llvm-svn: 158457
2012-06-14 16:59:43 +00:00
Chandler Carruth
e63fe55776 Group the 'unsigned' members after the pointer to avoid 4 bytes of
padding on x86-64.

llvm-svn: 158421
2012-06-13 21:44:07 +00:00
Benjamin Kramer
d9f9d9d77d Hashing: Remove outdated comment. Support for reserved hash values was removed in r151865.
llvm-svn: 158276
2012-06-09 15:33:28 +00:00
Benjamin Kramer
23f7f57c50 Add move semantics to APInt.
llvm-svn: 157883
2012-06-02 08:39:08 +00:00
Benjamin Kramer
b9ec87406a Provide move semantics for (Small)BitVector.
CodeGen makes a lot of BitVector copies.

llvm-svn: 157826
2012-06-01 18:52:53 +00:00
Benjamin Kramer
2f57459340 IntrusiveRefCntPtr: Simplify operator= as suggested by Richard Smith.
This way the constructors do all the hard work. No intended functionality change.

llvm-svn: 157773
2012-05-31 22:25:25 +00:00
Douglas Gregor
bbf03d028e DenseMap's move assignment operator needs to return *this
llvm-svn: 157644
2012-05-29 20:33:09 +00:00
Chris Lattner
6cdc78cdf4 add some helper methods to make the type more uniform.
llvm-svn: 157554
2012-05-28 01:29:59 +00:00
Benjamin Kramer
fb377a947e DenseMap: Use an early exit when there is nothing to do in DestroyAll().
llvm-svn: 157550
2012-05-27 22:53:10 +00:00
Benjamin Kramer
5144cce317 IntrusiveRefCntPtr: Use the same pattern as the other operator= overloads when using rvalue refs.
llvm-svn: 157546
2012-05-27 20:46:04 +00:00
Benjamin Kramer
895da0f01a DenseMap: Provide a move ctor and move semantics for operator[] and FindAndConstruct.
The only missing part is insert(), which uses a pair of parameters and I haven't
figured out how to convert it to rvalue references. It's now possible to use a
DenseMap with std::unique_ptr values :)

llvm-svn: 157539
2012-05-27 17:38:30 +00:00
Benjamin Kramer
ceee3e117e DenseMap: Factor destruction into a common helper method.
llvm-svn: 157538
2012-05-27 17:38:18 +00:00
Benjamin Kramer
c529ae7728 Move-enable IntrusiveRefCntPtr.
These tend to be copied around a lot, moving it instead saves a ton of memory
accesses.

llvm-svn: 157535
2012-05-27 16:22:08 +00:00
Justin Holewinski
ee3de35dee Remove the PTX back-end and all of its artifacts (triple, etc.)
This back-end was deprecated in favor of the NVPTX back-end.

NV_CONTRIB

llvm-svn: 157417
2012-05-24 21:38:21 +00:00
Nuno Lopes
328f9efec2 fix the quotient returned by sdivrem() for the case when LHS is negative and RHS is positive
based on a patch by Preston Briggs, with some modifications

llvm-svn: 157231
2012-05-22 01:09:48 +00:00
Benjamin Kramer
386e9a3f75 Disambiguate call to operator==.
clang++ and msvc happily had no problem with it but g++ refuses to compile.

llvm-svn: 157126
2012-05-19 19:32:11 +00:00
Benjamin Kramer
c4cb78c727 ValueMap: Use DenseMap's find_as mechanism to reduce use list churn.
Otherwise just looking up a value in the map requires creating a VH, adding it to the use lists and destroying it again.

llvm-svn: 157124
2012-05-19 19:15:32 +00:00
Benjamin Kramer
16ca97c2f1 Provide move semantics for TinyPtrVector and for DenseMap's rehash function.
This makes DenseMap<..., TinyPtrVector<...>> as cheap as it always should've been!

llvm-svn: 157113
2012-05-19 13:28:54 +00:00
Stepan Dyatkovskiy
6d83dd3cf8 Fixed one small stupid, but critical bug.
llvm-svn: 156810
2012-05-15 09:21:39 +00:00
Jakob Stoklund Olesen
184e921187 Remove the expensive BitVector::operator~().
Returning a temporary BitVector is very expensive. If you must, create
the temporary explicitly: Use BitVector(A).flip() instead of ~A.

llvm-svn: 156768
2012-05-14 15:46:27 +00:00
Jakob Stoklund Olesen
f8648a8b0d Remove BitVector binops.
These operators were crazy slow, calling malloc to return a temporary
result. At the same time, they look very innocent when used in code.

If you need temporary BitVectors to compute your thing, create them
explicitly, and use the inplace logical operators. This makes the high
cost explicit in the code.

llvm-svn: 156767
2012-05-14 15:37:25 +00:00
Jakob Stoklund Olesen
8783cdf045 Add BitVector::anyCommon().
The existing operation (A & B).any() is very slow.

llvm-svn: 156760
2012-05-14 15:01:19 +00:00
Michael J. Spencer
ca721ac5bf Add doxygen comments.
llvm-svn: 156665
2012-05-11 23:34:39 +00:00
Michael J. Spencer
6161587c9f [Support/StringRef] Add find_last_not_of and {r,l,}trim.
llvm-svn: 156652
2012-05-11 22:08:50 +00:00
Chad Rosier
219f1f7ac8 Add Triple::getiOSVersion.
This new function provides a way to get the iOS version number from ios triples.
Part of rdar://11409204

llvm-svn: 156483
2012-05-09 17:23:48 +00:00
Jordy Rose
7d6fc98ccf Constify (trivially) ImmutableSet::iterator::getVisitState().
This was probably intended all along.

llvm-svn: 156318
2012-05-07 19:24:40 +00:00
Justin Holewinski
4ca961430f This patch adds a new NVPTX back-end to LLVM which supports code generation for NVIDIA PTX 3.0. This back-end will (eventually) replace the current PTX back-end, while maintaining compatibility with it.
The new target machines are:

nvptx (old ptx32) => 32-bit PTX
nvptx64 (old ptx64) => 64-bit PTX

The sources are based on the internal NVIDIA NVPTX back-end, and
contain more functionality than the current PTX back-end currently
provides.

NV_CONTRIB

llvm-svn: 156196
2012-05-04 20:18:50 +00:00