mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-01 15:17:25 +00:00
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
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user