Sometimes, old virtual registers can linger on DBG_VALUE instructions.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Wed, 12 Jan 2011 22:37:49 +0000 (22:37 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Wed, 12 Jan 2011 22:37:49 +0000 (22:37 +0000)
Make sure we don't crash in that case, but simply turn them into %noreg instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123335 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/LiveDebugVariables.cpp

index 9a67a630b5428bedd05029d1f6a236f0e03b270c..1e2dba29b92f2dae7ae975c4be9b618fc8a2ec78 100644 (file)
@@ -565,7 +565,8 @@ UserValue::rewriteLocations(VirtRegMap &VRM, const TargetRegisterInfo &TRI) {
         !TargetRegisterInfo::isVirtualRegister(Loc.getReg()))
       continue;
     unsigned VirtReg = Loc.getReg();
-    if (VRM.isAssignedReg(VirtReg)) {
+    if (VRM.isAssignedReg(VirtReg) &&
+        TargetRegisterInfo::isPhysicalRegister(VRM.getPhys(VirtReg))) {
       Loc.substPhysReg(VRM.getPhys(VirtReg), TRI);
     } else if (VRM.getStackSlot(VirtReg) != VirtRegMap::NO_STACK_SLOT) {
       // FIXME: Translate SubIdx to a stackslot offset.