From bd6d291c5955c974c1c50ffe0247760454fe13a1 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Wed, 2 Aug 2017 17:19:13 +0000 Subject: Assert that the offset of a DBG_VALUE is always 0. (NFC) llvm-svn: 309834 --- llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp') diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp index 8820d21dd14..3b73c2a07b0 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -481,9 +481,11 @@ DIE *DwarfCompileUnit::constructVariableDIEImpl(const DbgVariable &DV, if (const MachineInstr *DVInsn = DV.getMInsn()) { assert(DVInsn->getNumOperands() == 4); if (DVInsn->getOperand(0).isReg()) { - const MachineOperand RegOp = DVInsn->getOperand(0); + auto RegOp = DVInsn->getOperand(0); + auto Op1 = DVInsn->getOperand(1); // If the second operand is an immediate, this is an indirect value. - MachineLocation Location(RegOp.getReg(), DVInsn->getOperand(1).isImm()); + assert((!Op1.isImm() || (Op1.getImm() == 0)) && "unexpected offset"); + MachineLocation Location(RegOp.getReg(), Op1.isImm()); addVariableAddress(DV, *VariableDie, Location); } else if (DVInsn->getOperand(0).isImm()) { // This variable is described by a single constant. -- cgit v1.2.3