diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-01-12 22:30:34 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-01-12 22:30:34 +0000 |
commit | 2fcf60e78efde7b9766bb58dd2fcf0b5773d75ee (patch) | |
tree | cb985c1de12e0e8392046c335bbbe32746e5b8fd /llvm/lib/Bitcode/Writer/ValueEnumerator.cpp | |
parent | 0b31dd1d67c0bb68db6f868a2330b61c7a162c71 (diff) | |
download | llvm-2fcf60e78efde7b9766bb58dd2fcf0b5773d75ee.zip llvm-2fcf60e78efde7b9766bb58dd2fcf0b5773d75ee.tar.gz llvm-2fcf60e78efde7b9766bb58dd2fcf0b5773d75ee.tar.bz2 |
Bitcode: Simplify emission of METADATA_BLOCK
Refactor logic so that we know up-front whether to open a block and
whether we need an MDString abbreviation.
This is almost NFC, but will start emitting `MDString` abbreviations
when the first record is not an `MDString`.
llvm-svn: 225712
Diffstat (limited to 'llvm/lib/Bitcode/Writer/ValueEnumerator.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Writer/ValueEnumerator.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp index 2c0fdc0..b117d7bb 100644 --- a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp +++ b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp @@ -282,7 +282,7 @@ static bool isIntOrIntVectorValue(const std::pair<const Value*, unsigned> &V) { return V.first->getType()->isIntOrIntVectorTy(); } -ValueEnumerator::ValueEnumerator(const Module &M) { +ValueEnumerator::ValueEnumerator(const Module &M) : HasMDString(false) { if (shouldPreserveBitcodeUseListOrder()) UseListOrders = predictUseListOrder(M); @@ -546,6 +546,8 @@ void ValueEnumerator::EnumerateMetadata(const Metadata *MD) { else if (auto *C = dyn_cast<ConstantAsMetadata>(MD)) EnumerateValue(C->getValue()); + HasMDString |= isa<MDString>(MD); + // Replace the dummy ID inserted above with the correct one. MDValueMap may // have changed by inserting operands, so we need a fresh lookup here. MDs.push_back(MD); |