aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/RegAllocLinearScan.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-11-18 04:33:31 +0000
committerChris Lattner <sabre@nondot.org>2004-11-18 04:33:31 +0000
commitf348e3abfcca1b6366638ba8aa617118d090a305 (patch)
tree2b3b51bc24c9ad8ec3330ae66c4e15b17646d800 /lib/CodeGen/RegAllocLinearScan.cpp
parent1a3a48776340c96df5df673df1c159391d1a1cb7 (diff)
Fix a couple of bugs where we considered physregs past their range as possibly
intersecting an interval. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17939 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/RegAllocLinearScan.cpp')
-rw-r--r--lib/CodeGen/RegAllocLinearScan.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/CodeGen/RegAllocLinearScan.cpp b/lib/CodeGen/RegAllocLinearScan.cpp
index 0cb30430a3..c63a0c18ae 100644
--- a/lib/CodeGen/RegAllocLinearScan.cpp
+++ b/lib/CodeGen/RegAllocLinearScan.cpp
@@ -145,6 +145,7 @@ bool RA::runOnMachineFunction(MachineFunction &fn) {
tm_ = &fn.getTarget();
mri_ = tm_->getRegisterInfo();
li_ = &getAnalysis<LiveIntervals>();
+
if (!prt_.get()) prt_.reset(new PhysRegTracker(*mri_));
vrm_.reset(new VirtRegMap(*mf_));
if (!spiller_.get()) spiller_.reset(createSpiller());
@@ -393,12 +394,16 @@ void RA::assignRegOrStackSlotAtInterval(LiveInterval* cur)
for (unsigned i = 0, e = fixed_.size(); i != e; ++i) {
IntervalPtr &IP = fixed_[i];
LiveInterval *I = IP.first;
- LiveInterval::iterator II = I->advanceTo(IP.second, StartPosition);
- IP.second = II;
- if (cur->overlapsFrom(*I, II)) {
- unsigned reg = I->reg;
- prt_->addRegUse(reg);
- updateSpillWeights(reg, I->weight);
+ if (I->endNumber() > StartPosition) {
+ LiveInterval::iterator II = I->advanceTo(IP.second, StartPosition);
+ IP.second = II;
+ if (II != I->begin() && II->start > StartPosition)
+ --II;
+ if (cur->overlapsFrom(*I, II)) {
+ unsigned reg = I->reg;
+ prt_->addRegUse(reg);
+ updateSpillWeights(reg, I->weight);
+ }
}
}