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:
Vendored
+19
@@ -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"
|
||||
}
|
||||
Reference in New Issue
Block a user