1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00
Commit Graph

65 Commits

Author SHA1 Message Date
Nuno Lopes
cd83a81786 fix corner case in ConstantRange::intersectWith().
this fixes the missed optimization I was seeing in the CorrelatedValuePropagation pass

llvm-svn: 157032
2012-05-18 00:14:36 +00:00
Craig Topper
639b152ca5 Convert assert(0) to llvm_unreachable
llvm-svn: 149967
2012-02-07 05:05:23 +00:00
Nick Lewycky
ba84a9652a Conform to the style guide; remove 'else' after 'return'. Also remove an extra
if-statement by turning it into an assert. No functionality change.

llvm-svn: 147474
2012-01-03 20:33:00 +00:00
Benjamin Kramer
5017d640a1 Make ConstantRange::truncate a bit more efficient.
llvm-svn: 145122
2011-11-24 17:24:33 +00:00
Richard Trieu
a675de9fac Change:
assert(!"error message");

To:

  assert(0 && "error message");

which is more consistant across the code base.

llvm-svn: 140234
2011-09-21 03:09:09 +00:00
Frits van Bommel
7751ac91b6 Trim includes.
llvm-svn: 136218
2011-07-27 15:20:06 +00:00
Nick Lewycky
5e5818d0f8 Fix the implementation of ConstantRange::sub(ConstantRange). Patch by Xi Wang!
llvm-svn: 133648
2011-06-22 21:13:46 +00:00
Jay Foad
79e18ed269 PR5207: Change APInt methods trunc(), sext(), zext(), sextOrTrunc() and
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
2010-12-07 08:25:19 +00:00
Nick Lewycky
69d1069a4b Make ConstantRange::makeICmpRegion handle all the edge cases properly. This
also fixes PR8250.

llvm-svn: 114972
2010-09-28 18:18:36 +00:00
Nick Lewycky
9698dae1df Add completely hokey binary-and and binary-or operations to ConstantRange and
teach LazyValueInfo to use them.

llvm-svn: 113196
2010-09-07 05:39:02 +00:00
Nick Lewycky
ca54f909d8 Add a new isSignWrappedSet() method to ConstantRange.
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
2010-09-06 23:52:49 +00:00
Nick Lewycky
90e835b327 Clean up ConstantRange a bit:
- 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
2010-08-11 22:04:36 +00:00
Owen Anderson
d17104afda Remove layering violation.
llvm-svn: 110505
2010-08-07 06:01:13 +00:00
Owen Anderson
e59c4411b3 Add an inverse() method to ConstantRange.
llvm-svn: 110504
2010-08-07 05:47:46 +00:00
Owen Anderson
31ced50119 Add a convenience constructor.
llvm-svn: 110493
2010-08-07 00:42:06 +00:00
Dan Gohman
47ec8cddb7 Fix a typo that several people pointed out. Also, address the case of
wrapping that Duncan pointed out.

llvm-svn: 94547
2010-01-26 15:56:18 +00:00
Dan Gohman
0c02f09fba Add a comment about a missed opportunity.
llvm-svn: 94507
2010-01-26 04:13:15 +00:00
Dan Gohman
2d9a3eb391 Print empty and full sets specially.
llvm-svn: 94506
2010-01-26 04:12:55 +00:00
David Greene
b961c4aa37 Change errs() to dbgs().
llvm-svn: 92638
2010-01-05 01:28:32 +00:00
Nuno Lopes
569944e45f fix crash in my previous patch
llvm-svn: 86987
2009-11-12 15:10:33 +00:00
Nuno Lopes
aa4a883855 implement shl, ashr, and lshr methods. shl is not fully implemented as it is quite tricky.
llvm-svn: 86986
2009-11-12 14:53:53 +00:00
Nuno Lopes
5b15b50af4 add zextOrTrunc and sextOrTrunc methods, that are similar to the ones in APInt
llvm-svn: 86549
2009-11-09 15:36:28 +00:00
Chris Lattner
1c0452caeb Change Pass::print to take a raw ostream instead of std::ostream,
update all code that this affects.

llvm-svn: 79830
2009-08-23 06:03:38 +00:00
Nick Lewycky
3b459607de Fix ConstantRange::unionWith. Also make it work a little hard in some cases to
return the smallest union of two ranges instead of just any range that happens
to contain the union.

llvm-svn: 76360
2009-07-19 03:44:35 +00:00
Nick Lewycky
ec10fcbd04 Replace intersectWith with maximalIntersectWith. The latter guarantees that
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
2009-07-18 06:34:42 +00:00
Nick Lewycky
0cc1d245c4 Fix an error in ConstantRange::getSignedMax on wrapped ranges. Thanks once
again to Daniel Dunbar and KLEE!

llvm-svn: 75449
2009-07-13 04:50:21 +00:00
Nick Lewycky
41a9bdab7b 'i8 full-range' sign extended to i16 should equal [-128, 128) not [-128, 127).
Found by Daniel Dunbar and KLEE.

llvm-svn: 75448
2009-07-13 04:17:23 +00:00
Nick Lewycky
fee90bcb80 Multiply was very wrong for wrapped ranges. This supplies a half-fix that will
generally return Full on all wrapped inputs. "Fixes" PR4545.

llvm-svn: 75444
2009-07-13 03:27:41 +00:00
Nick Lewycky
7280c39dc7 Fix a bug summing two full sets. The overflow checking doesn't handle sets as
large as the full set, only those one size smaller. Thanks to Daniel Dunbar
who found this bug using Klee!

llvm-svn: 75443
2009-07-13 02:49:08 +00:00
Nick Lewycky
dc5ef94320 Implement udiv for ConstantRanges.
llvm-svn: 75413
2009-07-12 05:18:18 +00:00
Nick Lewycky
6663d6ad6f Implement ConstantRange::multiply based on the code in LoopVR.
llvm-svn: 75410
2009-07-12 02:19:05 +00:00
Nick Lewycky
3e43cd4105 Fix handling of max and full set.
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
2009-07-11 19:22:21 +00:00
Nick Lewycky
58a6fd9824 Clarify and simplify.
llvm-svn: 75366
2009-07-11 17:04:01 +00:00
Nick Lewycky
fee40fdcd9 Move a method that creates constant ranges relative to another constant range
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
2009-07-11 06:15:39 +00:00
Dan Gohman
8a58b8f83b Revert the part of 75177 that split ConstantRange into two classes, and
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
2009-07-09 23:16:10 +00:00
Dan Gohman
33251eff97 Add a ConstantSignedRange class, which does for signed integers
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
2009-07-09 22:07:27 +00:00
Chris Lattner
fe3155fc62 Switch the asmprinter (.ll) and all the stuff it requires over to
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
2008-08-23 22:23:09 +00:00
Chris Lattner
c0610874cc Rework the routines that convert AP[S]Int into a string. Now, instead of
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
2008-08-17 07:19:36 +00:00
Dan Gohman
92d5dff525 Tidy up whitespace in ConstantRange::print output.
llvm-svn: 51606
2008-05-27 20:29:07 +00:00
Chris Lattner
ad9a6ccb83 Remove attribution from file headers, per discussion on llvmdev.
llvm-svn: 45418
2007-12-29 20:36:04 +00:00
Nick Lewycky
701e227136 Clarify the language. Pointed out by Duncan Sands.
llvm-svn: 39857
2007-07-14 17:41:03 +00:00
Nick Lewycky
42e8a060a0 Add alternate ConstantRange intersection algorithm.
llvm-svn: 39851
2007-07-14 02:51:34 +00:00
Nick Lewycky
e03bd9ddbb Fix edge case.
llvm-svn: 37532
2007-06-09 04:20:33 +00:00
Zhou Sheng
8c150f133c Using APInt more efficiently.
llvm-svn: 36475
2007-04-26 16:42:07 +00:00
Zhou Sheng
dedfc40044 Make the apint construction more effective.
llvm-svn: 35960
2007-04-13 05:57:32 +00:00
Nick Lewycky
ec51e934ef Add signExtend to ConstantRange, to complement zeroExtend and truncate.
llvm-svn: 35733
2007-04-07 15:41:33 +00:00
Nick Lewycky
03f9c0ffc9 Implement union of wrapped sets.
llvm-svn: 35534
2007-04-01 03:47:44 +00:00
Nick Lewycky
2af4a3ab17 Add getter methods for the extremes of a ConstantRange.
llvm-svn: 35056
2007-03-10 15:54:12 +00:00
Nick Lewycky
29f7380f34 Implement unionWith.
llvm-svn: 34833
2007-03-02 03:33:05 +00:00
Reid Spencer
3f3487918c Remove the "isSigned" parameters from ConstantRange. It turns out they
are not needed as the results are the same with or without it.

Patch by Nicholas Lewycky.

llvm-svn: 34782
2007-03-01 07:54:15 +00:00