summaryrefslogtreecommitdiff
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
commit6209869f83979319e2e5791382f09b83e54191e0 (patch)
tree834ba2acc95eeea1ba39031a2c266569ca8ade0a /lib/Bitcode/Writer/BitcodeWriter.cpp
parent05c68374c1c73599a0b7044ad09fb4827d128ec5 (diff)
downloadllvm-6209869f83979319e2e5791382f09b83e54191e0.tar.gz
llvm-6209869f83979319e2e5791382f09b83e54191e0.tar.bz2
llvm-6209869f83979319e2e5791382f09b83e54191e0.tar.xz
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 860b7e9a68..98d567e767 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();
}