diff options
author | Chris Lattner <sabre@nondot.org> | 2004-11-18 04:33:31 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-11-18 04:33:31 +0000 |
commit | 08ec603bb08ec264ea9ce565b76053e58e64ed34 (patch) | |
tree | a16abaaa4fb1c5db250c185e693b4028a98de64d /llvm/lib | |
parent | cf972ff7cb9576667d72b1b165f98baceb5bb927 (diff) | |
download | bcm5719-llvm-08ec603bb08ec264ea9ce565b76053e58e64ed34.tar.gz bcm5719-llvm-08ec603bb08ec264ea9ce565b76053e58e64ed34.zip |
Fix a couple of bugs where we considered physregs past their range as possibly
intersecting an interval.
llvm-svn: 17939
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/RegAllocLinearScan.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/RegAllocLinearScan.cpp b/llvm/lib/CodeGen/RegAllocLinearScan.cpp index 0cb30430a37..c63a0c18aec 100644 --- a/llvm/lib/CodeGen/RegAllocLinearScan.cpp +++ b/llvm/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); + } } } |