Rematerialize zero literals

This commit is contained in:
Nikola Matic
2023-08-07 17:33:16 +02:00
parent 511712570b
commit 96e7b4f46b
195 changed files with 665 additions and 744 deletions
+4
View File
@@ -158,6 +158,10 @@ void CodeCost::operator()(Literal const& _literal)
case LiteralKind::Number:
for (u256 n = u256(_literal.value.str()); n >= 0x100; n >>= 8)
cost++;
if (valueOfLiteral(_literal) == 0)
if (auto evmDialect = dynamic_cast<EVMDialect const*>(&m_dialect))
if (evmDialect->evmVersion().hasPush0())
--m_cost;
break;
case LiteralKind::String:
cost = _literal.value.str().size();