diff options
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); } } |