Fix the case where an instruction is not properly marked as using all registers that...
authorOwen Anderson <resistor@mac.com>
Wed, 8 Oct 2008 04:30:51 +0000 (04:30 +0000)
committerOwen Anderson <resistor@mac.com>
Wed, 8 Oct 2008 04:30:51 +0000 (04:30 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57286 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/RegAllocLocal.cpp

index 82691baf3db34332a76f6e43488fd9c1fdb63999..479245224ea12fa8756de0c1960d8c2fc97fa505 100644 (file)
@@ -575,8 +575,26 @@ void RALocal::ComputeLocalLiveness(MachineBasicBlock& MBB) {
       // 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) {