diff options
author | Alon Zakai (kripken) <alonzakai@gmail.com> | 2017-07-09 22:02:45 -0700 |
---|---|---|
committer | Alon Zakai (kripken) <alonzakai@gmail.com> | 2017-07-11 10:40:17 -0700 |
commit | 18e096c4940f51df50d5f7a4e9fff03cc2f3beaf (patch) | |
tree | 0f2f7074c3bd6e511229e44c2a649c974f427d66 | |
parent | ee7538a3e912b20bf295cdfce81a531fafb0bb7c (diff) | |
download | binaryen-18e096c4940f51df50d5f7a4e9fff03cc2f3beaf.tar.gz binaryen-18e096c4940f51df50d5f7a4e9fff03cc2f3beaf.tar.bz2 binaryen-18e096c4940f51df50d5f7a4e9fff03cc2f3beaf.zip |
finalize new drops in SimplifyLocals
-rw-r--r-- | src/passes/SimplifyLocals.cpp | 2 | ||||
-rw-r--r-- | test/passes/simplify-locals-nostructure.txt | 6 | ||||
-rw-r--r-- | test/passes/simplify-locals-nostructure.wast | 8 |
3 files changed, 16 insertions, 0 deletions
diff --git a/src/passes/SimplifyLocals.cpp b/src/passes/SimplifyLocals.cpp index a9e9de34b..4c896dbba 100644 --- a/src/passes/SimplifyLocals.cpp +++ b/src/passes/SimplifyLocals.cpp @@ -64,6 +64,7 @@ struct SetLocalRemover : public PostWalker<SetLocalRemover> { } else { Drop* drop = ExpressionManipulator::convert<SetLocal, Drop>(curr); drop->value = value; + drop->finalize(); } } } @@ -268,6 +269,7 @@ struct SimplifyLocals : public WalkerPass<LinearExecutionWalker<SimplifyLocals>> auto* previousValue = previous->value; Drop* drop = ExpressionManipulator::convert<SetLocal, Drop>(previous); drop->value = previousValue; + drop->finalize(); self->sinkables.erase(found); self->anotherCycle = true; } diff --git a/test/passes/simplify-locals-nostructure.txt b/test/passes/simplify-locals-nostructure.txt index 2502c4549..6857a4c7a 100644 --- a/test/passes/simplify-locals-nostructure.txt +++ b/test/passes/simplify-locals-nostructure.txt @@ -62,4 +62,10 @@ (get_local $b) ) ) + (func $no-unreachable (type $0) + (local $x i32) + (drop + (unreachable) + ) + ) ) diff --git a/test/passes/simplify-locals-nostructure.wast b/test/passes/simplify-locals-nostructure.wast index 33f891e61..548109237 100644 --- a/test/passes/simplify-locals-nostructure.wast +++ b/test/passes/simplify-locals-nostructure.wast @@ -28,5 +28,13 @@ ) (drop (get_local $b)) ) + (func $no-unreachable + (local $x i32) + (drop + (tee_local $x + (unreachable) + ) + ) + ) ) |