Permalink
Browse files

invalidate calls in if bodies in eliminator

  • Loading branch information...
1 parent 7869ed3 commit aab26adc6a63c770dae29d1cc5d8c0e29e02871a @kripken committed Dec 25, 2012
Showing with 5 additions and 1 deletion.
  1. +1 −1 tools/eliminator/eliminator-test-output.js
  2. +4 −0 tools/js-optimizer.js
@@ -6142,7 +6142,7 @@ function phi() {
}
function intoCond() {
var $115 = 22;
- $NumWords = __ZN4llvm15BitstreamCursor4ReadEj($117, 32);
+ var $NumWords = __ZN4llvm15BitstreamCursor4ReadEj($117, 32);
if (($115 | 0) != 0) {
HEAP32[$115 >> 2] = $NumWords;
}
View
@@ -1715,6 +1715,10 @@ function eliminate(ast, memSafe) {
} else if (type == 'if') {
if (allowTracking) {
traverseInOrder(node[1]); // can eliminate into condition, but nowhere else
+ if (!callsInvalidated) { // invalidate calls, since we cannot eliminate them into an if that may not execute!
+ invalidateCalls();
+ callsInvalidated = true;
+ }
allowTracking = false;
traverseInOrder(node[2]); // 2 and 3 could be 'parallel', really..
if (node[3]) traverseInOrder(node[3]);

0 comments on commit aab26ad

Please sign in to comment.