summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Support/ScaledNumberTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Replace llvm::isPodLike<...> by llvm::is_trivially_copyable<...>Serge Guelton2019-01-201-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As noted in https://bugs.llvm.org/show_bug.cgi?id=36651, the specialization for isPodLike<std::pair<...>> did not match the expectation of std::is_trivially_copyable which makes the memcpy optimization invalid. This patch renames the llvm::isPodLike trait into llvm::is_trivially_copyable. Unfortunately std::is_trivially_copyable is not portable across compiler / STL versions. So a portable version is provided too. Note that the following specialization were invalid: std::pair<T0, T1> llvm::Optional<T> Tests have been added to assert that former specialization are respected by the standard usage of llvm::is_trivially_copyable, and that when a decent version of std::is_trivially_copyable is available, llvm::is_trivially_copyable is compared to std::is_trivially_copyable. As of this patch, llvm::Optional is no longer considered trivially copyable, even if T is. This is to be fixed in a later patch, as it has impact on a long-running bug (see r347004) Note that GCC warns about this UB, but this got silented by https://reviews.llvm.org/D50296. Differential Revision: https://reviews.llvm.org/D54472 llvm-svn: 351701
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Cosmetic. Added braces to address gcc warning: suggest explicit braces to ↵Galina Kistanova2017-05-201-2/+4
| | | | | | avoid ambiguous 'else' [-Wdangling-else]. llvm-svn: 303471
* Fix infinite recursion in ScaledNumber::toInt.Diego Novillo2015-05-011-0/+5
| | | | | | | | | Patch from dexonsmith. The call to toInt() was calling compareTo() which in some cases would call back to toInt(), creating an infinite loop. Fixed by simplifying the logic in compareTo() to avoid the co-recursion. llvm-svn: 236326
* Fix private constructor for ScaledNumber.Diego Novillo2015-04-301-0/+24
| | | | | | | | | | | | | | | | | | | | | | | Summary: The private constructor for ScaledNumber was using uint64_t instead of DigitsT. This was preventing instantiations of ScaledNumber with anything other than uint64_t types. In implementing the tests, I ran into another issue. Operators >>= and <<= did not have variants for accepting other ScaledNumber as the shift argument. This is expected by the SCALED_NUMBER_BOP. It makes no sense to allow shifting a ScaledNumber by another ScaledNumber, so the patch includes two new templates for shifting ScaledNumbers. Reviewers: dexonsmith Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D9350 llvm-svn: 236232
* Fix typo in comment. NFC.Diego Novillo2015-04-301-1/+1
| | | | llvm-svn: 236227
* [cleanup] Re-sort all the #include lines in LLVM usingChandler Carruth2015-01-141-1/+0
| | | | | | | | | | | utils/sort_includes.py. I clearly haven't done this in a while, so more changed than usual. This even uncovered a missing include from the InstrProf library that I've added. No functionality changed here, just mechanical cleanup of the include order. llvm-svn: 225974
* Remove unused typedef. GCC warns about this.Benjamin Kramer2014-07-011-3/+0
| | | | llvm-svn: 212105
* Support: Return ScaledNumbers::MaxScale from getQuotient()Duncan P. N. Exon Smith2014-06-241-4/+4
| | | | | | Return MaxScale now that it's available. llvm-svn: 211559
* Support: Extract ScaledNumbers::getSum() and getDifference()Duncan P. N. Exon Smith2014-06-231-0/+150
| | | | llvm-svn: 211553
* Support: Return scale from ScaledNumbers::matchScales()Duncan P. N. Exon Smith2014-06-231-1/+1
| | | | | | This will be convenient when extracting `ScaledNumbers::getSum()`. llvm-svn: 211552
* Support: Extract ScaledNumbers::matchScale()Duncan P. N. Exon Smith2014-06-231-0/+64
| | | | llvm-svn: 211531
* Cleanup r211507Duncan P. N. Exon Smith2014-06-231-1/+1
| | | | llvm-svn: 211521
* Support: Extract ScaledNumbers::compare()Duncan P. N. Exon Smith2014-06-231-0/+37
| | | | llvm-svn: 211507
* Support: ScaledNumber: Fix inconsistent test namesDuncan P. N. Exon Smith2014-06-201-6/+6
| | | | llvm-svn: 211414
* Support: Write ScaledNumbers::getLg{,Floor,Ceiling}()Duncan P. N. Exon Smith2014-06-201-0/+94
| | | | llvm-svn: 211413
* Support: Write ScaledNumber::getQuotient() and getProduct()Duncan P. N. Exon Smith2014-06-201-0/+112
| | | | llvm-svn: 211409
* Support: Mark end of namespacesDuncan P. N. Exon Smith2014-06-201-1/+2
| | | | | | This convinces clang-format to leave a newline. llvm-svn: 211406
* Support: Clean up getRounded() testsDuncan P. N. Exon Smith2014-06-201-14/+12
| | | | llvm-svn: 211337
* Support: Write ScaledNumbers::getAdjusted()Duncan P. N. Exon Smith2014-06-201-0/+23
| | | | llvm-svn: 211336
* Support: Write ScaledNumbers::getRounded()Duncan P. N. Exon Smith2014-06-201-0/+60
Start extracting helper functions out of -block-freq's `UnsignedFloat` into `Support/ScaledNumber.h` with the eventual goal of moving and renaming the class to `ScaledNumber`. The bike shed about names is still being painted, but I'm going with this for now. llvm-svn: 211333
OpenPOWER on IntegriCloud