Skip to content

Commit 19fcef1

Browse files
committed
Fix stack restoration in to_ssa
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).
1 parent 4d7b4eb commit 19fcef1

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

examples/test/to_ssa/if-const.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
b.0: int = const 1;
1010
jmp .zexit;
1111
.zexit:
12-
b.1: int = phi b.0 b.0 .false .true;
12+
b.1: int = phi b.0 __undefined .false .true;
1313
a.1: int = phi __undefined a.0 .false .true;
1414
print a.1;
1515
ret;

examples/test/to_ssa/if-ssa.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
jmp .zexit;
1111
.zexit:
1212
a.3.1: int = phi __undefined a.3.0 .left .right;
13-
a.2.1: int = phi a.2.0 a.2.0 .left .right;
13+
a.2.1: int = phi a.2.0 __undefined .left .right;
1414
a.4.0: int = phi a.2.1 a.3.1 .left .right;
1515
print a.4.0;
1616
ret;

examples/to_ssa.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ def _rename(block):
8383
_rename(b)
8484

8585
# Restore stacks.
86+
stack.clear()
8687
stack.update(old_stack)
8788

8889
entry = list(blocks.keys())[0]

0 commit comments

Comments
 (0)