From e8e0bac270b6e6da76b7ae9f153cefe3bd15597b Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Tue, 13 Jan 2015 23:39:15 +0000 Subject: Debug Info: Bail out of AddMachineRegPiece() if MachineReg is not a physical register. The call to getMinimalPhysRegClass() later on asserts on this condition. llvm-svn: 225852 --- llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'llvm/lib/CodeGen') diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp index 4c16ae70d1f..26c2a20dea1 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp @@ -93,6 +93,12 @@ void DwarfExpression::AddMachineRegPiece(unsigned MachineReg, unsigned PieceSizeInBits, unsigned PieceOffsetInBits) { const TargetRegisterInfo *TRI = getTRI(); + if (!TRI->isPhysicalRegister(MachineReg)) { + // FIXME: We have no reasonable way of handling errors in here. + EmitOp(dwarf::DW_OP_nop, "nop (could not find a dwarf register number)"); + return; + } + int Reg = TRI->getDwarfRegNum(MachineReg, false); // If this is a valid register number, emit it. -- cgit v1.2.3