#
fea21397 |
| 22-Jul-2016 |
Pete Cooper <peter_cooper@apple.com> |
Use RValue refs in APInt add/sub methods.
This adds versions of operator + and - which are optimized for the LHS/RHS of the operator being RValue's. When an RValue is available, we can use its stor
Use RValue refs in APInt add/sub methods.
This adds versions of operator + and - which are optimized for the LHS/RHS of the operator being RValue's. When an RValue is available, we can use its storage space instead of allocating new space.
On code such as ConstantRange which makes heavy use of APInt's over 64-bits in size, this results in significant numbers of saved allocations.
Thanks to David Blaikie for all the review and most of the code here.
llvm-svn: 276470
show more ...
|
Revision tags: llvmorg-3.8.1, llvmorg-3.8.1-rc1 |
|
#
d6e6bf18 |
| 26-May-2016 |
Pete Cooper <peter_cooper@apple.com> |
Don't allocate in APInt::slt. NFC.
APInt::slt was copying the LHS and RHS in to temporaries then making them unsigned so that it could use an unsigned comparision. It did this even on the paths wh
Don't allocate in APInt::slt. NFC.
APInt::slt was copying the LHS and RHS in to temporaries then making them unsigned so that it could use an unsigned comparision. It did this even on the paths which were trivial to give results for, such as the sign bit of the LHS being set while RHS was not set.
This changes the logic to return out immediately in the trivial cases, and use an unsigned comparison in the remaining cases. But this time, just use the unsigned comparison directly without creating any temporaries.
This works because, for example: true = (-2 slt -1) = (0xFE ult 0xFF)
Also added some tests explicitly for slt with APInt's larger than 64-bits so that this new code is tested.
Using the memory for 'opt -O2 verify-uselistorder.lto.opt.bc -o opt.bc' (see r236629 for details), this reduces the number of allocations from 26.8M to 23.9M.
llvm-svn: 270881
show more ...
|
#
47b292d3 |
| 16-Apr-2016 |
Mehdi Amini <mehdi.amini@apple.com> |
Remove some unneeded headers and replace some headers with forward class declarations (NFC)
Differential Revision: http://reviews.llvm.org/D19154
Patch by Eugene Kosov <claprix@yandex.ru>
From: Me
Remove some unneeded headers and replace some headers with forward class declarations (NFC)
Differential Revision: http://reviews.llvm.org/D19154
Patch by Eugene Kosov <claprix@yandex.ru>
From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266524
show more ...
|
#
c3943574 |
| 12-Apr-2016 |
Matt Arsenault <Matthew.Arsenault@amd.com> |
APInt: Add overload of isMask
This mimics the version in MathExtras.h which isn't testing for a specific mask size.
llvm-svn: 266101
|
#
155dda91 |
| 21-Mar-2016 |
Matt Arsenault <Matthew.Arsenault@amd.com> |
Implement constant folding for bitreverse
llvm-svn: 263945
|
Revision tags: llvmorg-3.8.0, llvmorg-3.8.0-rc3, llvmorg-3.8.0-rc2, llvmorg-3.8.0-rc1, llvmorg-3.7.1, llvmorg-3.7.1-rc2, llvmorg-3.7.1-rc1 |
|
#
55f5e657 |
| 04-Sep-2015 |
Richard Smith <richard-llvm@metafoo.co.uk> |
Fix APInt value initialization to give a zero value as any sane integer type should, rather than giving a broken value that doesn't even zero/sign-extend properly.
llvm-svn: 246836
|
Revision tags: llvmorg-3.7.0, llvmorg-3.7.0-rc4, llvmorg-3.7.0-rc3, studio-1.4, llvmorg-3.7.0-rc2, llvmorg-3.7.0-rc1 |
|
#
ea46a66e |
| 01-Jul-2015 |
Pawel Bylica <chfast@gmail.com> |
Change APInt comparison with uint64_t.
Summary: This patch changes the way APInt is compared with a value of type uint64_t. Before the uint64_t value was truncated to the size of APInt before compar
Change APInt comparison with uint64_t.
Summary: This patch changes the way APInt is compared with a value of type uint64_t. Before the uint64_t value was truncated to the size of APInt before comparison. Now the comparison takes into account full 64-bit precision.
Test Plan: Unit tests added. No regressions. Self-hosted check-all done as well.
Reviewers: chandlerc, dexonsmith
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D10655
llvm-svn: 241204
show more ...
|
#
0dda1646 |
| 25-Jun-2015 |
Pawel Bylica <chfast@gmail.com> |
Add missing <array> include.
llvm-svn: 240629
|
#
8bebed98 |
| 25-Jun-2015 |
Pawel Bylica <chfast@gmail.com> |
Express APInt::{s,u}{l,g}e(uint64_t) in terms of APInt::{s,u}{l,g}t(uint64_t). NFC.
This is preparation for http://reviews.llvm.org/D10655: Change APInt comparison with uint64_t. Some unit tests add
Express APInt::{s,u}{l,g}e(uint64_t) in terms of APInt::{s,u}{l,g}t(uint64_t). NFC.
This is preparation for http://reviews.llvm.org/D10655: Change APInt comparison with uint64_t. Some unit tests added also.
llvm-svn: 240626
show more ...
|
Revision tags: llvmorg-3.6.2, llvmorg-3.6.2-rc1 |
|
#
886461e2 |
| 04-Jun-2015 |
Benjamin Kramer <benny.kra@googlemail.com> |
[APInt] Remove special case for i1.
Add a unit test.
llvm-svn: 239062
|
Revision tags: llvmorg-3.6.1, llvmorg-3.6.1-rc1 |
|
#
86ac4474 |
| 24-Apr-2015 |
Pawel Bylica <chfast@gmail.com> |
Fix APInt long division algorithm
Summary: This patch fixes step D4 of Knuth's division algorithm implementation. Negative sign of the step result was not always detected due to incorrect "borrow" h
Fix APInt long division algorithm
Summary: This patch fixes step D4 of Knuth's division algorithm implementation. Negative sign of the step result was not always detected due to incorrect "borrow" handling.
Test Plan: Unit test that reveals the bug included.
Reviewers: chandlerc, yaron.keren
Reviewed By: yaron.keren
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D9196
llvm-svn: 235699
show more ...
|
#
61ad9d84 |
| 22-Apr-2015 |
Yaron Keren <yaron.keren@gmail.com> |
Another test to exercise APInt divide step D6.
This is divrem_big7 since divrem_big6 is used in Pawel upcoming patch.
llvm-svn: 235536
|
#
39fc5a6f |
| 26-Mar-2015 |
Yaron Keren <yaron.keren@gmail.com> |
Fix rare case where APInt divide algorithm applied un-needed transformation.
APInt uses Knuth's D algorithm for long division. In rare cases the implementation applied a transformation that was not
Fix rare case where APInt divide algorithm applied un-needed transformation.
APInt uses Knuth's D algorithm for long division. In rare cases the implementation applied a transformation that was not needed.
Added unit tests for long division. KnuthDiv() procedure is fully covered. There is a case in APInt::divide() that I believe is never used (marked with a comment) as all users of divide() handle trivial cases earlier.
Patch by Pawel Bylica!
http://reviews.llvm.org/D8448
llvm-svn: 233312
show more ...
|
#
b4b5150d |
| 25-Mar-2015 |
Benjamin Kramer <benny.kra@googlemail.com> |
[APInt] Add an isSplat helper and use it in some places.
To complement getSplat. This is more general than the binary decomposition method as it also handles non-pow2 splat sizes.
llvm-svn: 233195
|
Revision tags: llvmorg-3.5.2, llvmorg-3.5.2-rc1, llvmorg-3.6.0, llvmorg-3.6.0-rc4, llvmorg-3.6.0-rc3, llvmorg-3.6.0-rc2, llvmorg-3.6.0-rc1 |
|
#
a64949df |
| 14-Jan-2015 |
Richard Trieu <rtrieu@google.com> |
Disable -Wunknown-pragmas in a test so that Clang without -Wself-move will not complain that the flag doesn't exist.
llvm-svn: 225931
|
#
8bd98977 |
| 13-Jan-2015 |
Aaron Ballman <aaron@aaronballman.com> |
Silence warnings about unknown pragmas for compilers that are not Clang. NFC.
llvm-svn: 225788
|
#
5dc76a5d |
| 13-Jan-2015 |
Richard Trieu <rtrieu@google.com> |
Disable a warning for self move since the test is checking for this behavior.
llvm-svn: 225754
|
Revision tags: llvmorg-3.5.1, llvmorg-3.5.1-rc2, llvmorg-3.5.1-rc1, llvmorg-3.5.0, llvmorg-3.5.0-rc4 |
|
#
e1d12948 |
| 27-Aug-2014 |
Craig Topper <craig.topper@gmail.com> |
Simplify creation of a bunch of ArrayRefs by using None, makeArrayRef or just letting them be implicitly created.
llvm-svn: 216525
|
Revision tags: llvmorg-3.5.0-rc3 |
|
#
1508a652 |
| 12-Aug-2014 |
David Blaikie <dblaikie@gmail.com> |
Fix -Wsign-compare warnings
llvm-svn: 215483
|
#
3d4eae74 |
| 12-Aug-2014 |
Reid Kleckner <reid@kleckner.net> |
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
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
show more ...
|
Revision tags: llvmorg-3.5.0-rc2, llvmorg-3.5.0-rc1, llvmorg-3.4.2, llvmorg-3.4.2-rc1, llvmorg-3.4.1, llvmorg-3.4.1-rc2, llvmorg-3.4.1-rc1 |
|
#
c47069b1 |
| 31-Jan-2014 |
Duncan P. N. Exon Smith <dexonsmith@apple.com> |
Clean up whitespace
llvm-svn: 200579
|
#
84fcbdea |
| 19-Jan-2014 |
Michael Gottesman <mgottesman@apple.com> |
[APInt] Fix nearestLogBase2 to return correct answers for very large APInt and APInt with a bitwidth of 1.
I also improved the comments, added some more tests, etc.
llvm-svn: 199610
|
#
073af74e |
| 19-Jan-2014 |
Michael Gottesman <mgottesman@apple.com> |
[APInt] Fixed bug where APInt(UINT32_MAX, 0) would blow up when being constructed.
This was due to arithmetic overflow in the getNumBits() computation. Now we cast BitWidth to a uint64_t so that doe
[APInt] Fixed bug where APInt(UINT32_MAX, 0) would blow up when being constructed.
This was due to arithmetic overflow in the getNumBits() computation. Now we cast BitWidth to a uint64_t so that does not occur during the computation. After the computation is complete, the uint64_t is truncated when the function returns.
I know that this is not something that is likely to happen, but it *IS* a valid input and we should not blow up.
llvm-svn: 199609
show more ...
|
Revision tags: llvmorg-3.4.0, llvmorg-3.4.0-rc3 |
|
#
e1fad2b5 |
| 13-Dec-2013 |
Michael Gottesman <mgottesman@apple.com> |
Remove APInt::extractBit since it is already implemented via operator[]. Change tests for extractBit to test operator[].
llvm-svn: 197277
|
#
f6d58ff5 |
| 13-Dec-2013 |
Michael Gottesman <mgottesman@apple.com> |
[block-freq] Add the method APInt::nearestLogBase2().
llvm-svn: 197272
|