diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/LiveInterval.cpp | 15 | ||||
-rw-r--r-- | lib/CodeGen/SplitKit.cpp | 4 |
2 files changed, 18 insertions, 1 deletions
diff --git a/lib/CodeGen/LiveInterval.cpp b/lib/CodeGen/LiveInterval.cpp index 14b10d1825..f4c06b203c 100644 --- a/lib/CodeGen/LiveInterval.cpp +++ b/lib/CodeGen/LiveInterval.cpp @@ -180,6 +180,21 @@ void LiveInterval::markValNoForDeletion(VNInfo *ValNo) { } } +/// RenumberValues - Renumber all values in order of appearance and delete the +/// remaining unused values. +void LiveInterval::RenumberValues() { + SmallPtrSet<VNInfo*, 8> Seen; + valnos.clear(); + for (const_iterator I = begin(), E = end(); I != E; ++I) { + VNInfo *VNI = I->valno; + if (!Seen.insert(VNI)) + continue; + assert(!VNI->isUnused() && "Unused valno used by live range"); + VNI->id = (unsigned)valnos.size(); + valnos.push_back(VNI); + } +} + /// extendIntervalEndTo - This method is used when we want to extend the range /// specified by I to end at the specified endpoint. To do this, we should /// merge and eliminate all ranges that this will overlap with. The iterator is diff --git a/lib/CodeGen/SplitKit.cpp b/lib/CodeGen/SplitKit.cpp index fdc448d1e8..9b0d73a4f2 100644 --- a/lib/CodeGen/SplitKit.cpp +++ b/lib/CodeGen/SplitKit.cpp @@ -553,8 +553,10 @@ void SplitEditor::rewrite() { } // dupli_ goes in last, after rewriting. - if (dupli_) + if (dupli_) { + dupli_->RenumberValues(); intervals_.push_back(dupli_); + } // FIXME: *Calculate spill weights, allocation hints, and register classes for // firstInterval.. |