-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Don't inline TEAL blocks with a single predecessor when their la…
…bel is referenced multiple times. This issue could occur when there is a default fall through block in a switch or match scenario, which is also targeted by said op, and would cause a compilation failure.
- Loading branch information
Showing
7 changed files
with
547 additions
and
39 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
57 changes: 57 additions & 0 deletions
57
test_cases/regression_tests/out_O2/TealSwitchInlining.approval.puya.map
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,57 @@ | ||
{ | ||
"version": 3, | ||
"sources": [ | ||
"../teal_switch_inlining.py" | ||
], | ||
"mappings": ";AAUc;;AAAN;;;;;;AAMe;;AAAP;AAEO;;AAAP", | ||
"op_pc_offset": 0, | ||
"pc_events": { | ||
"1": { | ||
"subroutine": "test_cases.regression_tests.teal_switch_inlining.TealSwitchInlining.approval_program", | ||
"params": {}, | ||
"block": "main", | ||
"stack_in": [], | ||
"op": "txn NumAppArgs", | ||
"defined_out": [ | ||
"tmp%0#0" | ||
], | ||
"stack_out": [ | ||
"tmp%0#0" | ||
] | ||
}, | ||
"3": { | ||
"op": "switch main_switch_case_0@1 main_switch_case_1@2", | ||
"stack_out": [] | ||
}, | ||
"9": { | ||
"block": "main_switch_case_0@1", | ||
"stack_in": [], | ||
"op": "pushint 1 // 1", | ||
"defined_out": [ | ||
"1" | ||
], | ||
"stack_out": [ | ||
"1" | ||
] | ||
}, | ||
"11": { | ||
"op": "return", | ||
"stack_out": [] | ||
}, | ||
"12": { | ||
"block": "main_switch_case_1@2", | ||
"stack_in": [], | ||
"op": "pushint 0 // 0", | ||
"defined_out": [ | ||
"0" | ||
], | ||
"stack_out": [ | ||
"0" | ||
] | ||
}, | ||
"14": { | ||
"op": "return", | ||
"stack_out": [] | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
test_cases/regression_tests/out_O2/TealSwitchInlining.approval.teal
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,15 @@ | ||
#pragma version 10 | ||
#pragma typetrack false | ||
|
||
// test_cases.regression_tests.teal_switch_inlining.TealSwitchInlining.approval_program() -> uint64: | ||
main: | ||
txn NumAppArgs | ||
switch main_switch_case_0@1 main_switch_case_1@2 | ||
|
||
main_switch_case_0@1: | ||
pushint 1 // 1 | ||
return | ||
|
||
main_switch_case_1@2: | ||
pushint 0 // 0 | ||
return |
27 changes: 27 additions & 0 deletions
27
test_cases/regression_tests/out_O2/TealSwitchInlining.clear.puya.map
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,27 @@ | ||
{ | ||
"version": 3, | ||
"sources": [ | ||
"../teal_switch_inlining.py" | ||
], | ||
"mappings": ";AAuBe;;AAAP", | ||
"op_pc_offset": 0, | ||
"pc_events": { | ||
"1": { | ||
"subroutine": "test_cases.regression_tests.teal_switch_inlining.TealSwitchInlining.clear_state_program", | ||
"params": {}, | ||
"block": "main", | ||
"stack_in": [], | ||
"op": "pushint 1 // 1", | ||
"defined_out": [ | ||
"1" | ||
], | ||
"stack_out": [ | ||
"1" | ||
] | ||
}, | ||
"3": { | ||
"op": "return", | ||
"stack_out": [] | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
test_cases/regression_tests/out_O2/TealSwitchInlining.clear.teal
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,7 @@ | ||
#pragma version 10 | ||
#pragma typetrack false | ||
|
||
// test_cases.regression_tests.teal_switch_inlining.TealSwitchInlining.clear_state_program() -> uint64: | ||
main: | ||
pushint 1 // 1 | ||
return |
Oops, something went wrong.