Aptos is a layer 1 blockchain built to support the widespread use of blockchain through better technology and user experience.
6.19k
stars
3.66k
forks
source link
[Feature Request] Implement "eager pushes" optimization #15339
Open
vineethk opened 5 days ago
🚀 Feature Request
As an analogue to the flush writes optimization (https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/move-compiler-v2/src/pipeline/flush_writes_processor.rs#L4), implement an "eager pushes" optimization which identifies cases where eagerly pushing a value onto the stack (safely) will result in fewer
StLoc-MovLoc
pairs later.For example, compiling the code below with compiler v2:
Will result in the following bytecode for the function
foo
:Of particular interest is the basic block
B1
, where instructions numbered 5, 7, 8, 9 can be deleted without affecting the semantics.This example and several others reduced from the framework are part of the tests in
third_party/move/move-compiler-v2/tests/eager-pushes/
.