-
-
Notifications
You must be signed in to change notification settings - Fork 819
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix[venom]: liveness analysis in some loops (#3732)
fixes a small issue with the calculation of liveness when variables are consumed inside of loops by refactoring the liveness calculation algorithm to an iterative version over the recursive one additional QOL refactoring: - simplify convert_ir_basicblock - rename it to ir_node_to_venom - fix bb well-formedness for deploy ir - don't do deploy IR detection; rely on caller in CompilerData to call for both deploy and runtime IR - remove findIRnode, it's no longer needed - rename _convert_ir_basicblock to _convert_ir_bb - add _convert_ir_bb_list helper to handle arglists --------- Co-authored-by: Charles Cooper <[email protected]>
- Loading branch information
1 parent
81c6d8e
commit c42b077
Showing
7 changed files
with
162 additions
and
153 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
tests/unit/compiler/venom/test_convert_basicblock_simple.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
from vyper.codegen.ir_node import IRnode | ||
from vyper.venom.ir_node_to_venom import ir_node_to_venom | ||
|
||
|
||
def test_simple(): | ||
ir = IRnode.from_list(["calldatacopy", 32, 0, ["calldatasize"]]) | ||
ir_node = IRnode.from_list(ir) | ||
venom = ir_node_to_venom(ir_node) | ||
assert venom is not None | ||
|
||
bb = venom.basic_blocks[0] | ||
assert bb.instructions[0].opcode == "calldatasize" | ||
assert bb.instructions[1].opcode == "calldatacopy" | ||
|
||
|
||
def test_simple_2(): | ||
ir = [ | ||
"seq", | ||
[ | ||
"seq", | ||
[ | ||
"mstore", | ||
["add", 64, 0], | ||
[ | ||
"with", | ||
"x", | ||
["calldataload", ["add", 4, 0]], | ||
[ | ||
"with", | ||
"ans", | ||
["add", "x", 1], | ||
["seq", ["assert", ["ge", "ans", "x"]], "ans"], | ||
], | ||
], | ||
], | ||
], | ||
32, | ||
] | ||
ir_node = IRnode.from_list(ir) | ||
venom = ir_node_to_venom(ir_node) | ||
assert venom is not None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.