summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2008-07-30 00:22:56 +0000
committerOwen Anderson <resistor@mac.com>2008-07-30 00:22:56 +0000
commit9382b9310f008a3347e565d76aadda6a97351de9 (patch)
tree83a0643362ecb5d75db1a8cae54687634b9d3759
parentb9fb8d1e69aa910eb6bb03d3d66e5a2e25a20cd8 (diff)
downloadllvm-9382b9310f008a3347e565d76aadda6a97351de9.tar.gz
llvm-9382b9310f008a3347e565d76aadda6a97351de9.tar.bz2
llvm-9382b9310f008a3347e565d76aadda6a97351de9.tar.xz
More fixes for corner cases when remapping live range indices.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54186 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/LiveIntervalAnalysis.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp
index 02c1191f84..b557b703cc 100644
--- a/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/lib/CodeGen/LiveIntervalAnalysis.cpp
@@ -156,14 +156,13 @@ void LiveIntervals::computeNumbering() {
// following instruction.
index = (LI->end - 1) / InstrSlots::NUM;
offset = LI->end % InstrSlots::NUM;
- if (offset == InstrSlots::USE) {
+ if (offset == InstrSlots::LOAD) {
+ // VReg dies at end of block.
std::vector<IdxMBBPair>::const_iterator I =
std::lower_bound(OldI2MBB.begin(), OldI2MBB.end(), LI->end);
- // Take the pair containing the index
- std::vector<IdxMBBPair>::const_iterator J =
- (I == OldI2MBB.end() && OldI2MBB.size()>0) ? (I-1): I;
+ --I;
- LI->end = getMBBEndIdx(J->second) + 1;
+ LI->end = getMBBEndIdx(I->second) + 1;
} else {
unsigned idx = index;
while (index < OldI2MI.size() && !OldI2MI[index]) ++index;
@@ -195,16 +194,17 @@ void LiveIntervals::computeNumbering() {
// Remap the VNInfo kill indices, which works the same as
// the end indices above.
for (size_t i = 0; i < vni->kills.size(); ++i) {
+ // PHI kills don't need to be remapped.
+ if (!vni->kills[i]) continue;
+
index = (vni->kills[i]-1) / InstrSlots::NUM;
offset = vni->kills[i] % InstrSlots::NUM;
- if (offset == InstrSlots::USE) {
+ if (offset == InstrSlots::LOAD) {
std::vector<IdxMBBPair>::const_iterator I =
std::lower_bound(OldI2MBB.begin(), OldI2MBB.end(), vni->kills[i]);
- // Take the pair containing the index
- std::vector<IdxMBBPair>::const_iterator J =
- (I == OldI2MBB.end() && OldI2MBB.size()>0) ? (I-1): I;
+ --I;
- vni->kills[i] = getMBBEndIdx(J->second) + 1;
+ vni->kills[i] = getMBBEndIdx(I->second) + 1;
} else {
unsigned idx = index;
while (!OldI2MI[index]) ++index;