diff options
author | Alon Zakai <alonzakai@gmail.com> | 2017-07-18 09:17:57 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-18 09:17:57 -0700 |
commit | e865f2fa2863b6e91521c059a61a4483769bf5c9 (patch) | |
tree | f2d4bbee701376a4975ebf0d2c518f10369fdabd /src/passes/CoalesceLocals.cpp | |
parent | 24accd15fb59d476daaebbbcd492b8a9ee729b2b (diff) | |
parent | 7bc2ed70de137aa6615fcd5d0e1f3e88f008a738 (diff) | |
download | binaryen-e865f2fa2863b6e91521c059a61a4483769bf5c9.tar.gz binaryen-e865f2fa2863b6e91521c059a61a4483769bf5c9.tar.bz2 binaryen-e865f2fa2863b6e91521c059a61a4483769bf5c9.zip |
Merge pull request #1095 from WebAssembly/fuzz-3
More fuzz fixes
Diffstat (limited to 'src/passes/CoalesceLocals.cpp')
-rw-r--r-- | src/passes/CoalesceLocals.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/passes/CoalesceLocals.cpp b/src/passes/CoalesceLocals.cpp index b36542a97..5ab68da23 100644 --- a/src/passes/CoalesceLocals.cpp +++ b/src/passes/CoalesceLocals.cpp @@ -196,7 +196,9 @@ struct CoalesceLocals : public WalkerPass<CFGWalker<CoalesceLocals, Visitor<Coal if (auto* get = set->value->dynCast<GetLocal>()) return get; if (auto* iff = set->value->dynCast<If>()) { if (auto* get = iff->ifTrue->dynCast<GetLocal>()) return get; - if (auto* get = iff->ifFalse->dynCast<GetLocal>()) return get; + if (iff->ifFalse) { + if (auto* get = iff->ifFalse->dynCast<GetLocal>()) return get; + } } return nullptr; } @@ -595,11 +597,13 @@ void CoalesceLocals::pickIndices(std::vector<Index>& indices) { // Remove a copy from a set of an if, where one if arm is a get of the same set static void removeIfCopy(Expression** origin, SetLocal* set, If* iff, Expression*& copy, Expression*& other, Module* module) { // replace the origin with the if, and sink the set into the other non-copying arm + bool tee = set->isTee(); *origin = iff; set->value = other; set->finalize(); other = set; - if (!isConcreteWasmType(set->type)) { + // if this is not a tee, then we can get rid of the copy in that arm + if (!tee) { // we don't need the copy at all copy = nullptr; if (!iff->ifTrue) { |