From a6245247e9d0c718fb14230ba6610ee939b030fa Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 3 Apr 2010 02:17:50 +0000 Subject: Add special case bitcode support for DebugLoc. This avoids having the bitcode writer materialize mdnodes for all the debug location tuples when writing out the bc file and stores the information in a more compact form. For example, the -O0 -g bc file for combine.c in 176.gcc shrinks from 739392 to 512096 bytes. This concludes my planned short-term debug info work. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100261 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Bitcode/Writer/ValueEnumerator.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib/Bitcode/Writer/ValueEnumerator.cpp') diff --git a/lib/Bitcode/Writer/ValueEnumerator.cpp b/lib/Bitcode/Writer/ValueEnumerator.cpp index aa4c3afab4..d2baec7705 100644 --- a/lib/Bitcode/Writer/ValueEnumerator.cpp +++ b/lib/Bitcode/Writer/ValueEnumerator.cpp @@ -104,9 +104,16 @@ ValueEnumerator::ValueEnumerator(const Module *M) { // Enumerate metadata attached with this instruction. MDs.clear(); - I->getAllMetadata(MDs); + I->getAllMetadataOtherThanDebugLoc(MDs); for (unsigned i = 0, e = MDs.size(); i != e; ++i) EnumerateMetadata(MDs[i].second); + + if (!I->getDebugLoc().isUnknown()) { + MDNode *Scope, *IA; + I->getDebugLoc().getScopeAndInlinedAt(Scope, IA, I->getContext()); + if (Scope) EnumerateMetadata(Scope); + if (IA) EnumerateMetadata(IA); + } } } -- cgit v1.2.3-18-g5258