summaryrefslogtreecommitdiff
path: root/lib/Support/ConstantRange.cpp
Commit message (Collapse)AuthorAge
* 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
* Rework the routines that convert AP[S]Int into a string. Now, instead ofChris Lattner2008-08-17
| | | | | | | | | | | | | | | | | | | returning an std::string by value, it fills in a SmallString/SmallVector passed in. This significantly reduces string thrashing in some cases. More specifically, this: - Adds an operator<< and a print method for APInt that allows you to directly send them to an ostream. - Reimplements APInt::toString to be much simpler and more efficient algorithmically in addition to not thrashing strings quite as much. This speeds up llvm-dis on kc++ by 7%, and may also slightly speed up the asmprinter. This also fixes a bug I introduced into the asmwriter in a previous patch w.r.t. alias printing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54873 91177308-0d34-0410-b5e6-96231b3b80d8
* Tidy up whitespace in ConstantRange::print output.Dan Gohman2008-05-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51606 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove attribution from file headers, per discussion on llvmdev.Chris Lattner2007-12-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45418 91177308-0d34-0410-b5e6-96231b3b80d8
* Clarify the language. Pointed out by Duncan Sands.Nick Lewycky2007-07-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39857 91177308-0d34-0410-b5e6-96231b3b80d8
* Add alternate ConstantRange intersection algorithm.Nick Lewycky2007-07-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39851 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix edge case.Nick Lewycky2007-06-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37532 91177308-0d34-0410-b5e6-96231b3b80d8
* Using APInt more efficiently.Zhou Sheng2007-04-26
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36475 91177308-0d34-0410-b5e6-96231b3b80d8
* Make the apint construction more effective.Zhou Sheng2007-04-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35960 91177308-0d34-0410-b5e6-96231b3b80d8
* Add signExtend to ConstantRange, to complement zeroExtend and truncate.Nick Lewycky2007-04-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35733 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement union of wrapped sets.Nick Lewycky2007-04-01
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35534 91177308-0d34-0410-b5e6-96231b3b80d8
* Add getter methods for the extremes of a ConstantRange.Nick Lewycky2007-03-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35056 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement unionWith.Nick Lewycky2007-03-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34833 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove the "isSigned" parameters from ConstantRange. It turns out theyReid Spencer2007-03-01
| | | | | | | | | are not needed as the results are the same with or without it. Patch by Nicholas Lewycky. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34782 91177308-0d34-0410-b5e6-96231b3b80d8
* Move ConstantRange class to lib/Support from lib/Analysis and make itsReid Spencer2007-02-28
| | | | | | | interface not depend on Type or ICmpInst. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34761 91177308-0d34-0410-b5e6-96231b3b80d8
* For PR1205:Reid Spencer2007-02-28
| | | | | | | | Remove ConstantInt from ConstantRange interface and adjust its users to compensate. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34758 91177308-0d34-0410-b5e6-96231b3b80d8
* For PR1205:Reid Spencer2007-02-28
| | | | | | | | First round of ConstantRange changes. This makes all CR constructors use only APInt and not use ConstantInt. Clients are adjusted accordingly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34756 91177308-0d34-0410-b5e6-96231b3b80d8
* For PR1205:Reid Spencer2007-02-28
| | | | | | | | Convert ConstantRange class to use APInt internally as its value type for the constant range, instead of ConstantInt. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34745 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix comments to match names of functions.Nick Lewycky2007-02-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34173 91177308-0d34-0410-b5e6-96231b3b80d8