summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Support/ConstantRangeTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [Modules] Move the ConstantRange class into the IR library. This isChandler Carruth2014-03-041-512/+0
| | | | | | | | | | a bit surprising, as the class is almost entirely abstracted away from any particular IR, however it encodes the comparsion predicates which mutate ranges as ICmp predicate codes. This is reasonable as they're used for both instructions and constants. Thus, it belongs in the IR library with instructions and constants. llvm-svn: 202838
* make ConstantRange::signExtend() optimalNuno Lopes2013-10-301-0/+3
| | | | | | the case [x, INT_MIN) was not handled optimally llvm-svn: 193694
* Move all of the header files which are involved in modelling the LLVM IRChandler Carruth2013-01-021-1/+1
| | | | | | | | | | | | | | | | | | | | | into their new header subdirectory: include/llvm/IR. This matches the directory structure of lib, and begins to correct a long standing point of file layout clutter in LLVM. There are still more header files to move here, but I wanted to handle them in separate commits to make tracking what files make sense at each layer easier. The only really questionable files here are the target intrinsic tablegen files. But that's a battle I'd rather not fight today. I've updated both CMake and Makefile build systems (I think, and my tests think, but I may have missed something). I've also re-sorted the includes throughout the project. I'll be committing updates to Clang, DragonEgg, and Polly momentarily. llvm-svn: 171366
* Sort the #include lines for unittest/...Chandler Carruth2012-12-041-1/+0
| | | | llvm-svn: 169250
* make ConstantRange::zeroExtend() optimalNuno Lopes2012-07-231-0/+4
| | | | llvm-svn: 160643
* teach ConstantRange that zero times X is always zeroNuno Lopes2012-07-161-0/+8
| | | | llvm-svn: 160317
* make ConstantRange::getSetSize() properly compute the size of wrapped and ↵Nuno Lopes2012-07-161-5/+9
| | | | | | | | full sets. Make it always return APInts with the same bitwidth for the same ConstantRange bitwidth to simply clients llvm-svn: 160294
* add ConstantRange::difference (to perform set difference/relative complement)Nuno Lopes2012-06-281-0/+17
| | | | llvm-svn: 159352
* fix a off-by-one bug in intersectWith(), and add a bunch of testsNuno Lopes2012-06-281-2/+32
| | | | llvm-svn: 159319
* fix corner case in ConstantRange::intersectWith().Nuno Lopes2012-05-181-0/+5
| | | | | | this fixes the missed optimization I was seeing in the CorrelatedValuePropagation pass llvm-svn: 157032
* Fix the implementation of ConstantRange::sub(ConstantRange). Patch by Xi Wang!Nick Lewycky2011-06-221-0/+2
| | | | llvm-svn: 133648
* PR5207: Change APInt methods trunc(), sext(), zext(), sextOrTrunc() andJay Foad2010-12-071-10/+10
| | | | | | | | zextOrTrunc(), and APSInt methods extend(), extOrTrunc() and new method trunc(), to be const and to return a new value instead of modifying the object in place. llvm-svn: 121120
* Make ConstantRange::makeICmpRegion handle all the edge cases properly. ThisNick Lewycky2010-09-281-0/+8
| | | | | | also fixes PR8250. llvm-svn: 114972
* Add a new isSignWrappedSet() method to ConstantRange.Nick Lewycky2010-09-061-4/+22
| | | | | | | | | Fix zeroExtend and signExtend to support empty sets, and to return the smallest possible result set which contains the extension of each element in their inputs. For example zext i8 [100, 10) to i16 is now [0, 256), not i16 [100, 10) which contains 63446 members. llvm-svn: 113187
* Clean up ConstantRange a bit:Nick Lewycky2010-08-111-3/+63
| | | | | | | | | - remove ashr which never worked. - fix lshr and shl and add tests. - remove dead function "intersect1Wrapped". - add a new sub method to subtract ranges, with test. llvm-svn: 110861
* Add an inverse() method to ConstantRange.Owen Anderson2010-08-071-0/+3
| | | | llvm-svn: 110504
* Simplify, now that gtest supports raw_ostream directly.Daniel Dunbar2009-09-061-1/+0
| | | | llvm-svn: 81102
* Now that googletest can print ConstantRange, use EXPECT_EQ when testing forNick Lewycky2009-09-051-149/+149
| | | | | | | equality. Prefer EXPECT_EQ(foo, Full) over EXPECT_TRUE(foo.isFullSet()) because the former will print out the contents of the constant range that failed. llvm-svn: 81094
* Teach googletest to use raw_ostream instead of just std::ostream.Jeffrey Yasskin2009-09-051-7/+0
| | | | | | | | This can break when there are implicit conversions from types raw_ostream understands but std::ostream doesn't, but it increases the number of cases that Just Work. llvm-svn: 81093
* split raw_os_ostream out to its own header and implementation file. ThisChris Lattner2009-08-241-1/+1
| | | | | | | means that raw_ostream no longer has to #include <iosfwd>. Nothing in llvm should use raw_os_ostream.h, but llvm-gcc and some unit tests do. llvm-svn: 79886
* Unbreak unit tests.Daniel Dunbar2009-08-241-0/+7
| | | | llvm-svn: 79879
* convert all the constant range EXPECT_EQ tests to use EXPECT_TRUE since Chris Lattner2009-08-231-128/+129
| | | | | | ConstantRange doesn't have an std::ostream inserter anymore. llvm-svn: 79831
* cast signed APInt constructor params to uint64_t to suppress signedness warningRyan Flynn2009-07-221-5/+5
| | | | llvm-svn: 76744
* Fix ConstantRange::unionWith. Also make it work a little hard in some cases toNick Lewycky2009-07-191-0/+11
| | | | | | | return the smallest union of two ranges instead of just any range that happens to contain the union. llvm-svn: 76360
* Replace intersectWith with maximalIntersectWith. The latter guarantees thatNick Lewycky2009-07-181-15/+6
| | | | | | | | all values belonging to the intersection will belong to the resulting range. The former was inconsistent about that point (either way is fine, just pick one.) This is part of PR4545. llvm-svn: 76289
* Fix an error in ConstantRange::getSignedMax on wrapped ranges. Thanks onceNick Lewycky2009-07-131-0/+4
| | | | | | again to Daniel Dunbar and KLEE! llvm-svn: 75449
* 'i8 full-range' sign extended to i16 should equal [-128, 128) not [-128, 127).Nick Lewycky2009-07-131-1/+1
| | | | | | Found by Daniel Dunbar and KLEE. llvm-svn: 75448
* Multiply was very wrong for wrapped ranges. This supplies a half-fix that willNick Lewycky2009-07-131-0/+5
| | | | | | generally return Full on all wrapped inputs. "Fixes" PR4545. llvm-svn: 75444
* Fix a bug summing two full sets. The overflow checking doesn't handle sets asNick Lewycky2009-07-131-0/+1
| | | | | | | large as the full set, only those one size smaller. Thanks to Daniel Dunbar who found this bug using Klee! llvm-svn: 75443
* Implement udiv for ConstantRanges.Nick Lewycky2009-07-121-13/+9
| | | | llvm-svn: 75413
* This is not overly conservative.Nick Lewycky2009-07-121-1/+0
| | | | | | | Some = [10, 2730). A subset of that is [1024..2048) which covers every possible 10-bit pattern. llvm-svn: 75411
* Implement ConstantRange::multiply based on the code in LoopVR.Nick Lewycky2009-07-121-10/+6
| | | | llvm-svn: 75410
* Fix handling of max and full set.Nick Lewycky2009-07-111-7/+8
| | | | | | | | A full set is a constant range that represents any number. If you take the umax of that and [5, 10) you end up with [5, INT_MAX] because the values less than 5 would be umax's against a value which is at least 5. llvm-svn: 75372
* Break the world's largest unit test down a few logical lines. No semanticNick Lewycky2009-07-111-23/+65
| | | | | | changes. llvm-svn: 75369
* Revert the part of 75177 that split ConstantRange into two classes, andDan Gohman2009-07-091-298/+21
| | | | | | | | merge the new functionality and unittests into ConstantRange. Thanks to Nick Lewycky for pointing out that it isn't necessary to have two separate classes here. llvm-svn: 75191
* Add a ConstantSignedRange class, which does for signed integersDan Gohman2009-07-091-0/+582
what ConstantRange does for unsigned integers. Factor out a common base class for common functionality. Add some new functions for performing arithmetic on constant ranges. Some of these are currently just stubbed out with conservative implementations. Add unittests for ConstantRange and ConstantSignedRange. llvm-svn: 75177
OpenPOWER on IntegriCloud