[llvm-commits] [llvm] r116940 - /llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Wed Oct 20 11:45:55 PDT 2010


Author: stoklund
Date: Wed Oct 20 13:45:55 2010
New Revision: 116940

URL: http://llvm.org/viewvc/llvm-project?rev=116940&view=rev
Log:
When SimpleRegisterCoalescing is trimming kill flags on a physical register
operand, also check if subregisters are killed.

Add <imp-def> operands for subregisters that remain alive after a super register
is killed.

I don't have a testcase for this that reproduces on trunk. <rdar://problem/8441758>

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

Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=116940&r1=116939&r2=116940&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original)
+++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Wed Oct 20 13:45:55 2010
@@ -1767,8 +1767,18 @@
         if (!MO.isReg() || !MO.isKill()) continue;
         unsigned reg = MO.getReg();
         if (!reg || !li_->hasInterval(reg)) continue;
-        if (!li_->getInterval(reg).killedAt(DefIdx))
+        if (!li_->getInterval(reg).killedAt(DefIdx)) {
           MO.setIsKill(false);
+          continue;
+        }
+        // When leaving a kill flag on a physreg, check if any subregs should
+        // remain alive.
+        if (!TargetRegisterInfo::isPhysicalRegister(reg))
+          continue;
+        for (const unsigned *SR = tri_->getSubRegisters(reg);
+             unsigned S = *SR; ++SR)
+          if (li_->hasInterval(S) && li_->getInterval(S).liveAt(DefIdx))
+            MI->addRegisterDefined(S, tri_);
       }
     }
   }





More information about the llvm-commits mailing list