llvm-project/llvm/unittests
Peter Collingbourne 21521891a2 IR: Allow metadata attachments on declarations, and fix lazy loaded metadata issue with globals.
This change is motivated by an upcoming change to the metadata representation
used for CFI. The indirect function call checker needs type information for
external function declarations in order to correctly generate jump table
entries for such declarations. We currently associate such type information
with declarations using a global metadata node, but I plan [1] to move all
such metadata to global object attachments.

In bitcode, metadata attachments for function declarations appear in the
global metadata block. This seems reasonable to me because I expect metadata
attachments on declarations to be uncommon. In the long term I'd also expect
this to be the case for CFI, because we'd want to use some specialized bitcode
format for this metadata that could be read as part of the ThinLTO thin-link
phase, which would mean that it would not appear in the global metadata block.

To solve the lazy loaded metadata issue I was seeing with D20147, I use the
same bitcode representation for metadata attachments for global variables as I
do for function declarations. Since there's a use case for metadata attachments
in the global metadata block, we might as well use that representation for
global variables as well, at least until we have a mechanism for lazy loading
global variables.

In the assembly format, the metadata attachments appear after the "declare"
keyword in order to avoid a parsing ambiguity.

[1] http://lists.llvm.org/pipermail/llvm-dev/2016-June/100462.html

Differential Revision: http://reviews.llvm.org/D21052

llvm-svn: 273336
2016-06-21 23:42:48 +00:00
..
ADT Fix BitVector move ctor/assignment. 2016-06-16 21:45:13 +00:00
Analysis [PM] Run clang-format over various parts of the new pass manager code 2016-06-17 07:15:29 +00:00
AsmParser Remove every uses of getGlobalContext() in LLVM (but the C API) 2016-04-14 21:59:01 +00:00
Bitcode Remove every uses of getGlobalContext() in LLVM (but the C API) 2016-04-14 21:59:01 +00:00
CodeGen Remove autoconf support 2016-01-26 21:29:08 +00:00
DebugInfo DebugInfoPDBTests:MappedBlockStreamTest.TestWriteThenRead: Avoid assigning temporary object to ArrayRef. 2016-06-11 06:37:28 +00:00
ExecutionEngine [Orc] Add conversion to/from RuntimeDyld::SymbolInfo for JITSymbol. 2016-05-31 23:14:26 +00:00
IR IR: Allow metadata attachments on declarations, and fix lazy loaded metadata issue with globals. 2016-06-21 23:42:48 +00:00
LineEditor Remove autoconf support 2016-01-26 21:29:08 +00:00
Linker Delete the deprecated LLVMLinkModules. 2016-02-12 15:28:45 +00:00
MC Move ObjectYAML code to a new library. 2016-03-01 19:15:06 +00:00
MI LiveIntervalAnalysis: findLastUseBefore() must ignore undef uses. 2016-06-11 00:31:28 +00:00
ObjectYAML Move ObjectYAML code to a new library. 2016-03-01 19:15:06 +00:00
Option Option parser: class for consuming a joined arg in addition to all remaining args 2016-04-15 00:23:30 +00:00
ProfileData Remove specializations of ProfileSummary 2016-05-19 21:53:28 +00:00
Support Switch to using an API that handles non-ASCII paths appropriately on Windows. 2016-06-21 14:24:48 +00:00
Transforms Add MemoryAccess creation and PHI creation APIs to MemorySSA 2016-06-21 18:39:20 +00:00
CMakeLists.txt Move ObjectYAML code to a new library. 2016-03-01 19:15:06 +00:00