Fix bug in LiveIntervals::Interval::overlaps and
authorAlkis Evlogimenos <alkis@evlogimenos.com>
Wed, 14 Jan 2004 00:20:09 +0000 (00:20 +0000)
committerAlkis Evlogimenos <alkis@evlogimenos.com>
Wed, 14 Jan 2004 00:20:09 +0000 (00:20 +0000)
LiveIntervals::Interval::liveAt. Both were considering the live ranges
closed in the end, when they are actually open.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10835 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/LiveIntervalAnalysis.cpp

index acc32117c00bf05cfd8227e25b5971a39c1b0f68..fb577228e829d51de41ff27c7b74a55ab84e1387 100644 (file)
@@ -366,7 +366,7 @@ void LiveIntervals::Interval::mergeRangesBackward(Ranges::iterator it)
 bool LiveIntervals::Interval::liveAt(unsigned index) const
 {
     Ranges::const_iterator r = ranges.begin();
-    while (r != ranges.end() && index < r->second) {
+    while (r != ranges.end() && index < (r->second - 1)) {
         if (index >= r->first)
             return true;
         ++r;
@@ -381,7 +381,7 @@ bool LiveIntervals::Interval::overlaps(const Interval& other) const
 
     while (i != ranges.end() && j != other.ranges.end()) {
         if (i->first < j->first) {
-            if (i->second > j->first) {
+            if ((i->second - 1) > j->first) {
                 return true;
             }
             else {
@@ -389,7 +389,7 @@ bool LiveIntervals::Interval::overlaps(const Interval& other) const
             }
         }
         else if (j->first < i->first) {
-            if (j->second > i->first) {
+            if ((j->second - 1) > i->first) {
                 return true;
             }
             else {