llvm-6502/lib/CodeGen/AsmPrinter
David Blaikie eff0c67b6a Recommit r212203: Don't try to construct debug LexicalScopes hierarchy for functions that do not have top level debug information.
Reverted by Eric Christopher (Thanks!) in r212203 after Bob Wilson
reported LTO issues. Duncan Exon Smith and Aditya Nandakumar helped
provide a reduced reproduction, though the failure wasn't too hard to
guess, and even easier with the example to confirm.

The assertion that the subprogram metadata associated with an
llvm::Function matches the scope data referenced by the DbgLocs on the
instructions in that function is not valid under LTO. In LTO, a C++
inline function might exist in multiple CUs and the subprogram metadata
nodes will refer to the same llvm::Function. In this case, depending on
the order of the CUs, the first intance of the subprogram metadata may
not be the one referenced by the instructions in that function and the
assertion will fail.

A test case (test/DebugInfo/cross-cu-linkonce-distinct.ll) is added, the
assertion removed and a comment added to explain this situation.

Original commit message:

If a function isn't actually in a CU's subprogram list in the debug info
metadata, ignore all the DebugLocs and don't try to build scopes, track
variables, etc.

While this is possibly a minor optimization, it's also a correctness fix
for an incoming patch that will add assertions to LexicalScopes and the
debug info verifier to ensure that all scope chains lead to debug info
for the current function.

Fix up a few test cases that had broken/incomplete debug info that could
violate this constraint.

Add a test case where this occurs by design (inlining a
debug-info-having function in an attribute nodebug function - we want
this to work because /if/ the nodebug function is then inlined into a
debug-info-having function, it should be fine (and will work fine - we
just stitch the scopes up as usual), but should the inlining not happen
we need to not assert fail either).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212649 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-09 21:02:41 +00:00
..
AddressPool.cpp DWARF Type Units: Avoid emitting type units under fission if the type requires an address. 2014-04-26 17:27:38 +00:00
AddressPool.h AddressPool::HasBeenUsed: Add comment explaining the use-case for this flag. 2014-04-28 22:52:50 +00:00
ARMException.cpp CodeGen: refactor DwarfException 2014-06-11 01:19:03 +00:00
AsmPrinter.cpp Fix ppcf128 component access on little-endian systems 2014-07-03 15:06:47 +00:00
AsmPrinterDwarf.cpp Clarify the doxygen comment for AsmPrinter::EmitDwarfRegOpPiece and add 2014-04-27 18:50:45 +00:00
AsmPrinterHandler.h Remove weak vtables. No functional change. 2013-12-14 12:23:14 +00:00
AsmPrinterInlineAsm.cpp Revert "Introduce a string_ostream string builder facilty" 2014-06-26 22:52:05 +00:00
ByteStreamer.h [C++11] Add 'override' keyword to virtual methods that override their base class. 2014-03-08 06:31:39 +00:00
CMakeLists.txt CodeGen: refactor DwarfException 2014-06-11 01:19:03 +00:00
DbgValueHistoryCalculator.cpp Generate better location ranges for some register-described variables. 2014-06-09 21:53:47 +00:00
DbgValueHistoryCalculator.h Change representation of instruction ranges where variable is accessible. 2014-05-27 23:09:50 +00:00
DebugLocEntry.h [C++] Use 'nullptr'. 2014-04-28 04:05:08 +00:00
DebugLocList.h DebugInfo: Introduce DebugLocList to encapsulate a list of DebugLocEntries and an MC Label to refer to them 2014-04-02 01:43:18 +00:00
DIE.cpp DIEEntry: Refer to the specified DIE via reference rather than pointer. 2014-04-25 19:33:43 +00:00
DIE.h DIE: Document some learnings about why the world isn't perfect. 2014-04-28 22:41:39 +00:00
DIEHash.cpp DIEEntry: Refer to the specified DIE via reference rather than pointer. 2014-04-25 19:33:43 +00:00
DIEHash.h [C++] Use 'nullptr'. 2014-04-24 06:44:33 +00:00
DwarfAccelTable.cpp DwarfAccelTable: Store the string symbol in the accelerator table to avoid duplicate lookup. 2014-04-25 22:21:35 +00:00
DwarfAccelTable.h Remove redundant explicit default initialization of non-trivially constructed member. 2014-04-27 14:47:23 +00:00
DwarfCFIException.cpp Print a=b as an assignment. 2014-06-24 22:45:16 +00:00
DwarfDebug.cpp Recommit r212203: Don't try to construct debug LexicalScopes hierarchy for functions that do not have top level debug information. 2014-07-09 21:02:41 +00:00
DwarfDebug.h Recommit r212203: Don't try to construct debug LexicalScopes hierarchy for functions that do not have top level debug information. 2014-07-09 21:02:41 +00:00
DwarfException.h CodeGen: refactor DwarfException 2014-06-11 01:19:03 +00:00
DwarfFile.cpp Encapsulate the DWARF string pool in a separate type. 2014-04-25 21:34:35 +00:00
DwarfFile.h Encapsulate the DWARF string pool in a separate type. 2014-04-25 21:34:35 +00:00
DwarfStringPool.cpp Make helper functions static. 2014-04-27 14:54:59 +00:00
DwarfStringPool.h Encapsulate the DWARF string pool in a separate type. 2014-04-25 21:34:35 +00:00
DwarfUnit.cpp DebugInfo: Following up to r209677, refactor local variable emission to delay the choice between emitting the definition attributes or using DW_AT_abstract_definition 2014-06-13 22:18:23 +00:00
DwarfUnit.h DebugInfo: Following up to r209677, refactor local variable emission to delay the choice between emitting the definition attributes or using DW_AT_abstract_definition 2014-06-13 22:18:23 +00:00
EHStreamer.cpp CodeGen: refactor DwarfException 2014-06-11 01:19:03 +00:00
EHStreamer.h CodeGen: refactor DwarfException 2014-06-11 01:19:03 +00:00
ErlangGCPrinter.cpp [C++11] Add 'override' keyword to virtual methods that override their base class. 2014-03-08 06:31:39 +00:00
LLVMBuild.txt Add proper dependencies to LLVMBuild.txt in llvm/lib. 2013-12-10 05:39:34 +00:00
Makefile
OcamlGCPrinter.cpp [C++11] Add 'override' keyword to virtual methods that override their base class. 2014-03-08 06:31:39 +00:00
Win64Exception.cpp MC: rename EmitWin64EH routines 2014-06-29 01:52:01 +00:00
WinCodeViewLineTables.cpp The count() function for STL datatypes returns unsigned, even where it's 2014-06-20 10:26:56 +00:00
WinCodeViewLineTables.h [C++] Use 'nullptr'. 2014-04-28 04:05:08 +00:00