diff options
author | Alon Zakai <azakai@google.com> | 2020-05-27 07:53:18 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-27 07:53:18 -0700 |
commit | 25912210b32012bf64359a89baef4514a6b37205 (patch) | |
tree | 7b78f8547b59234637e3e9f31f01112bc11713a4 /src/passes/Flatten.cpp | |
parent | 31a8d2f19df620427a81f787ebaff7412964e538 (diff) | |
download | binaryen-25912210b32012bf64359a89baef4514a6b37205.tar.gz binaryen-25912210b32012bf64359a89baef4514a6b37205.tar.bz2 binaryen-25912210b32012bf64359a89baef4514a6b37205.zip |
Flatten fuzz fix with unreachable special-casing (#2876)
The special-casing of unreachable there could lead to bad
behavior, where we did nothing to the unreachable and ended
up moving something with side effects before it, see testcase
in test/passes/flatten_all-features.wast.
This emits less efficient code, but only if --dce was not run
earlier, so probably not worth optimizing.
Diffstat (limited to 'src/passes/Flatten.cpp')
-rw-r--r-- | src/passes/Flatten.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/passes/Flatten.cpp b/src/passes/Flatten.cpp index 9139d5dca..55ee00936 100644 --- a/src/passes/Flatten.cpp +++ b/src/passes/Flatten.cpp @@ -62,9 +62,8 @@ struct Flatten std::vector<Expression*> ourPreludes; Builder builder(*getModule()); - // Nothing to do for constants, nop, and unreachable - if (Properties::isConstantExpression(curr) || curr->is<Nop>() || - curr->is<Unreachable>()) { + // Nothing to do for constants and nop. + if (Properties::isConstantExpression(curr) || curr->is<Nop>()) { return; } |