diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-04-17 10:47:37 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-04-18 14:11:04 -0700 |
commit | d3653cb44c4798290ce6bb579789fc2792986d5e (patch) | |
tree | 65af669225564f91c6d71f390d9460485d583185 /src | |
parent | d0c419f70938023bfc1c72365f9901a718a9eec6 (diff) | |
download | binaryen-d3653cb44c4798290ce6bb579789fc2792986d5e.tar.gz binaryen-d3653cb44c4798290ce6bb579789fc2792986d5e.tar.bz2 binaryen-d3653cb44c4798290ce6bb579789fc2792986d5e.zip |
handle dead stores in SimplifyLocals
Diffstat (limited to 'src')
-rw-r--r-- | src/passes/SimplifyLocals.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/passes/SimplifyLocals.cpp b/src/passes/SimplifyLocals.cpp index a4a36c895..f0c786b1c 100644 --- a/src/passes/SimplifyLocals.cpp +++ b/src/passes/SimplifyLocals.cpp @@ -75,10 +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 + // 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); } } |