summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2016-04-02 15:22:57 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2016-04-02 15:22:57 +0000
commit520f8542fffc9bc1dae1f866782db867da2e6c39 (patch)
treec2fbe46c901c0034c5c02ca63b15ba92b5acff85 /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
parent0b76b723f425a999688625f3d9271eb26ef9ee2f (diff)
downloadbcm5719-llvm-520f8542fffc9bc1dae1f866782db867da2e6c39.tar.gz
bcm5719-llvm-520f8542fffc9bc1dae1f866782db867da2e6c39.zip
Bitcode: Try to emit metadata in function blocks
Whenever metadata is only referenced by a single function, emit the metadata just in that function block. This should improve lazy-loading by reducing the amount of metadata in the global block. For now, this should catch all DILocations, and anything else that happens to be referenced only by a single function. It's also a first step toward a couple of possible future directions (which this commit does *not* implement): 1. Some debug info metadata is only referenced from compile units and individual functions. If we can drop the link from the compile unit, this optimization will get more powerful. 2. Any uniqued metadata that isn't referenced globally can in theory be emitted in every function block that references it (trading off bitcode size and full-parse time vs. lazy-load time). Note: this assumes the new BitcodeReader error checking from r265223. The metadata stored in function blocks gets purged after parsing each function, which means unresolved forward references will get lost. Since all the global metadata should have already been resolved by the time we get to the function metadata blocks we just need to check for that case. (If for some reason we need to handle bitcode that fails the checks in r265223, the fix is to store about-to-be-dropped unresolved nodes in MetadataList::shrinkTo until they can be handled succesfully by a future call to MetadataList::tryToResolveCycles.) llvm-svn: 265226
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
-rw-r--r--llvm/lib/Bitcode/Writer/BitcodeWriter.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index 26f0ac65884..eb448c03767 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -1447,8 +1447,7 @@ static void writeFunctionMetadata(const Function &F, const ValueEnumerator &VE,
Stream.EnterSubblock(bitc::METADATA_BLOCK_ID, 3);
SmallVector<uint64_t, 64> Record;
- assert(VE.getMDStrings().empty() &&
- "Unexpected strings at the function-level");
+ writeMetadataStrings(VE.getMDStrings(), Stream, Record);
writeMetadataRecords(VE.getNonMDStrings(), VE, Stream, Record);
Stream.ExitBlock();
}
OpenPOWER on IntegriCloud