Commit Graph

778 Commits

Author SHA1 Message Date
Craig Topper
7271492c50 [APInt] In sext single word case, use SignExtend64 and let the APInt constructor mask off any excess bits.
The current code is trying to be clever with shifts to avoid needing to clear unused bits. But it looks like the compiler is unable to optimize out the unused bit handling in the APInt constructor. Given this its better to just use SignExtend64 and have more readable code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301133 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 17:16:24 +00:00
Renato Golin
ea7650c4ed Revert "[APInt] Add ashrInPlace method and implement ashr using it. Also fix a bug in the shift by BitWidth handling."
This reverts commit r301094, as it broke all ARM self-hosting bots.

PR32754.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301110 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 12:02:07 +00:00
Craig Topper
0d0472f857 [APInt] Add ashrInPlace method and implement ashr using it. Also fix a bug in the shift by BitWidth handling.
For single word, shift by BitWidth was always returning 0, but for multiword it was based on original sign. Now single word matches multi word.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301094 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-22 22:00:03 +00:00
Zachary Turner
0c01e44a15 [BitVector] Add find_last() and find_last_unset().
Differential Revision: https://reviews.llvm.org/D32302

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301014 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 18:07:46 +00:00
Serguei Katkov
c849a0cc07 [AsmWriter/APFloat] FP constant printing: Avoid usage of locale dependent snprinf
This should fix the bug https://bugs.llvm.org/show_bug.cgi?id=12906

To print the FP constant AsmWriter does the following:

  1) convert FP value to String (actually using snprintf function which is locale dependent).
  2) Convert String back to FP Value
  3) Compare original and got FP values. If they are not equal just dump as hex.

The problem happens on the 2nd step when APFloat does not expect group delimiter or
fraction delimiter other than period symbol and so on, which can be produced on the
first step if LLVM library is used in an environment with corresponding locale set.

To fix this issue the locale independent APFloat:toString function is used.
However it prints FP values slightly differently than snprintf does. Specifically
it suppress trailing zeros in significant, use capital E and so on.
It results in 117 test failures during make check.
To avoid this I've also updated APFloat.toString a bit to pass make check at least.

Reviewers: sberg, bogner, majnemer, sanjoy, timshen, rnk

Reviewed By: timshen, rnk

Subscribers: rnk, llvm-commits

Differential Revision: https://reviews.llvm.org/D32276


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300943 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 02:52:17 +00:00
Zachary Turner
2a7d654e64 Resubmit "[BitVector] Add operator<<= and operator>>=."
This was failing due to the use of assigning a Mask to an
unsigned, rather than to a BitWord.  But most systems do not
have sizeof(unsigned) == sizeof(unsigned long), so the mask
was getting truncated.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300857 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 16:56:54 +00:00
Zachary Turner
154c0ad769 Revert "[BitVector] Add operator<<= and operator>>=."
This is causing test failures on Linux / BSD systems.  Reverting
while I investigate.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300852 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 16:35:22 +00:00
Craig Topper
b52e0e4247 [APInt] Add isSubsetOf method that can check if one APInt is a subset of another without creating temporary APInts
This question comes up in many places in SimplifyDemandedBits. This makes it easy to ask without allocating additional temporary APInts.

The BitVector class provides a similar functionality through its (IMHO badly named) test(const BitVector&) method. Though its output polarity is reversed.

I've provided one example use case in this patch. I plan to do more as a follow up.

Differential Revision: https://reviews.llvm.org/D32258



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300851 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 16:17:13 +00:00
Zachary Turner
503ce9f8c1 [BitVector] Add operator<<= and operator>>=.
Differential Revision: https://reviews.llvm.org/D32244

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300848 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 15:57:58 +00:00
Craig Topper
5649a8228b Recommit "[APInt] Add back the asserts that check that the APInt shift methods aren't called with values larger than BitWidth."
This includes a fix to clamp a right shift of larger than BitWidth in DAG combining.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300816 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 03:49:18 +00:00
Craig Topper
b3443b3378 Revert r300811 "[APInt] Add back the asserts that check that the APInt shift methods aren't called with values larger than BitWidth."
This is failing a self host debug build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300813 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 02:46:21 +00:00
Craig Topper
69a88f72e9 [APInt] Add back the asserts that check that the APInt shift methods aren't called with values larger than BitWidth.
The underlying tcShiftRight/tcShiftLeft functions support the larger bit widths but the APInt interface shouldn't rely on that.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300811 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 02:03:09 +00:00
Craig Topper
4bf2830a01 [APInt] Make operator<<= shift in place. Improve the implementation of tcShiftLeft and use it to implement operator<<=.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300526 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 04:39:48 +00:00
Craig Topper
9128da5831 [APInt] Merge the multiword code from lshrInPlace and tcShiftRight into a single implementation
This merges the two different multiword shift right implementations into a single version located in tcShiftRight. lshrInPlace now calls tcShiftRight for the multiword case.

I retained the memmove fast path from lshrInPlace and used a memset for the zeroing. The for loop is basically tcShiftRight's implementation with the zeroing and the intra-shift of 0 removed.

Differential Revision: https://reviews.llvm.org/D32114



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300503 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 21:43:43 +00:00
Craig Topper
ef47b09cd9 [APInt] Remove self move check from move assignment operator
This was added to work around a bug in MSVC 2013's implementation of stable_sort. That bug has been fixed as of MSVC 2015 so we shouldn't need this anymore.

Technically the current implementation has undefined behavior because we only protect the deleting of the pVal array with the self move check. There is still a memcpy of that.VAL to VAL that isn't protected. In the case of self move those are the same local and memcpy is undefined for src and dst overlapping.

This reduces the size of the opt binary on my local x86-64 build by about 4k.

Differential Revision: https://reviews.llvm.org/D32116




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300477 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 18:44:27 +00:00
Craig Topper
2f3c5dbfdb [APInt] Fix a bug in lshr by a value more than 64 bits above the bit width.
This was throwing an assert because we determined the intra-word shift amount by subtracting the size of the full word shift from the total shift amount. But we failed to account for the fact that we clipped the full word shifts by total words first. To fix this just calculate the intra-word shift as the remainder of dividing by bits per word.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300405 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-16 01:03:51 +00:00
Alex Denisov
1ad79db10e Add more test cases for StringRef::edit_distance
Example strings taken from here: http://www.let.rug.nl/~kleiweg/lev/



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300312 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-14 08:34:32 +00:00
Richard Smith
74413b926a Remove all allocation and divisions from GreatestCommonDivisor
Switch from Euclid's algorithm to Stein's algorithm for computing GCD. This
avoids the (expensive) APInt division operation in favour of bit operations.
Remove all memory allocation from within the GCD loop by tweaking our `lshr`
implementation so it can operate in-place.

Differential Revision: https://reviews.llvm.org/D31968


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300252 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 20:29:59 +00:00
Zachary Turner
c29751d1b4 Fix signed / unsigned comparison warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299873 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-10 20:01:50 +00:00
Zachary Turner
a360984c0b [Support] Add support for finding unset bits in a BitVector.
BitVector had methods for searching for the first and next
set bits, but it did not have analagous methods for finding
the first and next unset bits.  This is useful when your ones
and zeros are grouped together and you want to iterate over
ranges of ones and zeros.

Differential Revision: https://reviews.llvm.org/D31802

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299857 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-10 17:18:54 +00:00
Davide Italiano
0caf385833 [ADT] Add a generic breadth-first-search graph iterator.
This will be used in LCSSA to speed up the canonicalization.

Differential Revision:  https://reviews.llvm.org/D31694

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299660 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-06 17:03:04 +00:00
Craig Topper
68149f546e [APInt] Move isMask and isShiftedMask out of APIntOps and into the APInt class. Implement them without memory allocation for multiword
This moves the isMask and isShiftedMask functions to be class methods. They now use the MathExtras.h function for single word size and leading/trailing zeros/ones or countPopulation for the multiword size. The previous implementation made multiple temorary memory allocations to do the bitwise arithmetic operations to match the MathExtras.h implementation.

Differential Revision: https://reviews.llvm.org/D31565




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299362 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-03 16:34:59 +00:00
Craig Topper
6b60db9e91 [APInt] Add a public typedef for the internal type of APInt use it instead of integerPart. Make APINT_BITS_PER_WORD and APINT_WORD_SIZE public.
This patch is one step to attempt to unify the main APInt interface and the tc functions used by APFloat.

This patch adds a WordType to APInt and uses that in all the tc functions. I've added temporary typedefs to APFloat to alias it to integerPart to keep the patch size down. I'll work on removing that in a future patch.

In future patches I hope to reuse the tc functions to implement some of the main APInt functionality.

I may remove APINT_ from BITS_PER_WORD and WORD_SIZE constants so that we don't have the repetitive APInt::APINT_ externally.

Differential Revision: https://reviews.llvm.org/D31523

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299341 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-02 19:17:22 +00:00
Craig Topper
a9c17af0f6 [APInt] Fix bugs in isShiftedMask to match behavior of the similar function in MathExtras.h
This removes a parameter from the routine that was responsible for a lot of the issue. It was a bit count that had to be set to the BitWidth of the APInt and would get passed to getLowBitsSet. This guaranteed the call to getLowBitsSet would create an all ones value. This was then compared to (V | (V-1)). So the only shifted masks we detected had to have the MSB set.

The one in tree user is a transform in InstCombine that never fires due to earlier transforms covering the case better. I've submitted a patch to remove it completely, but for now I've just adapted it to the new interface for isShiftedMask.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299273 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-31 22:23:42 +00:00
Stephen Canon
2215b7d1b2 Fix 80-column violation in previous commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299257 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-31 20:35:02 +00:00
Stephen Canon
872b505b04 Fix APFloat mod (committing for simonbyrne)
The previous version was prone to intermediate rounding or overflow.

Differential Revision: https://reviews.llvm.org/D29346


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299256 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-31 20:31:33 +00:00
Craig Topper
406105d95e [APInt] Rewrite getLoBits in a way that will do one less memory allocation in the multiword case. Rewrite getHiBits to use the class method version of lshr instead of the one in APIntOps. NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299243 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-31 18:48:14 +00:00
Simon Pilgrim
8d28e34276 Spelling mistakes in comments. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299197 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-31 10:59:37 +00:00
Craig Topper
dbf64c9e97 [APInt] Add unittests that demonstrate how very broken APIntOps::isShiftedMask is.
Did you know that 0 is a shifted mask? But 0x0000ff00 and 0x000000ff aren't? At least we get 0xff000000 right.

I only see one usage of this function in the code base today and its in InstCombine. I think its protected against 0 being misreported as a mask. I guess we just don't have tests for the missed cases.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299187 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-31 06:30:25 +00:00
Craig Topper
31355ac435 [APInt] Use memset in setAllBits.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298867 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-27 17:50:54 +00:00
Justin Bogner
acec6edc61 ADT: Add range helpers for pointer_ and pointee_iterator
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298841 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-27 12:56:12 +00:00
Zachary Turner
d10b8de6de Resubmit "Improve StringMap iterator support."
The issue was trying to advance past the end of the iterator
when computing the end() iterator.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298461 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-21 23:45:03 +00:00
Zachary Turner
123d0b8e82 Revert "Improve StringMap iterator support."
This is causing crashes in clang, so reverting until the problem
is figured out.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298440 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-21 21:23:57 +00:00
Zachary Turner
26bdd1d112 Improve StringMap iterator support.
StringMap's iterators did not support LLVM's
iterator_facade_base, which made it unusable in various
STL algorithms or with some of our range adapters.
This patch makes both StringMapConstIterator as well as
StringMapIterator support iterator_facade_base.

With this in place, it is easy to make an iterator adapter
that iterates over only keys, and whose value_type is
StringRef.  So I add StringMapKeyIterator as well, and
provide the method StringMap::keys() that returns a
range that can be iterated.

Differential Revision: https://reviews.llvm.org/D31171

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298436 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-21 20:27:36 +00:00
Zachary Turner
700f6ad142 [ADT] Add a version of llvm::join() that takes a range.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298427 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-21 19:35:05 +00:00
David Blaikie
9812b90e2e Fix sign compare warning in unit test by using an explicit unsigned literal suffix
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297674 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-13 21:46:12 +00:00
Zachary Turner
39e53ee48c [ADT] Improve the genericity of llvm::enumerate().
There were some issues in the implementation of enumerate()
preventing it from being used in various contexts.  These were
all related to the fact that it did not supporter llvm's
iterator_facade_base class.  So this patch adds support for that
and additionally exposes a new helper method to_vector() that
will evaluate an entire range and store the results in a
vector.

Differential Revision: https://reviews.llvm.org/D30853

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297633 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-13 16:24:10 +00:00
Simon Pilgrim
3d7208753c Fix signed/unsigned comparison warnings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297460 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-10 14:16:55 +00:00
Simon Pilgrim
943d3e07f8 [APInt] Add APInt::insertBits() method to insert an APInt into a larger APInt
We currently have to insert bits via a temporary variable of the same size as the target with various shift/mask stages, resulting in further temporary variables, all of which require the allocation of memory for large APInts (MaskSizeInBits > 64).

This is another of the compile time issues identified in PR32037 (see also D30265).

This patch adds the APInt::insertBits() helper method which avoids the temporary memory allocation and masks/inserts the raw bits directly into the target.

Differential Revision: https://reviews.llvm.org/D30780

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297458 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-10 13:44:32 +00:00
Daniel Berlin
5e2cfa2e2d Add support for DenseMap/DenseSet count and find using const pointers
Summary:
Similar to SmallPtrSet, this makes find and count work with both const
referneces and const pointers.

Reviewers: dblaikie

Subscribers: llvm-commits, mzolotukhin

Differential Revision: https://reviews.llvm.org/D30713

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297424 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-10 00:25:26 +00:00
Davide Italiano
96acf92927 [Unittests] Fix a build failure with clang 3.8. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297423 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-09 23:48:58 +00:00
Duncan P. N. Exon Smith
cb8ffd254b ADT: Fix SmallPtrSet iterators in reverse mode
Fix SmallPtrSet::iterator behaviour and creation ReverseIterate is true.

  - Any function that creates an iterator now uses
    SmallPtrSet::makeIterator, which creates an iterator that
    dereferences to the given pointer.

  - In reverse-iterate mode, initialze iterator::End with "CurArray"
    instead of EndPointer.

  - In reverse-iterate mode, the current node is iterator::Buffer[-1].
    iterator::operator* and SmallPtrSet::makeIterator are the only ones
    that need to know.

  - Fix the assertions for reverse-iterate mode.

This fixes the tests Danny B added in r297182, and adds a couple of
others to confirm that dereferencing does the right thing, regardless of
how the iterator was found, and that iteration works correctly from each
return from find.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297234 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-07 21:56:32 +00:00
Simon Pilgrim
6e1685e3b1 Strip trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297225 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-07 21:16:38 +00:00
Daniel Berlin
05382afa99 Add unit tests for changes to SmallPtrSet and PointerLikeTypeTraits
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297182 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-07 18:47:52 +00:00
Craig Topper
fd76e3ca8a [APInt] Add rvalue reference support to and, or, xor operations to allow their memory allocation to be reused when possible
This extends an earlier change that did similar for add and sub operations.

With this first patch we lose the fastpath for the single word case as operator&= and friends don't support it. This can be added there if we think that's important.

I had to change some functions in the APInt class since the operator overloads were moved out of the class and can't be used inside the class now. The getBitsSet change collides with another outstanding patch to implement it with setBits. But I didn't want to make this patch dependent on that series.

I've also removed the Or, And, Xor functions which were rarely or never used. I already commited two changes to remove the only uses of Or that existed.

Differential Revision: https://reviews.llvm.org/D30612

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297121 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-07 05:36:19 +00:00
Craig Topper
be4e5b13c4 [APInt] Fix test names in unittest to match functions being tested. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297115 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-07 03:16:37 +00:00
Craig Topper
a207a85363 [APInt] Add getBitsSetFrom and setBitsFrom to set upper bits starting at a bit
We currently have methods to set a specified number of low bits, a specified number of high bits, or a range of bits. But looking at some existing code it seems sometimes we want to set the high bits starting from a certain bit. Currently we do this with something like getHighBits(BitWidth, BitWidth - StartBit). Or once we start switching to setHighBits, setHighBits(BitWidth - StartBit) or setHighBits(getBitWidth() - StartBit).

Particularly for the latter case it would be better to have a convenience method like setBitsFrom(StartBit) so we don't need to mention the bit width that's already known to the APInt object.

I considered just making setBits have a default value of UINT_MAX for the hiBit argument and we would internally MIN it with the bit width. So if it wasn't specified it would be treated as bit width. This would require removing the assertion we currently have on the value of hiBit and may not be as readable.

Differential Revision: https://reviews.llvm.org/D30602

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297114 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-07 02:58:36 +00:00
Craig Topper
1f41782fb2 [APInt] Implement getLowBitsSet/getHighBitsSet/getBitsSet using setLowBits/setHighBits/setBits
This patch implements getLowBitsSet/getHighBitsSet/getBitsSet in terms of the new setLowBits/setHighBits/setBits methods by making an all 0s APInt and then calling the appropriate set method.

This also adds support to setBits to allow loBits/hiBits to be in the other order to match with getBitsSet behavior.

Differential Revision: https://reviews.llvm.org/D30563

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297112 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-07 02:19:45 +00:00
Craig Topper
73046581a3 [APInt] Add setLowBits/setHighBits methods to APInt.
Summary:
There are quite a few places in the code base that do something like the following to set the high or low bits in an APInt.

KnownZero |= APInt::getHighBitsSet(BitWidth, BitWidth - 1);

For BitWidths larger than 64 this creates a short lived APInt with malloced storage. I think it might even call malloc twice. Its better to just provide methods that can set the necessary bits without the temporary APInt.

I'll update usages that benefit in a separate patch.

Reviewers: majnemer, MatzeB, davide, RKSimon, hans

Reviewed By: hans

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D30525

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297111 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-07 01:56:01 +00:00
Craig Topper
9eb5f1b207 [APInt] Move operator~ out of line to make it better able to reused memory allocation from temporary objects
Summary:
This makes operator~ take the APInt by value so if it came from a temporary APInt the move constructor will get invoked and it will be able to reuse the memory allocation from the temporary.

This is similar to what was already done for 2s complement negation.

Reviewers: hans, davide, RKSimon

Reviewed By: davide

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D30614

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296997 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-06 06:30:47 +00:00