AsmPrinter: Simplify logic for debug info intrinsics' !dbg attachments
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Thu, 16 Apr 2015 22:12:59 +0000 (22:12 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Thu, 16 Apr 2015 22:12:59 +0000 (22:12 +0000)
These are required, so just assume they're there.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235138 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp
lib/CodeGen/AsmPrinter/DwarfDebug.cpp
lib/CodeGen/AsmPrinter/DwarfDebug.h

index af8827cec290b99ba0049f3456f7bf04c14b61b7..1e3c5d769f15071fcaefa19375a173bbc1433050 100644 (file)
@@ -207,10 +207,7 @@ void llvm::calculateDbgValueHistory(const MachineFunction *MF,
       MDLocalVariable *RawVar = MI.getDebugVariable();
       assert(RawVar->isValidLocationForIntrinsic(MI.getDebugLoc()) &&
              "Expected inlined-at fields to agree");
       MDLocalVariable *RawVar = MI.getDebugVariable();
       assert(RawVar->isValidLocationForIntrinsic(MI.getDebugLoc()) &&
              "Expected inlined-at fields to agree");
-      MDLocation *IA = nullptr;
-      if (MDLocation *Loc = MI.getDebugLoc())
-        IA = Loc->getInlinedAt();
-      InlinedVariable Var(RawVar, IA);
+      InlinedVariable Var(RawVar, MI.getDebugLoc()->getInlinedAt());
 
       if (unsigned PrevReg = Result.getRegisterForVar(Var))
         dropRegDescribedVar(RegVars, PrevReg, Var);
 
       if (unsigned PrevReg = Result.getRegisterForVar(Var))
         dropRegDescribedVar(RegVars, PrevReg, Var);
index 97c9855fe14eec1aa1ea27760b3689c1b19749dc..fb8fc6e7545e74ffe06cf9925c459a64f1e4c20b 100644 (file)
@@ -711,7 +711,10 @@ void DwarfDebug::collectVariableInfoFromMMITable(
   for (const auto &VI : MMI->getVariableDbgInfo()) {
     if (!VI.Var)
       continue;
   for (const auto &VI : MMI->getVariableDbgInfo()) {
     if (!VI.Var)
       continue;
-    InlinedVariable Var(VI.Var, VI.Loc ? VI.Loc->getInlinedAt() : nullptr);
+    assert(VI.Var->isValidLocationForIntrinsic(VI.Loc) &&
+           "Expected inlined-at fields to agree");
+
+    InlinedVariable Var(VI.Var, VI.Loc->getInlinedAt());
     Processed.insert(Var);
     LexicalScope *Scope = LScopes.findLexicalScope(VI.Loc);
 
     Processed.insert(Var);
     LexicalScope *Scope = LScopes.findLexicalScope(VI.Loc);
 
@@ -719,8 +722,6 @@ void DwarfDebug::collectVariableInfoFromMMITable(
     if (!Scope)
       continue;
 
     if (!Scope)
       continue;
 
-    assert(VI.Var->isValidLocationForIntrinsic(VI.Loc) &&
-           "Expected inlined-at fields to agree");
     DIExpression Expr = cast_or_null<MDExpression>(VI.Expr);
     ensureAbstractVariableIsCreatedIfScoped(Var, Scope->getScopeNode());
     auto RegVar =
     DIExpression Expr = cast_or_null<MDExpression>(VI.Expr);
     ensureAbstractVariableIsCreatedIfScoped(Var, Scope->getScopeNode());
     auto RegVar =
index 809e7bdde10b9def00413d6d89362a03ce743948..e067f41904c29b10c84d1ff6111d4994645e233a 100644 (file)
@@ -98,13 +98,10 @@ public:
   /// AbstractVar may be NULL.
   DbgVariable(const MachineInstr *DbgValue, DwarfDebug *DD)
       : Var(DbgValue->getDebugVariable()),
   /// AbstractVar may be NULL.
   DbgVariable(const MachineInstr *DbgValue, DwarfDebug *DD)
       : Var(DbgValue->getDebugVariable()),
-        IA(DbgValue->getDebugLoc() ? DbgValue->getDebugLoc()->getInlinedAt()
-                                   : nullptr),
+        IA(DbgValue->getDebugLoc()->getInlinedAt()),
         Expr(1, DbgValue->getDebugExpression()), TheDIE(nullptr),
         DotDebugLocOffset(~0U), MInsn(DbgValue), DD(DD) {
     FrameIndex.push_back(~0);
         Expr(1, DbgValue->getDebugExpression()), TheDIE(nullptr),
         DotDebugLocOffset(~0U), MInsn(DbgValue), DD(DD) {
     FrameIndex.push_back(~0);
-    if (MDLocation *Loc = DbgValue->getDebugLoc())
-      IA = Loc->getInlinedAt();
   }
 
   // Accessors.
   }
 
   // Accessors.