[Feature Request] Implement "eager pushes" optimization #15339
Labels
compiler-v2
enhancement
New feature or request
stale-exempt
Prevents issues from being automatically marked and closed as stale
🚀 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/
.The text was updated successfully, but these errors were encountered: