From bc42415f0f333c17a23ea1b26726776fd99ce622 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Tue, 13 Jan 2015 23:39:15 +0000 Subject: [PATCH] Debug Info: Bail out of AddMachineRegPiece() if MachineReg is not a physical register. The call to getMinimalPhysRegClass() later on asserts on this condition. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225852 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/AsmPrinter/DwarfExpression.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/CodeGen/AsmPrinter/DwarfExpression.cpp b/lib/CodeGen/AsmPrinter/DwarfExpression.cpp index 4c16ae70d1f..26c2a20dea1 100644 --- a/lib/CodeGen/AsmPrinter/DwarfExpression.cpp +++ b/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.