mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
If only user of a vreg is an copy instruction to export copy of vreg out of current basic block then insert DBG_VALUE so that debug value of the variable is also transfered to new vreg.
Testcase is in r114476. This fixes radar 8412415. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114478 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
161f0caaf9
commit
44cfe14445
@ -290,6 +290,29 @@ bool SelectionDAGISel::runOnMachineFunction(MachineFunction &mf) {
|
||||
TII.get(TargetOpcode::DBG_VALUE))
|
||||
.addReg(LDI->second, RegState::Debug)
|
||||
.addImm(Offset).addMetadata(Variable);
|
||||
|
||||
// If this vreg is directly copied into an exported register then
|
||||
// that COPY instructions also need DBG_VALUE, if it is the only
|
||||
// user of LDI->second.
|
||||
MachineInstr *CopyUseMI = NULL;
|
||||
for (MachineRegisterInfo::use_iterator
|
||||
UI = RegInfo->use_begin(LDI->second);
|
||||
MachineInstr *UseMI = UI.skipInstruction();) {
|
||||
if (UseMI->isDebugValue()) continue;
|
||||
if (UseMI->isCopy() && !CopyUseMI && UseMI->getParent() == EntryMBB) {
|
||||
CopyUseMI = UseMI; continue;
|
||||
}
|
||||
// Otherwise this is another use or second copy use.
|
||||
CopyUseMI = NULL; break;
|
||||
}
|
||||
if (CopyUseMI) {
|
||||
MachineInstr *NewMI =
|
||||
BuildMI(*MF, CopyUseMI->getDebugLoc(),
|
||||
TII.get(TargetOpcode::DBG_VALUE))
|
||||
.addReg(CopyUseMI->getOperand(0).getReg(), RegState::Debug)
|
||||
.addImm(Offset).addMetadata(Variable);
|
||||
EntryMBB->insertAfter(CopyUseMI, NewMI);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user