aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-01-28 21:15:01 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-01-28 21:15:01 -0800
commitc516fa7758636e15a7077c658db3c74533c7ee38 (patch)
treeb51060baee760cb8dc533e88ce5af0e12a4a881d
parent406dac27c1a81c1962365983d42f00577889b555 (diff)
fix eliminator bug with variable defs not counting as mutations (which we see now due to more phis)
-rw-r--r--tools/eliminator/eliminator-test-output.js8
-rw-r--r--tools/eliminator/eliminator-test.js10
-rw-r--r--tools/eliminator/eliminator.coffee6
3 files changed, 22 insertions, 2 deletions
diff --git a/tools/eliminator/eliminator-test-output.js b/tools/eliminator/eliminator-test-output.js
index 594508d0..da9be5cc 100644
--- a/tools/eliminator/eliminator-test-output.js
+++ b/tools/eliminator/eliminator-test-output.js
@@ -105,4 +105,10 @@ function t() {
__label__ = 4;
}
}
-// EMSCRIPTEN_GENERATED_FUNCTIONS: ["f", "g", "h", "py", "r", "t"]
+function f2() {
+ var $_pre = HEAPU32[($vla + ($storemerge312 << 2) | 0) >> 2];
+ var $storemerge312 = $storemerge312 + 1 | 0;
+ var $8 = $_pre;
+ c($8);
+}
+// EMSCRIPTEN_GENERATED_FUNCTIONS: ["f", "g", "h", "py", "r", "t", "f2"]
diff --git a/tools/eliminator/eliminator-test.js b/tools/eliminator/eliminator-test.js
index 02ac0c08..3410499d 100644
--- a/tools/eliminator/eliminator-test.js
+++ b/tools/eliminator/eliminator-test.js
@@ -114,5 +114,13 @@ function t() {
var $cmp3=($12) < ($13);
if (!($cmp3)) { __label__ = 4; }
}
-// EMSCRIPTEN_GENERATED_FUNCTIONS: ["f", "g", "h", "py", "r", "t"]
+function f2() {
+ var $arrayidx64_phi_trans_insert = $vla + ($storemerge312 << 2) | 0;
+ var $_pre = HEAPU32[$arrayidx64_phi_trans_insert >> 2];
+ var $phitmp = $storemerge312 + 1 | 0;
+ var $storemerge312 = $phitmp;
+ var $8 = $_pre;
+ c($8);
+}
+// EMSCRIPTEN_GENERATED_FUNCTIONS: ["f", "g", "h", "py", "r", "t", "f2"]
diff --git a/tools/eliminator/eliminator.coffee b/tools/eliminator/eliminator.coffee
index 8b99338a..84e544b2 100644
--- a/tools/eliminator/eliminator.coffee
+++ b/tools/eliminator/eliminator.coffee
@@ -262,8 +262,14 @@ class Eliminator
else if type is 'var'
for [varName, varValue] in node[1]
if varValue? then traverse varValue, checkForMutations
+ # Mark the variable as live
if @isSingleDef[varName]
isLive[varName] = true
+ # Mark variables that depend on it as no longer live
+ if @dependsOn[varName]?
+ for varNameDep of @dependsOn[varName]
+ if isLive[varNameDep]
+ isLive[varNameDep] = false
return node
else
checkForMutations node, type