[llvm] r234799 - SelectionDAG: Stop using DIVariable::isInlinedFnArgument()

Duncan P. N. Exon Smith dexonsmith at apple.com
Mon Apr 13 14:38:48 PDT 2015


Author: dexonsmith
Date: Mon Apr 13 16:38:48 2015
New Revision: 234799

URL: http://llvm.org/viewvc/llvm-project?rev=234799&view=rev
Log:
SelectionDAG: Stop using DIVariable::isInlinedFnArgument()

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.

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

Modified: llvm/trunk/include/llvm/IR/DebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DebugInfo.h?rev=234799&r1=234798&r2=234799&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/DebugInfo.h (original)
+++ llvm/trunk/include/llvm/IR/DebugInfo.h Mon Apr 13 16:38:48 2015
@@ -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;
 };
 

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=234799&r1=234798&r2=234799&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Mon Apr 13 16:38:48 2015
@@ -4461,8 +4461,10 @@ bool SelectionDAGBuilder::EmitFuncArgume
   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;

Modified: llvm/trunk/lib/IR/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfo.cpp?rev=234799&r1=234798&r2=234799&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DebugInfo.cpp (original)
+++ llvm/trunk/lib/IR/DebugInfo.cpp Mon Apr 13 16:38:48 2015
@@ -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));
 }





More information about the llvm-commits mailing list