forked from vyperlang/vyper
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into refactor/effects-analysis
- Loading branch information
Showing
18 changed files
with
282 additions
and
116 deletions.
There are no files selected for viewing
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
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,33 @@ | ||
from vyper.venom import generate_assembly_experimental | ||
from vyper.venom.analysis.analysis import IRAnalysesCache | ||
from vyper.venom.context import IRContext | ||
from vyper.venom.passes.store_expansion import StoreExpansionPass | ||
|
||
|
||
def test_stack_reorder(): | ||
""" | ||
Test to was created from the example in the | ||
issue https://github.com/vyperlang/vyper/issues/4215 | ||
this example should fail with original stack reorder | ||
algorithm but succeed with new one | ||
""" | ||
ctx = IRContext() | ||
fn = ctx.create_function("_global") | ||
|
||
bb = fn.get_basic_block() | ||
var0 = bb.append_instruction("store", 1) | ||
var1 = bb.append_instruction("store", 2) | ||
var2 = bb.append_instruction("store", 3) | ||
var3 = bb.append_instruction("store", 4) | ||
var4 = bb.append_instruction("store", 5) | ||
|
||
bb.append_instruction("staticcall", var0, var1, var2, var3, var4, var3) | ||
|
||
ret_val = bb.append_instruction("add", var4, var4) | ||
|
||
bb.append_instruction("ret", ret_val) | ||
|
||
ac = IRAnalysesCache(fn) | ||
StoreExpansionPass(ac, fn).run_pass() | ||
|
||
generate_assembly_experimental(ctx) |
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.