summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/ConstantRange.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Don't use a potentially expensive shift if all we want is one set bit.Benjamin Kramer2013-07-111-1/+1
| | | | | | No functionality change. llvm-svn: 186095
* Use move semantics if possible to construct ConstantRanges.Benjamin Kramer2013-07-111-5/+6
| | | | | | | Arithmetic on ConstantRanges creates a lot of large temporary APInts that benefit from move semantics. llvm-svn: 186091
* 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
* make ConstantRange::zeroExtend() optimalNuno Lopes2012-07-231-2/+6
| | | | llvm-svn: 160643
* reimplement truncate() to make it optimal.Nuno Lopes2012-07-191-10/+45
| | | | | | | | 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 :) llvm-svn: 160512
* simplify getSetSize() per Duncan's commentsNuno Lopes2012-07-171-6/+5
| | | | llvm-svn: 160368
* teach ConstantRange that zero times X is always zeroNuno Lopes2012-07-161-0/+6
| | | | llvm-svn: 160317
* make ConstantRange::getSetSize() properly compute the size of wrapped and ↵Nuno Lopes2012-07-161-8/+10
| | | | | | | | 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/+6
| | | | llvm-svn: 159352
* fix a off-by-one bug in intersectWith(), and add a bunch of testsNuno Lopes2012-06-281-1/+1
| | | | llvm-svn: 159319
* fix corner case in ConstantRange::intersectWith().Nuno Lopes2012-05-181-1/+1
| | | | | | this fixes the missed optimization I was seeing in the CorrelatedValuePropagation pass llvm-svn: 157032
* Convert assert(0) to llvm_unreachableCraig Topper2012-02-071-1/+1
| | | | llvm-svn: 149967
* Conform to the style guide; remove 'else' after 'return'. Also remove an extraNick Lewycky2012-01-031-56/+36
| | | | | | if-statement by turning it into an assert. No functionality change. llvm-svn: 147474
* Make ConstantRange::truncate a bit more efficient.Benjamin Kramer2011-11-241-4/+2
| | | | llvm-svn: 145122
* Change:Richard Trieu2011-09-211-1/+1
| | | | | | | | | | | | assert(!"error message"); To: assert(0 && "error message"); which is more consistant across the code base. llvm-svn: 140234
* Trim includes.Frits van Bommel2011-07-271-12/+11
| | | | llvm-svn: 136218
* Fix the implementation of ConstantRange::sub(ConstantRange). Patch by Xi Wang!Nick Lewycky2011-06-221-2/+2
| | | | llvm-svn: 133648
* 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
OpenPOWER on IntegriCloud