Skip to content

Commit

Permalink
Fix directionality of phi nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
sampsyo committed Sep 21, 2020
1 parent f1c723b commit 6f98fa5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions bril-ts/brili.ts
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,7 @@ function evalFunc(func: bril.Function, state: State): ReturnValue {
for (i = 0; i < func.instrs.length; ++i) {
let sLine = func.instrs[i];
if ('label' in sLine && sLine.label === action.label) {
--i; // Execute the label next.
break;
}
}
Expand Down
11 changes: 11 additions & 0 deletions test/interp/ssa-simple-inv.bril
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# ARGS: true
@main(cond: bool) {
.top:
a: int = const 5;
br cond .here .there;
.here:
b: int = const 7;
.there:
c: int = phi a .top b .here;
print c;
}
1 change: 1 addition & 0 deletions test/interp/ssa-simple-inv.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7
2 changes: 1 addition & 1 deletion test/interp/ssa-simple.out
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5
7

0 comments on commit 6f98fa5

Please sign in to comment.