SelectionDAG: Stop using DIVariable::isInlinedFnArgument()
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Mon, 13 Apr 2015 21:38:48 +0000 (21:38 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Mon, 13 Apr 2015 21:38:48 +0000 (21:38 +0000)
Instead of calling the somewhat confusingly-named
`DIVariable::isInlinedFnArgument()`, do the check directly here.
There's possibly a small functionality change here: instead of
`dyn_cast<>`'ing `DV->getScope()` to `MDSubprogram`, I'm looking up the
scope chain for the actual subprogram.  I suspect that this is a no-op
for function arguments so in practise there isn't a real difference.

I've also added a `FIXME` to check the `inlinedAt:` chain instead, since
I wonder if that would be more reliable than the
`MDSubprogram::describes()` function.

Since this was the only user of `DIVariable::isInlinedFnArgument()`,
delete it.

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

include/llvm/IR/DebugInfo.h
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
lib/IR/DebugInfo.cpp

index f0832325e3c0635660cd53df3ca45141545c646d..8592b2cf92261d7b0fc88cdbca4485a78ca9302c 100644 (file)
@@ -724,9 +724,6 @@ public:
     return (getType().resolve(Map)).isBlockByrefStruct();
   }
 
-  /// \brief Check if this is an inlined function argument.
-  bool isInlinedFnArgument(const Function *CurFn);
-
   void printExtendedName(raw_ostream &OS) const;
 };
 
index bb0d24a6d0bd723804a60435d150b0cfbce37ef9..5c626beff42f362fb389a1aa79ccc0e9f12400c0 100644 (file)
@@ -4461,8 +4461,10 @@ bool SelectionDAGBuilder::EmitFuncArgumentDbgValue(
   const TargetInstrInfo *TII = DAG.getSubtarget().getInstrInfo();
 
   // Ignore inlined function arguments here.
+  //
+  // FIXME: Should we be checking DL->inlinedAt() to determine this?
   DIVariable DV(Variable);
-  if (DV.isInlinedFnArgument(MF.getFunction()))
+  if (!DV->getScope()->getSubprogram()->describes(MF.getFunction()))
     return false;
 
   Optional<MachineOperand> Op;
index 20467c93adb70759eed39dfbe833d05746667d7b..fc302010b6e316d2f8beaf679c1a1efbd1fcea7f 100644 (file)
@@ -39,16 +39,6 @@ using namespace llvm::dwarf;
 
 DIScopeRef DIScope::getRef() const { return MDScopeRef::get(get()); }
 
-bool DIVariable::isInlinedFnArgument(const Function *CurFn) {
-  assert(CurFn && "Invalid function");
-  DISubprogram SP = dyn_cast<MDSubprogram>(getContext());
-  if (!SP)
-    return false;
-  // This variable is not inlined function argument if its scope
-  // does not describe current function.
-  return !SP.describes(CurFn);
-}
-
 void DICompileUnit::replaceSubprograms(DIArray Subprograms) {
   get()->replaceSubprograms(MDSubprogramArray(Subprograms));
 }