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

Chris Lattner lattner at cs.uiuc.edu
Tue Aug 30 14:03:48 PDT 2005



Changes in directory llvm/lib/CodeGen:

RegAllocLinearScan.cpp updated: 1.112 -> 1.113
---
Log message:

When checking the fixed intervals, don't forget to check for register aliases.
This fixes PR621: http://llvm.cs.uiuc.edu/PR621  and Regression/CodeGen/X86/2005-08-30-RegAllocAliasProblem.ll


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

 RegAllocLinearScan.cpp |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)


Index: llvm/lib/CodeGen/RegAllocLinearScan.cpp
diff -u llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.112 llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.113
--- llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.112	Tue Aug 23 17:27:31 2005
+++ llvm/lib/CodeGen/RegAllocLinearScan.cpp	Tue Aug 30 16:03:36 2005
@@ -444,10 +444,16 @@
   unsigned physReg = getFreePhysReg(cur);
   if (physReg) {
     // We got a register.  However, if it's in the fixed_ list, we might
-    // conflict with it.  Check to see if we conflict with it.
+    // conflict with it.  Check to see if we conflict with it or any of its
+    // aliases.
+    std::set<unsigned> RegAliases;
+    for (const unsigned *AS = mri_->getAliasSet(physReg); *AS; ++AS)
+      RegAliases.insert(*AS);
+    
     bool ConflictsWithFixed = false;
     for (unsigned i = 0, e = fixed_.size(); i != e; ++i) {
-      if (physReg == fixed_[i].first->reg) {
+      if (physReg == fixed_[i].first->reg ||
+          RegAliases.count(fixed_[i].first->reg)) {
         // Okay, this reg is on the fixed list.  Check to see if we actually
         // conflict.
         IntervalPtr &IP = fixed_[i];
@@ -457,11 +463,11 @@
           IP.second = II;
           if (II != I->begin() && II->start > StartPosition)
             --II;
-          if (cur->overlapsFrom(*I, II))
+          if (cur->overlapsFrom(*I, II)) {
             ConflictsWithFixed = true;
+            break;
+          }
         }
-  
-        break;
       }
     }
     






More information about the llvm-commits mailing list