summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2007-11-29 09:49:23 +0000
committerEvan Cheng <evan.cheng@apple.com>2007-11-29 09:49:23 +0000
commitf85c063ec0694f26f9cbf6ad482da01773b25892 (patch)
tree24b1741a8bb4f70a9312e2c0043c92f7ddf9591c /llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
parent8dfcd5975edf09eb74cc7828e2223c498e82967c (diff)
downloadbcm5719-llvm-f85c063ec0694f26f9cbf6ad482da01773b25892.tar.gz
bcm5719-llvm-f85c063ec0694f26f9cbf6ad482da01773b25892.zip
Replace the odd kill# hack with something less fragile.
llvm-svn: 44434
Diffstat (limited to 'llvm/lib/CodeGen/LiveIntervalAnalysis.cpp')
-rw-r--r--llvm/lib/CodeGen/LiveIntervalAnalysis.cpp25
1 files changed, 10 insertions, 15 deletions
diff --git a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
index 75d5aac4048..06514372019 100644
--- a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
@@ -362,7 +362,8 @@ void LiveIntervals::handleVirtualRegisterDef(MachineBasicBlock *mbb,
DOUT << " Removing [" << Start << "," << End << "] from: ";
interval.print(DOUT, mri_); DOUT << "\n";
interval.removeRange(Start, End);
- interval.addKill(VNI, Start+1); // odd # means phi node
+ interval.addKill(VNI, Start);
+ VNI->hasPHIKill = true;
DOUT << " RESULT: "; interval.print(DOUT, mri_);
// Replace the interval with one of a NEW value number. Note that this
@@ -392,7 +393,8 @@ void LiveIntervals::handleVirtualRegisterDef(MachineBasicBlock *mbb,
unsigned killIndex = getInstructionIndex(&mbb->back()) + InstrSlots::NUM;
LiveRange LR(defIndex, killIndex, ValNo);
interval.addRange(LR);
- interval.addKill(ValNo, killIndex+1); // odd # means phi node
+ interval.addKill(ValNo, killIndex);
+ ValNo->hasPHIKill = true;
DOUT << " +" << LR;
}
}
@@ -1081,21 +1083,14 @@ addIntervalsForSpills(const LiveInterval &li,
vrm.setVirtIsReMaterialized(li.reg, ReMatDefMI);
bool CanDelete = true;
- for (unsigned j = 0, ee = VNI->kills.size(); j != ee; ++j) {
- unsigned KillIdx = VNI->kills[j];
- MachineInstr *KillMI = (KillIdx & 1)
- ? NULL : getInstructionFromIndex(KillIdx);
- // Kill is a phi node, not all of its uses can be rematerialized.
+ if (VNI->hasPHIKill) {
+ // A kill is a phi node, not all of its uses can be rematerialized.
// It must not be deleted.
- if (!KillMI) {
- CanDelete = false;
- // Need a stack slot if there is any live range where uses cannot be
- // rematerialized.
- NeedStackSlot = true;
- break;
- }
+ CanDelete = false;
+ // Need a stack slot if there is any live range where uses cannot be
+ // rematerialized.
+ NeedStackSlot = true;
}
-
if (CanDelete)
ReMatDelete.set(VN);
} else {
OpenPOWER on IntegriCloud