Closed Quuxplusone closed 13 years ago
Attached bugpoint-reduced-simplified.ll
(4960 bytes, application/octet-stream): bugpoint-reduced-simplified.ll
The problem is as follows. In XCoreRegisterInfo::eliminateFrameIndex() we
replace the frame index of a dbg_value machine instruction with the frame
register and set the next operand to the offset:
// Special handling of DBG_VALUE instructions.
if (MI.isDebugValue()) {
MI.getOperand(i).ChangeToRegister(FrameReg, false /*isDef*/);
MI.getOperand(i+1).ChangeToImmediate(Offset);
return;
}
This results in the second operand of the dbg_value being set to the byte
offset from the frame register.
However in CompileUnit::constructVariableDIE it seems to expect the second
operand of dbg_value to be the frame index since it passes it to
TargetFrameLowering::getFrameIndexReference:
if (DVInsn->getNumOperands() == 3) {
if (DVInsn->getOperand(0).isReg()) {
const MachineOperand RegOp = DVInsn->getOperand(0);
const TargetRegisterInfo *TRI = Asm->TM.getRegisterInfo();
if (DVInsn->getOperand(1).isImm() &&
TRI->getFrameRegister(*Asm->MF) == RegOp.getReg()) {
unsigned FrameReg = 0;
const TargetFrameLowering *TFI = Asm->TM.getFrameLowering();
int Offset =
TFI->getFrameIndexReference(*Asm->MF,
DVInsn->getOperand(1).getImm(),
FrameReg);
In the testcase in this bug the byte offset of the variable is larger than
biggest frame index and so MachineFrameInfo::getObjectOffset() asserts.
Fixed in r141666 by implementing the emitFrameIndexDebugValue() and getDebugValueLocation() hooks.
bugpoint-reduced-simplified.ll
(4960 bytes, application/octet-stream)