diff options
Diffstat (limited to 'src/passes/SimplifyLocals.cpp')
-rw-r--r-- | src/passes/SimplifyLocals.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/passes/SimplifyLocals.cpp b/src/passes/SimplifyLocals.cpp index fbdc248e3..f0c786b1c 100644 --- a/src/passes/SimplifyLocals.cpp +++ b/src/passes/SimplifyLocals.cpp @@ -62,7 +62,7 @@ struct SimplifyLocals : public WalkerPass<LinearExecutionWalker<SimplifyLocals, void visitGetLocal(GetLocal *curr) { auto found = sinkables.find(curr->index); if (found != sinkables.end()) { - // sink it, and nop the origin TODO: clean up nops + // sink it, and nop the origin replaceCurrent(*found->second.item); // reuse the getlocal that is dying *found->second.item = curr; @@ -75,11 +75,11 @@ struct SimplifyLocals : public WalkerPass<LinearExecutionWalker<SimplifyLocals, } void visitSetLocal(SetLocal *curr) { - // if we are a potentially-sinkable thing, forget it - this - // write overrides the last TODO: optimizable - // TODO: if no get_locals left, can remove the set as well (== expressionizer in emscripten optimizer) + // if we are a potentially-sinkable thing, then the previous + // store is dead, leave just the value auto found = sinkables.find(curr->index); if (found != sinkables.end()) { + *found->second.item = (*found->second.item)->cast<SetLocal>()->value; sinkables.erase(found); } } |