Handle printing of intervals that are not assign to any physical
register yet.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10895 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/RegAllocLinearScan.cpp b/lib/CodeGen/RegAllocLinearScan.cpp
index abd1390..8712e98 100644
--- a/lib/CodeGen/RegAllocLinearScan.cpp
+++ b/lib/CodeGen/RegAllocLinearScan.cpp
@@ -161,21 +161,22 @@
             }
             std::cerr << '\n';
         }
+
         void printIntervals(const char* const str,
                             RA::IntervalPtrs::const_iterator i,
                             RA::IntervalPtrs::const_iterator e) const {
             if (str) std::cerr << str << " intervals:\n";
             for (; i != e; ++i) {
                 std::cerr << "\t\t" << **i << " -> ";
-                if ((*i)->reg < MRegisterInfo::FirstVirtualRegister) {
-                    std::cerr << mri_->getName((*i)->reg);
+                unsigned reg = (*i)->reg;
+                if (reg >= MRegisterInfo::FirstVirtualRegister) {
+                    Virt2PhysMap::const_iterator it = v2pMap_.find(reg);
+                    reg = (it == v2pMap_.end() ? 0 : it->second);
                 }
-                else {
-                    std::cerr << mri_->getName(v2pMap_.find((*i)->reg)->second);
-                }
-                std::cerr << '\n';
+                std::cerr << mri_->getName((*i)->reg) << '\n';
             }
         }
+
         void printFreeRegs(const char* const str,
                            const TargetRegisterClass* rc) const {
             if (str) std::cerr << str << ':';