1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00
Commit Graph

457 Commits

Author SHA1 Message Date
Aaron Ballman
cfe5b40252 Correcting the ArrayRef test to not cause use-after-free bugs with initializer lists. Should also silence a -Wsign-compare warning accidentally introduced.
llvm-svn: 229515
2015-02-17 17:44:07 +00:00
Aaron Ballman
6056eecb6d Adding additional tests to ensure that initializer lists created from return values and as function arguments also work as expected.
llvm-svn: 229513
2015-02-17 17:08:08 +00:00
Aaron Ballman
49e7dd6b8e Addressing a post-commit review comment suggesting to avoid using direct initialization.
llvm-svn: 229512
2015-02-17 16:57:05 +00:00
Aaron Ballman
cda3605b43 I believe we no longer require LLVM_HAS_INITIALIZER_LISTS; it's supported in MSVC 2013 and GCC. Added a trivial test to ensure the ArrayRef initializer list constructor is called and behaves as expected.
If any of the bots complain (perhaps due to an antiquated version of an STL implementation), I will revert.

llvm-svn: 229502
2015-02-17 15:37:53 +00:00
NAKAMURA Takumi
a34ef0b5be ADT/PointerIntPairTest.cpp: Prune obsolete #if. We don't support msc17 anymore.
llvm-svn: 229501
2015-02-17 15:36:01 +00:00
Aaron Ballman
0b45511a2e Removing LLVM_DELETED_FUNCTION, as MSVC 2012 was the last reason for requiring the macro. NFC; LLVM edition.
llvm-svn: 229340
2015-02-15 22:54:22 +00:00
Duncan P. N. Exon Smith
8456fa3c41 ADT: Allow up to 18 arguments in hash_combine()
I just realized that the specialized metadata node patch I'm about to
commit won't compile on old compilers.  Bump `hash_combine()`'s support
for non-variadic templates to 18 (I tested this by reversing the logic
in the #ifdef).

llvm-svn: 228629
2015-02-09 23:21:05 +00:00
Benjamin Kramer
28fba477c6 SmallVector: Move emplace_back to SmallVectorImpl.
This resolves the strange effect that emplace_back is only available
when the type contained in the vector is not trivially copyable.

llvm-svn: 228496
2015-02-07 16:41:02 +00:00
Duncan P. N. Exon Smith
7f33c007a0 ADT: Add int64_t interoperability to APSInt
Add some API to `APSInt` to make it easier to compare with `int64_t`.

  - `APSInt::compareValues(APSInt, APSInt)` returns 1, -1 or 0 for
    greater, lesser, or equal, doing the right thing for mismatched
    "has-sign" and bitwidths.  This is just like `isSameValue()` (and is
    now the implementation of it).
  - `APSInt::get(int64_t)` gets a signed `APSInt`.
  - `operator<(int64_t)`, etc., are implemented trivially via `get()`
    and `compareValues()`.
  - Also added `APSInt::getUnsigned(uint64_t)` to make it easier to test
    `compareValues()`.

llvm-svn: 228239
2015-02-05 00:17:43 +00:00
Joerg Sonnenberger
d482228a3f The canonical CPU variant for ARM according to config.guess uses a
suffix it seems:

    # ./config.guess
    earmv7hfeb-unknown-netbsd7.99.4

Extend the triple parsing to support this. Avoid running the ARM parser
multiple times because StringSwitch is not lazy.

Reviewers: Renato Golin, Tim Northover

Differential Revision: http://reviews.llvm.org/D7166

llvm-svn: 227085
2015-01-26 11:41:48 +00:00
Lang Hames
25dc17847a [ADT] Add move operations to SmallVector<T,N> from SmallVectorImpl<T>.
This makes it possible to move between SmallVectors of different sizes.

Thanks to Dave Blaikie and Duncan Smith for patch feedback.

llvm-svn: 226899
2015-01-23 06:25:17 +00:00
Michael Gottesman
5abf238495 [tinyptrvector] Add in a MutableArrayRef implicit conversion operator to complement the ArrayRef implicit conversion operator.
llvm-svn: 226428
2015-01-19 03:25:33 +00:00
Richard Trieu
d6743940e6 Disable -Wunknown-pragmas in a test so that Clang without -Wself-move will not
complain that the flag doesn't exist.

llvm-svn: 225931
2015-01-14 01:50:12 +00:00
Aaron Ballman
ed32ba7ebd Silence warnings about unknown pragmas for compilers that are not Clang. NFC.
llvm-svn: 225788
2015-01-13 14:30:07 +00:00
Richard Trieu
499c1ba6e9 Disable a warning for self move since the test is checking for this behavior.
llvm-svn: 225754
2015-01-13 02:10:33 +00:00
Lang Hames
edc98a62db [APFloat][ADT] Fix sign handling logic for FMA results that truncate to zero.
This patch adds a check for underflow when truncating results back to lower
precision at the end of an FMA. The additional sign handling logic in
APFloat::fusedMultiplyAdd should only be performed when the result of the
addition step of the FMA (in full precision) is exactly zero, not when the
result underflows to zero.

Unit tests for this case and related signed zero FMA results are included.

Fixes <rdar://problem/18925551>.

llvm-svn: 225123
2015-01-04 01:20:55 +00:00
Chandler Carruth
d5912b0090 Revert r225053: Add an ArrayRef upcasting constructor from ArrayRef<U*> -> ArrayRef<T*> where T is a base of U.
This appears to have broken at least the windows build bots due to
compile errors in the predicate that didn't simply supress the overload.
I'm not sure what the fix is, and the bots have been broken for a long
time now so I'm just reverting until Michael can figure out a fix.

llvm-svn: 225064
2015-01-01 13:01:25 +00:00
Michael Gottesman
2c8ecfdec0 Add 2x constructors for TinyPtrVector, one that takes in one elemenet and the other that takes in an ArrayRef<EltTy>
Currently one can only construct an empty TinyPtrVector. These are just missing
elements of the API.

llvm-svn: 225055
2014-12-31 23:33:24 +00:00
Michael Gottesman
b2e01905b0 Add a SmallMapVector class that is a MapVector with a Map of SmallDenseMap and a Vector of SmallVector.
llvm-svn: 225054
2014-12-31 23:33:21 +00:00
Michael Gottesman
166915c263 Add an ArrayRef upcasting constructor from ArrayRef<U*> -> ArrayRef<T*> where T is a base of U.
llvm-svn: 225053
2014-12-31 23:33:18 +00:00
Aaron Ballman
6dbe89c5fb Silencing several "multiple copy constructors" warnings from MSVC; NFC.
llvm-svn: 223238
2014-12-03 14:44:16 +00:00
Duncan P. N. Exon Smith
27a4458649 ADT: Add SmallVector<>::emplace_back()
llvm-svn: 223201
2014-12-03 04:45:09 +00:00
Michael Ilseman
970e7c5fb1 Compilation test for PostOrderIterator.
If the template specialization for externally managed sets in
PostOrderIterator call too far out of sync with each other, this unit
test will fail to build. This is especially useful for developers who
may not build Clang (the only in-tree user) every time.

llvm-svn: 222447
2014-11-20 19:33:33 +00:00
Lang Hames
2082c9d610 [ADT] Fix PR20728 - Incorrect APFloat::fusedMultiplyAdd results for x86_fp80.
As detailed at http://llvm.org/PR20728, due to an internal overflow in
APFloat::multiplySignificand the APFloat::fusedMultiplyAdd method can return
incorrect results for x87DoubleExtended (x86_fp80) values. This commonly
manifests as incorrect constant folding of libm fmal calls on x86. E.g.

fmal(1.0L, 1.0L, 3.0L) == 0.0L      (should be 4.0L)

This patch fixes PR20728 by adding an extra bit to the significand for
intermediate results of APFloat::multiplySignificand, avoiding the overflow.

llvm-svn: 222374
2014-11-19 19:15:41 +00:00
David Blaikie
7499cbae4c Remove StringMap::GetOrCreateValue in favor of StringMap::insert
Having two ways to do this doesn't seem terribly helpful and
consistently using the insert version (which we already has) seems like
it'll make the code easier to understand to anyone working with standard
data structures. (I also updated many references to the Entry's
key and value to use first() and second instead of getKey{Data,Length,}
and get/setValue - for similar consistency)

Also removes the GetOrCreateValue functions so there's less surface area
to StringMap to fix/improve/change/accommodate move semantics, etc.

llvm-svn: 222319
2014-11-19 05:49:42 +00:00
David Blaikie
5d50f1a98a StringMap: Test and finish off supporting perfectly forwarded values in StringMap operations.
Followup to r221946.

llvm-svn: 221958
2014-11-14 00:41:46 +00:00
David Blaikie
f9f5076648 Ensure function_refs are copyable even from non-const references
A subtle bug was found where attempting to copy a non-const function_ref
lvalue would actually invoke the generic forwarding constructor (as it
was a closer match - being T& rather than the const T& of the implicit
copy constructor). In the particular case this lead to a dangling
function_ref member (since it had referenced the function_ref passed by
value to its ctor, rather than the outer function_ref that was still
alive)

SFINAE the converting constructor to not be considered if the copy
constructor is available and demonstrate that this causes the copy to
refer to the original functor, not to the function_ref it was copied
from. (without the code change, the test would fail as Y would be
referencing X and Y() would see the result of the mutation to X, ie: 2)

llvm-svn: 221753
2014-11-12 02:06:08 +00:00
Michael Gottesman
d4b999b2da Add MapVector::rbegin(), MapVector::rend() to completment MapVector::begin(), MapVector::end().
These just delegate to the underlying vector type in the MapVector.

Also just add in some sanity unittests.

llvm-svn: 220687
2014-10-27 17:20:53 +00:00
Lang Hames
9793d69437 [ADT] Add a 'find_as' operation to DenseSet.
This operation is analogous to its counterpart in DenseMap: It allows lookup
via cheap-to-construct keys (provided that getHashValue and isEqual are
implemented for the cheap key-type in the DenseMapInfo specialization).

Thanks to Chandler for the review.

llvm-svn: 220168
2014-10-19 19:36:33 +00:00
Chandler Carruth
2a55c85b24 [ADT] Add an (ADL-friendly) abs free function for APFloat that returns
by value having cleared the sign bit.

llvm-svn: 219485
2014-10-10 08:27:22 +00:00
Matt Arsenault
09219bef3e Add minnum / maxnum to APFloat
llvm-svn: 219475
2014-10-10 05:21:32 +00:00
Chandler Carruth
f0786b5838 [ADT] Replace the logb implementation with the simpler and much closer
to what we actually want ilogb implementation. This makes everything
*much* easier to deal with and is actually what we want when using it
anyways.

llvm-svn: 219474
2014-10-10 05:14:12 +00:00
Chandler Carruth
e6b432108a [ADT] Add the scalbn function for APFloat.
llvm-svn: 219473
2014-10-10 04:54:30 +00:00
Chandler Carruth
fc0c6a60f7 [ADT] Implement the 'logb' functionality for APFloat. This is necessary
to implement complex division in the constant folder of Clang.

llvm-svn: 219471
2014-10-10 04:17:04 +00:00
Chandler Carruth
9274f76fc2 [ADT] Add basic operator overloads for arithmetic to APFloat to make
code using it more readable.

Also add a copySign static function that works more like the standard
function by accepting the value and sign-carying value as arguments.

No interesting logic here, but tests added to cover the basic API
additions and make sure they do something plausible.

llvm-svn: 219453
2014-10-09 23:26:15 +00:00
Kaelyn Takata
3a59730bde Add return value and negative checks to MapVector::erase from r219240.
llvm-svn: 219250
2014-10-07 23:11:49 +00:00
Kaelyn Takata
6c182edff1 Add size_t MapVector::erase(KeyT) similar to the one in std::map.
llvm-svn: 219240
2014-10-07 21:15:51 +00:00
David Blaikie
abe7833c2f Update test name to match changes made in r218783
Addressing post commit review feedback from Justin Bogner.

llvm-svn: 218821
2014-10-01 21:19:39 +00:00
David Blaikie
7b8bbd0e46 Add an immovable type to test Optional<T>::emplace more rigorously after r218732.
llvm-svn: 218783
2014-10-01 18:29:44 +00:00
NAKAMURA Takumi
db6522181c ADTTests/OptionalTest.cpp: Use LLVM_DELETED_FUNCTION.
llvm-svn: 218750
2014-10-01 09:14:43 +00:00
Jordan Rose
9f866eaf0a Add an emplace(...) method to llvm::Optional<T>.
This can be used for in-place initialization of non-moveable types.
For compilers that don't support variadic templates, only up to four
arguments are supported. We can always add more, of course, but this
should be good enough until we move to a later MSVC that has full
support for variadic templates.

Inspired by std::experimental::optional from the "Library Fundamentals" C++ TS.
Reviewed by David Blaikie.

llvm-svn: 218732
2014-10-01 02:12:35 +00:00
Jordan Rose
546768112a Add getValueOr to llvm::Optional<T>.
This takes a single argument convertible to T, and
- if the Optional has a value, returns the existing value,
- otherwise, constructs a T from the argument and returns that.

Inspired by std::experimental::optional from the "Library Fundamentals" C++ TS.

llvm-svn: 218618
2014-09-29 18:56:08 +00:00
Matt Arsenault
62b3e7bfd0 Add hsail and amdil64 to Triple
llvm-svn: 218142
2014-09-19 19:52:11 +00:00
Ed Maste
98616ed207 Add unit test for r217454
llvm-svn: 217786
2014-09-15 16:57:12 +00:00
David Blaikie
aa3930b088 Add some negative (and positive) static_assert checks for ArrayRef-of-pointer conversions introduced in r216709
llvm-svn: 216830
2014-08-31 01:33:41 +00:00
Craig Topper
dc6431e879 Add a test for converting ArrayRef<T *> to ArrayRef<const T *>.
llvm-svn: 216821
2014-08-30 16:48:19 +00:00
Craig Topper
43cee2f5fc Simplify creation of a bunch of ArrayRefs by using None, makeArrayRef or just letting them be implicitly created.
llvm-svn: 216525
2014-08-27 05:25:25 +00:00
Duncan P. N. Exon Smith
119044acf4 ADT: Unit test for ArrayRef::equals change in r215986
llvm-svn: 216008
2014-08-19 19:18:46 +00:00
David Blaikie
e490f547d3 Fix -Wsign-compare warnings
llvm-svn: 215483
2014-08-12 23:23:05 +00:00
Reid Kleckner
3f1f5c1808 APInt: Make self-move-assignment a no-op to fix stage3 clang-cl
It's not clear what the semantics of a self-move should be.  The
consensus appears to be that a self-move should leave the object in a
moved-from state, which is what our existing move assignment operator
does.

However, the MSVC 2013 STL will perform self-moves in some cases.  In
particular, when doing a std::stable_sort of an already sorted APSInt
vector of an appropriate size, one of the merge steps will self-move
half of the elements.

We don't notice this when building with MSVC, because MSVC will not
synthesize the move assignment operator for APSInt.  Presumably MSVC
does this because APInt, the base class, has user-declared special
members that implicitly delete move special members.  Instead, MSVC
selects the copy-assign operator, which defends against self-assignment.
Clang, on the other hand, selects the move-assign operator, and we get
garbage APInts.

llvm-svn: 215478
2014-08-12 22:01:39 +00:00