summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai (kripken) <alonzakai@gmail.com>2017-07-09 20:39:12 -0700
committerAlon Zakai (kripken) <alonzakai@gmail.com>2017-07-11 10:40:17 -0700
commitee7538a3e912b20bf295cdfce81a531fafb0bb7c (patch)
treeeaad928526c4a015ff79571b0795d74e69d00734 /src
parent812943d51bac4767c4b7f749f17c26277e27f796 (diff)
downloadbinaryen-ee7538a3e912b20bf295cdfce81a531fafb0bb7c.tar.gz
binaryen-ee7538a3e912b20bf295cdfce81a531fafb0bb7c.tar.bz2
binaryen-ee7538a3e912b20bf295cdfce81a531fafb0bb7c.zip
don't remove unreachable nodes in vaccuum, it can alter types, and dce does that anyhow, let it do it's thing
Diffstat (limited to 'src')
-rw-r--r--src/passes/Vacuum.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/passes/Vacuum.cpp b/src/passes/Vacuum.cpp
index 4e47ad9a3..64c7f276a 100644
--- a/src/passes/Vacuum.cpp
+++ b/src/passes/Vacuum.cpp
@@ -49,6 +49,8 @@ struct Vacuum : public WalkerPass<PostWalker<Vacuum>> {
// returns nullptr if curr is dead, curr if it must stay as is, or another node if it can be replaced
Expression* optimize(Expression* curr, bool resultUsed) {
+ // an unreachable node must not be changed
+ if (curr->type == unreachable) return curr;
while (1) {
switch (curr->_id) {
case Expression::Id::NopId: return nullptr; // never needed