mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-25 21:18:19 +00:00
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`. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225712 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user