diff options
| author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-10-21 22:13:34 +0000 |
|---|---|---|
| committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-10-21 22:13:34 +0000 |
| commit | 60d87e72536311756dfbc29e2ac7dd5e3a5d6d78 (patch) | |
| tree | 24983e0fbf744269aa1b9fb2e3effe45086a794f /llvm/lib/Bitcode/Writer/ValueEnumerator.cpp | |
| parent | 8a4635224b3ad7ef894b84db07d5ce86da405230 (diff) | |
| download | bcm5719-llvm-60d87e72536311756dfbc29e2ac7dd5e3a5d6d78.tar.gz bcm5719-llvm-60d87e72536311756dfbc29e2ac7dd5e3a5d6d78.zip | |
IR: Remove dead code in metadata bitcode writing, NFC
No one cares how many uses each metadata value has, so don't bother
counting.
llvm-svn: 220337
Diffstat (limited to 'llvm/lib/Bitcode/Writer/ValueEnumerator.cpp')
| -rw-r--r-- | llvm/lib/Bitcode/Writer/ValueEnumerator.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp index 4ed739ebe4a..f2be18e0378 100644 --- a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp +++ b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp @@ -509,12 +509,10 @@ void ValueEnumerator::EnumerateMetadata(const Value *MD) { // Check to see if it's already in! unsigned &MDValueID = MDValueMap[MD]; - if (MDValueID) { - // Increment use count. - MDValues[MDValueID-1].second++; + if (MDValueID) return; - } - MDValues.push_back(std::make_pair(MD, 1U)); + + MDValues.push_back(MD); MDValueID = MDValues.size(); // Enumerate all non-function-local operands. @@ -533,12 +531,10 @@ void ValueEnumerator::EnumerateFunctionLocalMetadata(const MDNode *N) { // Check to see if it's already in! unsigned &MDValueID = MDValueMap[N]; - if (MDValueID) { - // Increment use count. - MDValues[MDValueID-1].second++; + if (MDValueID) return; - } - MDValues.push_back(std::make_pair(N, 1U)); + + MDValues.push_back(N); MDValueID = MDValues.size(); // To incoroporate function-local information visit all function-local @@ -766,7 +762,7 @@ void ValueEnumerator::purgeFunction() { for (unsigned i = NumModuleValues, e = Values.size(); i != e; ++i) ValueMap.erase(Values[i].first); for (unsigned i = NumModuleMDValues, e = MDValues.size(); i != e; ++i) - MDValueMap.erase(MDValues[i].first); + MDValueMap.erase(MDValues[i]); for (unsigned i = 0, e = BasicBlocks.size(); i != e; ++i) ValueMap.erase(BasicBlocks[i]); |

