[llvm] r214761 - Reapply "DebugInfo: Ensure that all debug location scope chains from instructions within a function, lead to the function itself."

Reid Kleckner rnk at google.com
Wed Aug 6 13:44:12 PDT 2014


On Mon, Aug 4, 2014 at 12:30 PM, David Blaikie <dblaikie at gmail.com> wrote:

> Author: dblaikie
> Date: Mon Aug  4 14:30:08 2014
> New Revision: 214761
>
> URL: http://llvm.org/viewvc/llvm-project?rev=214761&view=rev
> Log:
> Reapply "DebugInfo: Ensure that all debug location scope chains from
> instructions within a function, lead to the function itself."
>
> Originally reverted in r213432 with flakey failures on an ASan self-host
> build. After reduction it seems to be the same issue fixed in r213805
> (ArgPromo + DebugInfo: Handle updating debug info over multiple
> applications of argument promotion) and r213952 (by having
> LiveDebugVariables strip dbg_value intrinsics in functions that are not
> described by debug info). Though I cannot explain why this failure was
> flakey...
>
> Modified:
>     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
>     llvm/trunk/lib/CodeGen/LexicalScopes.cpp
>     llvm/trunk/lib/IR/DebugInfo.cpp
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=214761&r1=214760&r2=214761&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Mon Aug  4 14:30:08
> 2014
> @@ -796,8 +796,7 @@ void DwarfDebug::finishVariableDefinitio
>    for (const auto &Var : ConcreteVariables) {
>      DIE *VariableDie = Var->getDIE();
>      // FIXME: There shouldn't be any variables without DIEs.
> -    if (!VariableDie)
> -      continue;
> +    assert(VariableDie);
>      // FIXME: Consider the time-space tradeoff of just storing the unit
> pointer
>      // in the ConcreteVariables list, rather than looking it up again
> here.
>      // DIE::getUnit isn't simple - it walks parent pointers, etc.
>
> Modified: llvm/trunk/lib/CodeGen/LexicalScopes.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LexicalScopes.cpp?rev=214761&r1=214760&r2=214761&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/LexicalScopes.cpp (original)
> +++ llvm/trunk/lib/CodeGen/LexicalScopes.cpp Mon Aug  4 14:30:08 2014
> @@ -137,6 +137,8 @@ LexicalScope *LexicalScopes::findLexical
>  /// getOrCreateLexicalScope - Find lexical scope for the given DebugLoc.
> If
>  /// not available then create new lexical scope.
>  LexicalScope *LexicalScopes::getOrCreateLexicalScope(DebugLoc DL) {
> +  if (DL.isUnknown())
> +    return nullptr;
>    MDNode *Scope = nullptr;
>    MDNode *InlinedAt = nullptr;
>    DL.getScopeAndInlinedAt(Scope, InlinedAt,
> MF->getFunction()->getContext());
> @@ -172,9 +174,12 @@ LexicalScope *LexicalScopes::getOrCreate
>                                std::make_tuple(Parent, DIDescriptor(Scope),
>                                                nullptr, false)).first;
>
> -  if (!Parent && DIDescriptor(Scope).isSubprogram() &&
> -      DISubprogram(Scope).describes(MF->getFunction()))
> +  if (!Parent) {
> +    assert(DIDescriptor(Scope).isSubprogram());
> +    assert(DISubprogram(Scope).describes(MF->getFunction()));
>

^ This assertion is failing during a self-host on Windows that uses -gmlt.
I'll post a .ii file soon.


> +    assert(!CurrentFnLexicalScope);
>      CurrentFnLexicalScope = &I->second;
> +  }
>
>    return &I->second;
>  }
>
> Modified: llvm/trunk/lib/IR/DebugInfo.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfo.cpp?rev=214761&r1=214760&r2=214761&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/IR/DebugInfo.cpp (original)
> +++ llvm/trunk/lib/IR/DebugInfo.cpp Mon Aug  4 14:30:08 2014
> @@ -560,6 +560,32 @@ bool DISubprogram::Verify() const {
>    if (isLValueReference() && isRValueReference())
>      return false;
>
> +  if (auto *F = getFunction()) {
> +    LLVMContext &Ctxt = F->getContext();
> +    for (auto &BB : *F) {
> +      for (auto &I : BB) {
> +        DebugLoc DL = I.getDebugLoc();
> +        if (DL.isUnknown())
> +          continue;
> +
> +        MDNode *Scope = nullptr;
> +        MDNode *IA = nullptr;
> +        // walk the inlined-at scopes
> +        while (DL.getScopeAndInlinedAt(Scope, IA, F->getContext()), IA)
> +          DL = DebugLoc::getFromDILocation(IA);
> +        DL.getScopeAndInlinedAt(Scope, IA, Ctxt);
> +        assert(!IA);
> +        while (!DIDescriptor(Scope).isSubprogram()) {
> +          DILexicalBlockFile D(Scope);
> +          Scope = D.isLexicalBlockFile()
> +                      ? D.getScope()
> +                      :
> DebugLoc::getFromDILexicalBlock(Scope).getScope(Ctxt);
> +        }
> +        if (!DISubprogram(Scope).describes(F))
> +          return false;
> +      }
> +    }
> +  }
>    return DbgNode->getNumOperands() == 20;
>  }
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140806/c2faf099/attachment.html>


More information about the llvm-commits mailing list