Skip to content

[TM-377] Optimize packing of a constant

Ivan Gromakovskii requested to merge gromak/tm377-optimize-push-pack into master

Description

Problem: there is one more optimization that our optimizer doesn't do: if a contract has PUSH instruction followed by PACK, it can replaced by a single PUSH that pushes the packed value.

Solution: add such a rule to the optimizer. Make it disabled by default because it seems to be potentially dangerous: instruction processing functions may treat constants somewhat specially and changing them to other constants may break such processing functions.

Related issue(s)

https://issues.serokell.io/issue/TM-377

Checklist for your Merge Request

Related changes (conditional)

  • Tests (see short guidelines)

    • If I added new functionality, I added tests covering it.
    • If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
  • Documentation

    • I checked whether I should update the docs and did so if necessary:

Stylistic guide (mandatory)

Merge request reports