mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Per-function deduplication.
This commit is contained in:
parent
5b9e4c47a3
commit
e032af795e
@ -408,31 +408,31 @@ map<u256, u256> const& Assembly::optimiseInternal(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This only modifies PushTags, we have to run again to actually remove code.
|
// This only modifies PushTags, we have to run again to actually remove code.
|
||||||
// TODO: investigate options for EOF.
|
if (_settings.runDeduplicate)
|
||||||
if (_settings.runDeduplicate && !m_eofVersion.has_value())
|
for (auto& section: m_codeSections)
|
||||||
{
|
|
||||||
BlockDeduplicator deduplicator{m_codeSections.front().items};
|
|
||||||
if (deduplicator.deduplicate())
|
|
||||||
{
|
{
|
||||||
for (auto const& replacement: deduplicator.replacedTags())
|
BlockDeduplicator deduplicator{section.items};
|
||||||
|
if (deduplicator.deduplicate())
|
||||||
{
|
{
|
||||||
assertThrow(
|
for (auto const& replacement: deduplicator.replacedTags())
|
||||||
replacement.first <= numeric_limits<size_t>::max() && replacement.second <= numeric_limits<size_t>::max(),
|
{
|
||||||
OptimizerException,
|
assertThrow(
|
||||||
"Invalid tag replacement."
|
replacement.first <= numeric_limits<size_t>::max() && replacement.second <= numeric_limits<size_t>::max(),
|
||||||
);
|
OptimizerException,
|
||||||
assertThrow(
|
"Invalid tag replacement."
|
||||||
!tagReplacements.count(replacement.first),
|
);
|
||||||
OptimizerException,
|
assertThrow(
|
||||||
"Replacement already known."
|
!tagReplacements.count(replacement.first),
|
||||||
);
|
OptimizerException,
|
||||||
tagReplacements[replacement.first] = replacement.second;
|
"Replacement already known."
|
||||||
if (_tagsReferencedFromOutside.erase(static_cast<size_t>(replacement.first)))
|
);
|
||||||
_tagsReferencedFromOutside.insert(static_cast<size_t>(replacement.second));
|
tagReplacements[replacement.first] = replacement.second;
|
||||||
|
if (_tagsReferencedFromOutside.erase(static_cast<size_t>(replacement.first)))
|
||||||
|
_tagsReferencedFromOutside.insert(static_cast<size_t>(replacement.second));
|
||||||
|
}
|
||||||
|
count++;
|
||||||
}
|
}
|
||||||
count++;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: investigate for EOF
|
// TODO: investigate for EOF
|
||||||
if (_settings.runCSE && !m_eofVersion.has_value())
|
if (_settings.runCSE && !m_eofVersion.has_value())
|
||||||
|
Loading…
Reference in New Issue
Block a user