diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-04-18 14:49:59 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-04-18 14:49:59 -0700 |
commit | 003834c73f30268f5314cc717b994368cd548d98 (patch) | |
tree | 65af669225564f91c6d71f390d9460485d583185 /src | |
parent | b2fbce4f40c4b8adfdb7cd291d510de9e7219fc6 (diff) | |
parent | d3653cb44c4798290ce6bb579789fc2792986d5e (diff) | |
download | binaryen-003834c73f30268f5314cc717b994368cd548d98.tar.gz binaryen-003834c73f30268f5314cc717b994368cd548d98.tar.bz2 binaryen-003834c73f30268f5314cc717b994368cd548d98.zip |
Merge pull request #359 from WebAssembly/dead-stores-in-sl
Do some TODOs in SimplifyLocals
Diffstat (limited to 'src')
-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); } } |