Per-function deduplication.

This commit is contained in:
Daniel Kirchner 2022-12-14 18:20:45 +01:00
parent 4513a3f2f2
commit 96be94fa5e

View File

@ -408,10 +408,10 @@ map<u256, u256> const& Assembly::optimiseInternal(
}
// This only modifies PushTags, we have to run again to actually remove code.
// TODO: investigate options for EOF.
if (_settings.runDeduplicate && !m_eofVersion.has_value())
if (_settings.runDeduplicate)
for (auto& section: m_codeSections)
{
BlockDeduplicator deduplicator{m_codeSections.front().items};
BlockDeduplicator deduplicator{section.items};
if (deduplicator.deduplicate())
{
for (auto const& replacement: deduplicator.replacedTags())