JS/Inlining: fix bug in temporary assignment elimination which causes excess removal of assignment statement. When there is a set of temporary variables that receive same value in different execution branches, remove them carefully so that at least one (and, preferably, at most) remains in each branch.

This commit is contained in:
Alexey Andreev
2016-05-04 15:12:17 +03:00
parent 48c417285c
commit c11f2fe2d6
4 changed files with 69 additions and 21 deletions
@@ -0,0 +1,19 @@
function test(param) {
var result;
if (param > 0) {
result = param;
} else {
result = -param;
}
return result;
}
function box() {
var result = test(20);
if (result != 20) return "fail1: " + result;
result = test(-20);
if (result != 20) return "fail2: " + result;
return "OK"
}