Also update virtRegMap when renaming virtual registers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120841 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/LiveDebugVariables.cpp b/lib/CodeGen/LiveDebugVariables.cpp
index 4b428f6..73083c7 100644
--- a/lib/CodeGen/LiveDebugVariables.cpp
+++ b/lib/CodeGen/LiveDebugVariables.cpp
@@ -583,8 +583,18 @@
void LDVImpl::
renameRegister(unsigned OldReg, unsigned NewReg, unsigned SubIdx) {
- for (UserValue *UV = lookupVirtReg(OldReg); UV; UV = UV->getNext())
+ UserValue *UV = lookupVirtReg(OldReg);
+ if (!UV)
+ return;
+
+ if (TargetRegisterInfo::isVirtualRegister(NewReg))
+ mapVirtReg(NewReg, UV);
+ virtRegMap.erase(OldReg);
+
+ do {
UV->renameRegister(OldReg, NewReg, SubIdx, TRI);
+ UV = UV->getNext();
+ } while (UV);
}
void LiveDebugVariables::