diff options
author | Alon Zakai (kripken) <alonzakai@gmail.com> | 2017-07-13 17:55:10 -0700 |
---|---|---|
committer | Alon Zakai (kripken) <alonzakai@gmail.com> | 2017-07-13 17:55:10 -0700 |
commit | 9792a40a8704cbae0ee515126c0b63eb9879d626 (patch) | |
tree | f411dd761451922a5f4bc2acb5dba3b72daa09be /src/passes/CoalesceLocals.cpp | |
parent | 00dd3b97455652113fa36cf639315388052f502d (diff) | |
download | binaryen-9792a40a8704cbae0ee515126c0b63eb9879d626.tar.gz binaryen-9792a40a8704cbae0ee515126c0b63eb9879d626.tar.bz2 binaryen-9792a40a8704cbae0ee515126c0b63eb9879d626.zip |
when removing an if-copy in coalesce-locals, if it's a tee, we do still need the get in that arm. only when it is not a tee can we remove that arm and make the if-else into an if
Diffstat (limited to 'src/passes/CoalesceLocals.cpp')
-rw-r--r-- | src/passes/CoalesceLocals.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/passes/CoalesceLocals.cpp b/src/passes/CoalesceLocals.cpp index 87eefb85c..5ab68da23 100644 --- a/src/passes/CoalesceLocals.cpp +++ b/src/passes/CoalesceLocals.cpp @@ -597,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) { |