aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Bitcode/Writer/BitcodeWriter.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2010-06-02 23:05:04 +0000
committerDevang Patel <dpatel@apple.com>2010-06-02 23:05:04 +0000
commit63b11baa5f0735e5bc2cfc5a93f8e5b3bc3caad8 (patch)
tree834ba2acc95eeea1ba39031a2c266569ca8ade0a /lib/Bitcode/Writer/BitcodeWriter.cpp
parent529a9497d20172f52db11116aae0cd2c5e030c31 (diff)
downloadexternal_llvm-63b11baa5f0735e5bc2cfc5a93f8e5b3bc3caad8.zip
external_llvm-63b11baa5f0735e5bc2cfc5a93f8e5b3bc3caad8.tar.gz
external_llvm-63b11baa5f0735e5bc2cfc5a93f8e5b3bc3caad8.tar.bz2
Speedup bitcode writer. Do not walk all values for all functions to emit function local metadata. In one testcase, probably worst case scenario, the 70x speed up is seen.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105360 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bitcode/Writer/BitcodeWriter.cpp')
-rw-r--r--lib/Bitcode/Writer/BitcodeWriter.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp
index 860b7e9..98d567e 100644
--- a/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -577,10 +577,9 @@ static void WriteFunctionLocalMetadata(const Function &F,
BitstreamWriter &Stream) {
bool StartedMetadataBlock = false;
SmallVector<uint64_t, 64> Record;
- const ValueEnumerator::ValueList &Vals = VE.getMDValues();
-
+ const SmallVector<const MDNode *, 8> &Vals = VE.getFunctionLocalMDValues();
for (unsigned i = 0, e = Vals.size(); i != e; ++i)
- if (const MDNode *N = dyn_cast<MDNode>(Vals[i].first))
+ if (const MDNode *N = Vals[i])
if (N->isFunctionLocal() && N->getFunction() == &F) {
if (!StartedMetadataBlock) {
Stream.EnterSubblock(bitc::METADATA_BLOCK_ID, 3);
@@ -588,7 +587,7 @@ static void WriteFunctionLocalMetadata(const Function &F,
}
WriteMDNode(N, VE, Stream, Record);
}
-
+
if (StartedMetadataBlock)
Stream.ExitBlock();
}