summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/RegAllocGreedy.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2011-02-08 21:46:11 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2011-02-08 21:46:11 +0000
commit93dda45ada25f7c7fd71a3d01f2a812d51ee08a7 (patch)
treeea21950dbe3bf89db4c55b0b3d4409527e0aa35b /llvm/lib/CodeGen/RegAllocGreedy.cpp
parent3a34725ed129716f29df55b41c9d3ef6fdffb8d6 (diff)
downloadbcm5719-llvm-93dda45ada25f7c7fd71a3d01f2a812d51ee08a7.tar.gz
bcm5719-llvm-93dda45ada25f7c7fd71a3d01f2a812d51ee08a7.zip
Also handle the situation where an indirect branch is the first (and last)
instruction in a basic block. llvm-svn: 125116
Diffstat (limited to 'llvm/lib/CodeGen/RegAllocGreedy.cpp')
-rw-r--r--llvm/lib/CodeGen/RegAllocGreedy.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/RegAllocGreedy.cpp b/llvm/lib/CodeGen/RegAllocGreedy.cpp
index 4713da8a9af..d5d76ca1f81 100644
--- a/llvm/lib/CodeGen/RegAllocGreedy.cpp
+++ b/llvm/lib/CodeGen/RegAllocGreedy.cpp
@@ -808,16 +808,18 @@ void RAGreedy::splitAroundRegion(LiveInterval &VirtReg, unsigned PhysReg,
DEBUG(dbgs() << ", uses at " << BI.LastUse << " after split point "
<< BI.LastSplitPoint << ", stack-out.\n");
SlotIndex SegEnd;
- if (BI.LastSplitPoint == Start)
+ // Find the last real instruction before the split point.
+ MachineBasicBlock::iterator SplitI =
+ LIS->getInstructionFromIndex(BI.LastSplitPoint);
+ MachineBasicBlock::iterator I = SplitI, B = BI.MBB->begin();
+ while (I != B && (--I)->isDebugValue())
+ ;
+ if (I == SplitI)
SegEnd = SE.leaveIntvAtTop(*BI.MBB);
else {
- MachineBasicBlock::iterator I =
- LIS->getInstructionFromIndex(BI.LastSplitPoint);
- do assert(I != BI.MBB->begin() && "Expected instruction");
- while ((--I)->isDebugValue());
SegEnd = SE.leaveIntvAfter(LIS->getInstructionIndex(I));
+ SE.useIntv(Start, SegEnd);
}
- SE.useIntv(Start, SegEnd);
// Run a double interval from the split to the last use.
// This makes it possible to spill the complement without affecting the
// indirect branch.
OpenPOWER on IntegriCloud