[llvm-commits] CVS: llvm/lib/CodeGen/RegAllocLinearScan.cpp

Chris Lattner lattner at cs.uiuc.edu
Wed Nov 17 20:33:45 PST 2004



Changes in directory llvm/lib/CodeGen:

RegAllocLinearScan.cpp updated: 1.101 -> 1.102
---
Log message:

Fix a couple of bugs where we considered physregs past their range as possibly
intersecting an interval.


---
Diffs of the changes:  (+11 -6)

Index: llvm/lib/CodeGen/RegAllocLinearScan.cpp
diff -u llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.101 llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.102
--- llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.101	Wed Nov 17 22:13:02 2004
+++ llvm/lib/CodeGen/RegAllocLinearScan.cpp	Wed Nov 17 22:33:31 2004
@@ -145,6 +145,7 @@
   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 @@
   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);
+      }
     }
   }
 






More information about the llvm-commits mailing list