Skip to content

Commit

Permalink
Fix stack restoration in to_ssa
Browse files Browse the repository at this point in the history
This is similar to the functional stack passing fix in #119 but has a
smaller fix (just clobber the stacks altogether before restoring the old
values; previously we just overwrote the new variables).
  • Loading branch information
sampsyo committed Aug 23, 2021
1 parent 4d7b4eb commit 19fcef1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/test/to_ssa/if-const.out
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
b.0: int = const 1;
jmp .zexit;
.zexit:
b.1: int = phi b.0 b.0 .false .true;
b.1: int = phi b.0 __undefined .false .true;
a.1: int = phi __undefined a.0 .false .true;
print a.1;
ret;
Expand Down
2 changes: 1 addition & 1 deletion examples/test/to_ssa/if-ssa.out
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
jmp .zexit;
.zexit:
a.3.1: int = phi __undefined a.3.0 .left .right;
a.2.1: int = phi a.2.0 a.2.0 .left .right;
a.2.1: int = phi a.2.0 __undefined .left .right;
a.4.0: int = phi a.2.1 a.3.1 .left .right;
print a.4.0;
ret;
Expand Down
1 change: 1 addition & 0 deletions examples/to_ssa.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def _rename(block):
_rename(b)

# Restore stacks.
stack.clear()
stack.update(old_stack)

entry = list(blocks.keys())[0]
Expand Down

0 comments on commit 19fcef1

Please sign in to comment.