diff options
author | David Blaikie <dblaikie@gmail.com> | 2014-08-07 22:22:49 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2014-08-07 22:22:49 +0000 |
commit | 09fdfabddafc1c2353772034cfd4af1f6ad08178 (patch) | |
tree | 41a39b8c41f007709cb5c8a46ab7c48b6557f266 /llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | |
parent | 3668534f92a539ae68220ad2fd3f99e5f128d9be (diff) | |
download | bcm5719-llvm-09fdfabddafc1c2353772034cfd4af1f6ad08178.tar.gz bcm5719-llvm-09fdfabddafc1c2353772034cfd4af1f6ad08178.zip |
DebugInfo: Fix overwriting/loss of inlined arguments to recursively inlined functions.
Due to an unnecessary special case, inlined arguments that happened to
be from the same function as they were inlined into were misclassified
as non-inline arguments and would overwrite the non-inlined arguments.
Assert that we never overwrite a function's arguments, and stop
misclassifying inlined arguments as non-inline arguments to fix this
issue.
Excuse the rather crappy test case - handcrafted IR might do better, or
someone who understands better how to tickle the inliner to create a
recursive inlining situation like this (though it may also be necessary
to tickle the variable in a particular way to cause it to be recorded in
the MMI side table and go down this particular path for location
information).
llvm-svn: 215157
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index a0d58c6310c..7150a09cd4c 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1144,6 +1144,7 @@ bool DwarfDebug::addCurrentFnArgument(DbgVariable *Var, LexicalScope *Scope) { // arguments does the function have at source level. if (ArgNo > Size) CurrentFnArguments.resize(ArgNo * 2); + assert(!CurrentFnArguments[ArgNo - 1]); CurrentFnArguments[ArgNo - 1] = Var; return true; } @@ -1309,10 +1310,7 @@ DwarfDebug::collectVariableInfo(SmallPtrSet<const MDNode *, 16> &Processed) { continue; LexicalScope *Scope = nullptr; - if (DV.getTag() == dwarf::DW_TAG_arg_variable && - DISubprogram(DV.getContext()).describes(CurFn->getFunction())) - Scope = LScopes.getCurrentFunctionScope(); - else if (MDNode *IA = DV.getInlinedAt()) { + if (MDNode *IA = DV.getInlinedAt()) { DebugLoc DL = DebugLoc::getFromDILocation(IA); Scope = LScopes.findInlinedScope(DebugLoc::get( DL.getLine(), DL.getCol(), DV.getContext(), IA)); |