[llvm-commits] [llvm] r57286 - /llvm/trunk/lib/CodeGen/RegAllocLocal.cpp

Owen Anderson resistor at mac.com
Tue Oct 7 21:30:53 PDT 2008


Author: resistor
Date: Tue Oct  7 23:30:51 2008
New Revision: 57286

URL: http://llvm.org/viewvc/llvm-project?rev=57286&view=rev
Log:
Fix the case where an instruction is not properly marked as using all registers that alias its inputs.

Modified:
    llvm/trunk/lib/CodeGen/RegAllocLocal.cpp

Modified: llvm/trunk/lib/CodeGen/RegAllocLocal.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLocal.cpp?rev=57286&r1=57285&r2=57286&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/RegAllocLocal.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegAllocLocal.cpp Tue Oct  7 23:30:51 2008
@@ -575,8 +575,26 @@
       // them for later.  Also, we have to process these
       // _before_ processing the defs, since an instr
       // uses regs before it defs them.
-      if (MO.isReg() && MO.getReg() && MO.isUse())
+      if (MO.isReg() && MO.getReg() && MO.isUse()) {
         LastUseDef[MO.getReg()] = std::make_pair(I, i);
+        
+        
+        if (TargetRegisterInfo::isVirtualRegister(MO.getReg())) continue;
+        
+        const unsigned* subregs = TRI->getAliasSet(MO.getReg());
+        if (subregs) {
+          while (*subregs) {
+            DenseMap<unsigned, std::pair<MachineInstr*, unsigned> >::iterator
+              alias = LastUseDef.find(*subregs);
+            
+            if (alias != LastUseDef.end() &&
+                alias->second.first != I)
+              LastUseDef[*subregs] = std::make_pair(I, i);
+            
+            ++subregs;
+          }
+        }
+      }
     }
     
     for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) {





More information about the llvm-commits mailing list