summaryrefslogtreecommitdiff
path: root/lib/Support/ConstantRange.cpp
Commit message (Collapse)AuthorAge
* [ConstantRange] improve my previous patch per Nick suggestionNuno Lopes2013-10-31
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193795 91177308-0d34-0410-b5e6-96231b3b80d8
* make ConstantRange::signExtend() optimalNuno Lopes2013-10-30
| | | | | | the case [x, INT_MIN) was not handled optimally git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193694 91177308-0d34-0410-b5e6-96231b3b80d8
* simplify ConstantRange::getSetSize()Nuno Lopes2013-10-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193523 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't use a potentially expensive shift if all we want is one set bit.Benjamin Kramer2013-07-11
| | | | | | No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186095 91177308-0d34-0410-b5e6-96231b3b80d8
* Use move semantics if possible to construct ConstantRanges.Benjamin Kramer2013-07-11
| | | | | | | Arithmetic on ConstantRanges creates a lot of large temporary APInts that benefit from move semantics. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186091 91177308-0d34-0410-b5e6-96231b3b80d8
* Move all of the header files which are involved in modelling the LLVM IRChandler Carruth2013-01-02
| | | | | | | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171366 91177308-0d34-0410-b5e6-96231b3b80d8
* make ConstantRange::zeroExtend() optimalNuno Lopes2012-07-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160643 91177308-0d34-0410-b5e6-96231b3b80d8
* reimplement truncate() to make it optimal.Nuno Lopes2012-07-19
| | | | | | | | It is optimal at least up to 7 bits (I've tested all such cases) This change to truncate() allows a little simplification to the multiplication code, and it also makes multiplication optimal :) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160512 91177308-0d34-0410-b5e6-96231b3b80d8
* simplify getSetSize() per Duncan's commentsNuno Lopes2012-07-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160368 91177308-0d34-0410-b5e6-96231b3b80d8
* teach ConstantRange that zero times X is always zeroNuno Lopes2012-07-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160317 91177308-0d34-0410-b5e6-96231b3b80d8
* make ConstantRange::getSetSize() properly compute the size of wrapped and ↵Nuno Lopes2012-07-16
| | | | | | | | full sets. Make it always return APInts with the same bitwidth for the same ConstantRange bitwidth to simply clients git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160294 91177308-0d34-0410-b5e6-96231b3b80d8
* add ConstantRange::difference (to perform set difference/relative complement)Nuno Lopes2012-06-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159352 91177308-0d34-0410-b5e6-96231b3b80d8
* fix a off-by-one bug in intersectWith(), and add a bunch of testsNuno Lopes2012-06-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159319 91177308-0d34-0410-b5e6-96231b3b80d8
* fix corner case in ConstantRange::intersectWith().Nuno Lopes2012-05-18
| | | | | | this fixes the missed optimization I was seeing in the CorrelatedValuePropagation pass git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157032 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert assert(0) to llvm_unreachableCraig Topper2012-02-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149967 91177308-0d34-0410-b5e6-96231b3b80d8
* Conform to the style guide; remove 'else' after 'return'. Also remove an extraNick Lewycky2012-01-03
| | | | | | | if-statement by turning it into an assert. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147474 91177308-0d34-0410-b5e6-96231b3b80d8
* Make ConstantRange::truncate a bit more efficient.Benjamin Kramer2011-11-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145122 91177308-0d34-0410-b5e6-96231b3b80d8
* Change:Richard Trieu2011-09-21
| | | | | | | | | | | | | assert(!"error message"); To: assert(0 && "error message"); which is more consistant across the code base. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140234 91177308-0d34-0410-b5e6-96231b3b80d8
* Trim includes.Frits van Bommel2011-07-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136218 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix the implementation of ConstantRange::sub(ConstantRange). Patch by Xi Wang!Nick Lewycky2011-06-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133648 91177308-0d34-0410-b5e6-96231b3b80d8
* PR5207: Change APInt methods trunc(), sext(), zext(), sextOrTrunc() andJay Foad2010-12-07
| | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121120 91177308-0d34-0410-b5e6-96231b3b80d8
* Make ConstantRange::makeICmpRegion handle all the edge cases properly. ThisNick Lewycky2010-09-28
| | | | | | | also fixes PR8250. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114972 91177308-0d34-0410-b5e6-96231b3b80d8
* Add completely hokey binary-and and binary-or operations to ConstantRange andNick Lewycky2010-09-07
| | | | | | | teach LazyValueInfo to use them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113196 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a new isSignWrappedSet() method to ConstantRange.Nick Lewycky2010-09-06
| | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113187 91177308-0d34-0410-b5e6-96231b3b80d8
* Clean up ConstantRange a bit:Nick Lewycky2010-08-11
| | | | | | | | | | - 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110861 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove layering violation.Owen Anderson2010-08-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110505 91177308-0d34-0410-b5e6-96231b3b80d8
* Add an inverse() method to ConstantRange.Owen Anderson2010-08-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110504 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a convenience constructor.Owen Anderson2010-08-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110493 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a typo that several people pointed out. Also, address the case ofDan Gohman2010-01-26
| | | | | | | wrapping that Duncan pointed out. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94547 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a comment about a missed opportunity.Dan Gohman2010-01-26
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94507 91177308-0d34-0410-b5e6-96231b3b80d8
* Print empty and full sets specially.Dan Gohman2010-01-26
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94506 91177308-0d34-0410-b5e6-96231b3b80d8
* Change errs() to dbgs().David Greene2010-01-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92638 91177308-0d34-0410-b5e6-96231b3b80d8
* fix crash in my previous patchNuno Lopes2009-11-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86987 91177308-0d34-0410-b5e6-96231b3b80d8
* implement shl, ashr, and lshr methods. shl is not fully implemented as it is ↵Nuno Lopes2009-11-12
| | | | | | quite tricky. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86986 91177308-0d34-0410-b5e6-96231b3b80d8
* add zextOrTrunc and sextOrTrunc methods, that are similar to the ones in APIntNuno Lopes2009-11-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86549 91177308-0d34-0410-b5e6-96231b3b80d8
* Change Pass::print to take a raw ostream instead of std::ostream,Chris Lattner2009-08-23
| | | | | | | update all code that this affects. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79830 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix ConstantRange::unionWith. Also make it work a little hard in some cases toNick Lewycky2009-07-19
| | | | | | | | return the smallest union of two ranges instead of just any range that happens to contain the union. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76360 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace intersectWith with maximalIntersectWith. The latter guarantees thatNick Lewycky2009-07-18
| | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76289 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix an error in ConstantRange::getSignedMax on wrapped ranges. Thanks onceNick Lewycky2009-07-13
| | | | | | | again to Daniel Dunbar and KLEE! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75449 91177308-0d34-0410-b5e6-96231b3b80d8
* 'i8 full-range' sign extended to i16 should equal [-128, 128) not [-128, 127).Nick Lewycky2009-07-13
| | | | | | | Found by Daniel Dunbar and KLEE. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75448 91177308-0d34-0410-b5e6-96231b3b80d8
* Multiply was very wrong for wrapped ranges. This supplies a half-fix that willNick Lewycky2009-07-13
| | | | | | | generally return Full on all wrapped inputs. "Fixes" PR4545. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75444 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a bug summing two full sets. The overflow checking doesn't handle sets asNick Lewycky2009-07-13
| | | | | | | | | large as the full set, only those one size smaller. Thanks to Daniel Dunbar who found this bug using Klee! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75443 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement udiv for ConstantRanges.Nick Lewycky2009-07-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75413 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement ConstantRange::multiply based on the code in LoopVR.Nick Lewycky2009-07-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75410 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix handling of max and full set.Nick Lewycky2009-07-11
| | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75372 91177308-0d34-0410-b5e6-96231b3b80d8
* Clarify and simplify.Nick Lewycky2009-07-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75366 91177308-0d34-0410-b5e6-96231b3b80d8
* Move a method that creates constant ranges relative to another constant rangeNick Lewycky2009-07-11
| | | | | | | | | | | per icmp predicate out of predsimplify and into ConstantRange. Add another utility method that determines whether one range is a subset of another. Combine with the former to determine whether icmp pred range, range is known to be true or not. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75357 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert the part of 75177 that split ConstantRange into two classes, andDan Gohman2009-07-09
| | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75191 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a ConstantSignedRange class, which does for signed integersDan Gohman2009-07-09
| | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75177 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch the asmprinter (.ll) and all the stuff it requires over toChris Lattner2008-08-23
| | | | | | | | | | | | | | | | | | | | | | | | | | use raw_ostream instead of std::ostream. Among other goodness, this speeds up llvm-dis of kc++ with a release build from 0.85s to 0.49s (88% faster). Other interesting changes: 1) This makes Value::print be non-virtual. 2) AP[S]Int and ConstantRange can no longer print to ostream directly, use raw_ostream instead. 3) This fixes a bug in raw_os_ostream where it didn't flush itself when destroyed. 4) This adds a new SDNode::print method, instead of only allowing "dump". A lot of APIs have both std::ostream and raw_ostream versions, it would be useful to go through and systematically anihilate the std::ostream versions. This passes dejagnu, but there may be minor fallout, plz let me know if so and I'll fix it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55263 91177308-0d34-0410-b5e6-96231b3b80d8