[llvm] r309834 - Assert that the offset of a DBG_VALUE is always 0. (NFC)
Adrian Prantl via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 2 10:19:13 PDT 2017
Author: adrian
Date: Wed Aug 2 10:19:13 2017
New Revision: 309834
URL: http://llvm.org/viewvc/llvm-project?rev=309834&view=rev
Log:
Assert that the offset of a DBG_VALUE is always 0. (NFC)
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=309834&r1=309833&r2=309834&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Wed Aug 2 10:19:13 2017
@@ -481,9 +481,11 @@ DIE *DwarfCompileUnit::constructVariable
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.
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=309834&r1=309833&r2=309834&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Aug 2 10:19:13 2017
@@ -828,12 +828,14 @@ void DwarfDebug::collectVariableInfoFrom
// Get .debug_loc entry for the instruction range starting at MI.
static DebugLocEntry::Value getDebugLocValue(const MachineInstr *MI) {
const DIExpression *Expr = MI->getDebugExpression();
-
assert(MI->getNumOperands() == 4);
if (MI->getOperand(0).isReg()) {
+ auto RegOp = MI->getOperand(0);
+ auto Op1 = MI->getOperand(1);
// If the second operand is an immediate, this is a
// register-indirect address.
- MachineLocation MLoc(MI->getOperand(0).getReg(), MI->getOperand(1).isImm());
+ assert((!Op1.isImm() || (Op1.getImm() == 0)) && "unexpected offset");
+ MachineLocation MLoc(RegOp.getReg(), Op1.isImm());
return DebugLocEntry::Value(Expr, MLoc);
}
if (MI->getOperand(0).isImm())
More information about the llvm-commits
mailing list