[TM-377] Optimize packing of a constant
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
Stylistic guide (mandatory)
-
My commits comply with the following policy. -
My code complies with the style guide.