summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-04-03 19:20:26 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-04-03 19:20:26 +0000
commit3bef6a380300986f61ba74be3b255a9d3cb6cd9f (patch)
tree2065d428270397eea0f2d0a8b18bf5bc0853ac12 /llvm/lib/CodeGen/AsmPrinter
parent7759f1899e5a1b3295c3c394d60f8929add272e3 (diff)
downloadbcm5719-llvm-3bef6a380300986f61ba74be3b255a9d3cb6cd9f.tar.gz
bcm5719-llvm-3bef6a380300986f61ba74be3b255a9d3cb6cd9f.zip
CodeGen: Assert that inlined-at locations agree
As a follow-up to r234021, assert that a debug info intrinsic variable's `MDLocalVariable::getInlinedAt()` always matches the `MDLocation::getInlinedAt()` of its `!dbg` attachment. The goal here is to get rid of `MDLocalVariable::getInlinedAt()` entirely (PR22778), but I'll let these assertions bake for a while first. If you have an out-of-tree backend that just broke, you're probably attaching the wrong `DebugLoc` to a `DBG_VALUE` instruction. The one you want is the location that was attached to the corresponding `@llvm.dbg.declare` or `@llvm.dbg.value` call that you started with. llvm-svn: 234038
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp2
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp2
2 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp b/llvm/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp
index bbdf2378f6e..24cfb361a9f 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp
@@ -204,6 +204,8 @@ void llvm::calculateDbgValueHistory(const MachineFunction *MF,
// as index into History. The full variables including the
// piece expressions are attached to the MI.
DIVariable Var = MI.getDebugVariable();
+ assert(Var->isValidLocationForIntrinsic(MI.getDebugLoc()) &&
+ "Expected inlined-at fields to agree");
if (unsigned PrevReg = Result.getRegisterForVar(Var))
dropRegDescribedVar(RegVars, PrevReg, Var);
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 00bd0ec660a..6927f2c0870 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -734,6 +734,8 @@ void DwarfDebug::collectVariableInfoFromMMITable(
continue;
DIVariable DV(VI.Var);
+ assert(DV->isValidLocationForIntrinsic(VI.Loc) &&
+ "Expected inlined-at fields to agree");
DIExpression Expr(VI.Expr);
ensureAbstractVariableIsCreatedIfScoped(DV, Scope->getScopeNode());
auto RegVar = make_unique<DbgVariable>(DV, Expr, this, VI.Slot);
OpenPOWER on IntegriCloud