Apply final part of Chris' patch.
authorAlkis Evlogimenos <alkis@evlogimenos.com>
Sat, 31 Jan 2004 23:48:47 +0000 (23:48 +0000)
committerAlkis Evlogimenos <alkis@evlogimenos.com>
Sat, 31 Jan 2004 23:48:47 +0000 (23:48 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11040 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/LiveIntervalAnalysis.cpp

index a762ede860cc9b4cf831a1c10a7bc9d0857099d3..2eb9626abed20841b002ff46315b6d9bb2cf499e 100644 (file)
@@ -168,17 +168,15 @@ void LiveIntervals::handleVirtualRegisterDef(MachineBasicBlock* mbb,
         interval = &*r2iit->second;
     }
 
-    for (MbbIndex2MbbMap::iterator
-             it = mbbi2mbbMap_.begin(), itEnd = mbbi2mbbMap_.end();
-         it != itEnd; ++it) {
-        unsigned liveBlockIndex = it->first;
-        MachineBasicBlock* liveBlock = it->second;
-        if (liveBlockIndex < vi.AliveBlocks.size() &&
-            vi.AliveBlocks[liveBlockIndex] &&
-            !liveBlock->empty()) {
-            unsigned start =  getInstructionIndex(liveBlock->front());
-            unsigned end = getInstructionIndex(liveBlock->back()) + 1;
-            interval->addRange(start, end);
+    // iterate over all of the blocks that the variable is completely
+    // live in, adding them to the live interval
+    for (unsigned i = 0, e = vi.AliveBlocks.size(); i != e; ++i) {
+        if (vi.AliveBlocks[i]) {
+            MachineBasicBlock* mbb = lv_->getIndexMachineBasicBlock(i);
+            if (!mbb->empty()) {
+                interval->addRange(getInstructionIndex(mbb->front()),
+                                   getInstructionIndex(mbb->back()) + 1);
+            }
         }
     }