summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/ConstantRange.cpp
Commit message (Collapse)AuthorAgeFilesLines
* PR5207: Change APInt methods trunc(), sext(), zext(), sextOrTrunc() andJay Foad2010-12-071-9/+3
| | | | | | | | 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-10/+28
| | | | | | also fixes PR8250. llvm-svn: 114972
* Add completely hokey binary-and and binary-or operations to ConstantRange andNick Lewycky2010-09-071-0/+26
| | | | | | teach LazyValueInfo to use them. llvm-svn: 113196
* Add a new isSignWrappedSet() method to ConstantRange.Nick Lewycky2010-09-061-3/+15
| | | | | | | | | 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-78/+46
| | | | | | | | | - 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
* Remove layering violation.Owen Anderson2010-08-071-2/+0
| | | | llvm-svn: 110505
* Add an inverse() method to ConstantRange.Owen Anderson2010-08-071-0/+11
| | | | llvm-svn: 110504
* Add a convenience constructor.Owen Anderson2010-08-071-0/+3
| | | | llvm-svn: 110493
* Fix a typo that several people pointed out. Also, address the case ofDan Gohman2010-01-261-2/+4
| | | | | | wrapping that Duncan pointed out. llvm-svn: 94547
* Add a comment about a missed opportunity.Dan Gohman2010-01-261-0/+3
| | | | llvm-svn: 94507
* Print empty and full sets specially.Dan Gohman2010-01-261-1/+6
| | | | llvm-svn: 94506
* Change errs() to dbgs().David Greene2010-01-051-1/+2
| | | | llvm-svn: 92638
* fix crash in my previous patchNuno Lopes2009-11-121-1/+1
| | | | llvm-svn: 86987
* implement shl, ashr, and lshr methods. shl is not fully implemented as it is ↵Nuno Lopes2009-11-121-0/+37
| | | | | | quite tricky. llvm-svn: 86986
* add zextOrTrunc and sextOrTrunc methods, that are similar to the ones in APIntNuno Lopes2009-11-091-0/+24
| | | | llvm-svn: 86549
* Change Pass::print to take a raw ostream instead of std::ostream,Chris Lattner2009-08-231-6/+1
| | | | | | update all code that this affects. llvm-svn: 79830
* Fix ConstantRange::unionWith. Also make it work a little hard in some cases toNick Lewycky2009-07-191-45/+50
| | | | | | | 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-43/+5
| | | | | | | | 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-7/+3
| | | | | | 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-6/+6
| | | | | | 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/+2
| | | | | | | 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-4/+26
| | | | llvm-svn: 75413
* Implement ConstantRange::multiply based on the code in LoopVR.Nick Lewycky2009-07-121-3/+13
| | | | llvm-svn: 75410
* Fix handling of max and full set.Nick Lewycky2009-07-111-4/+0
| | | | | | | | 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
* Clarify and simplify.Nick Lewycky2009-07-111-1/+1
| | | | llvm-svn: 75366
* Move a method that creates constant ranges relative to another constant rangeNick Lewycky2009-07-111-0/+72
| | | | | | | | | | 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. llvm-svn: 75357
* Revert the part of 75177 that split ConstantRange into two classes, andDan Gohman2009-07-091-513/+28
| | | | | | | | 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-19/+572
| | | | | | | | | | | | | 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
* Switch the asmprinter (.ll) and all the stuff it requires over toChris Lattner2008-08-231-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 55263
* Rework the routines that convert AP[S]Int into a string. Now, instead ofChris Lattner2008-08-171-2/+1
| | | | | | | | | | | | | | | | | 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. llvm-svn: 54873
* Tidy up whitespace in ConstantRange::print output.Dan Gohman2008-05-271-1/+1
| | | | llvm-svn: 51606
* Remove attribution from file headers, per discussion on llvmdev.Chris Lattner2007-12-291-2/+2
| | | | llvm-svn: 45418
* Clarify the language. Pointed out by Duncan Sands.Nick Lewycky2007-07-141-2/+4
| | | | llvm-svn: 39857
* Add alternate ConstantRange intersection algorithm.Nick Lewycky2007-07-141-0/+81
| | | | llvm-svn: 39851
* Fix edge case.Nick Lewycky2007-06-091-2/+2
| | | | llvm-svn: 37532
* Using APInt more efficiently.Zhou Sheng2007-04-261-5/+3
| | | | llvm-svn: 36475
* Make the apint construction more effective.Zhou Sheng2007-04-131-3/+3
| | | | llvm-svn: 35960
* Add signExtend to ConstantRange, to complement zeroExtend and truncate.Nick Lewycky2007-04-071-0/+17
| | | | llvm-svn: 35733
* Implement union of wrapped sets.Nick Lewycky2007-04-011-7/+65
| | | | llvm-svn: 35534
* Add getter methods for the extremes of a ConstantRange.Nick Lewycky2007-03-101-0/+64
| | | | llvm-svn: 35056
* Implement unionWith.Nick Lewycky2007-03-021-2/+11
| | | | llvm-svn: 34833
* Remove the "isSigned" parameters from ConstantRange. It turns out theyReid Spencer2007-03-011-37/+23
| | | | | | | | are not needed as the results are the same with or without it. Patch by Nicholas Lewycky. llvm-svn: 34782
* Move ConstantRange class to lib/Support from lib/Analysis and make itsReid Spencer2007-02-281-0/+259
| | | | | | interface not depend on Type or ICmpInst. llvm-svn: 34761
* Move these files (which are dependent on VMCore) into VMCoreMisha Brukman2004-08-161-332/+0
| | | | llvm-svn: 15825
* Bug fixes for PR341Chris Lattner2004-07-151-1/+1
| | | | llvm-svn: 14838
* Add #include <iostream> since Value.h does not #include it any more.Reid Spencer2004-07-041-0/+2
| | | | llvm-svn: 14622
* Add some new methodsChris Lattner2004-03-301-15/+87
| | | | llvm-svn: 12539
* Adjust to new itfChris Lattner2004-03-291-2/+2
| | | | llvm-svn: 12534
* Remove use of ConstantHandling itfChris Lattner2004-01-121-24/+31
| | | | llvm-svn: 10800
OpenPOWER on IntegriCloud