From 7a13190a2e0918f5a60b72b3aacfbe9de3bc91cd Mon Sep 17 00:00:00 2001 From: Jakob Stoklund Olesen Date: Wed, 12 Jan 2011 22:37:49 +0000 Subject: [PATCH] Sometimes, old virtual registers can linger on DBG_VALUE instructions. Make sure we don't crash in that case, but simply turn them into %noreg instead. llvm-svn: 123335 --- lib/CodeGen/LiveDebugVariables.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/CodeGen/LiveDebugVariables.cpp b/lib/CodeGen/LiveDebugVariables.cpp index 9a67a630b54..1e2dba29b92 100644 --- a/lib/CodeGen/LiveDebugVariables.cpp +++ b/lib/CodeGen/LiveDebugVariables.cpp @@ -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.