From 25912210b32012bf64359a89baef4514a6b37205 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 27 May 2020 07:53:18 -0700 Subject: 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. --- src/passes/Flatten.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') 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 ourPreludes; Builder builder(*getModule()); - // Nothing to do for constants, nop, and unreachable - if (Properties::isConstantExpression(curr) || curr->is() || - curr->is()) { + // Nothing to do for constants and nop. + if (Properties::isConstantExpression(curr) || curr->is()) { return; } -- cgit v1.2.3