diff options
author | Alon Zakai <azakai@google.com> | 2021-04-22 13:47:21 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-22 13:47:21 -0700 |
commit | 23a26c75c6d737d6f97ed1048639b41e948fdd58 (patch) | |
tree | e3110280f6a774f64a43ce5e4694652a152955f1 /src | |
parent | ba8955f80b58e9a18b675c399b39a547d96facc2 (diff) | |
download | binaryen-23a26c75c6d737d6f97ed1048639b41e948fdd58.tar.gz binaryen-23a26c75c6d737d6f97ed1048639b41e948fdd58.tar.bz2 binaryen-23a26c75c6d737d6f97ed1048639b41e948fdd58.zip |
OptimizeInstructions: Fix/ignore eqz hoisting of if with unreachable arm (#3835)
We tried to ignore unreachable code, but only checked the type of
the entire node. But an arm might be unreachable, and after moving
code around that requires more work to update the type. But such
cases are best left to DCE anyhow, so just check for any unreachability
and stop there.
Diffstat (limited to 'src')
-rw-r--r-- | src/passes/OptimizeInstructions.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/passes/OptimizeInstructions.cpp b/src/passes/OptimizeInstructions.cpp index 5eba1e3b9..23a63646e 100644 --- a/src/passes/OptimizeInstructions.cpp +++ b/src/passes/OptimizeInstructions.cpp @@ -2805,7 +2805,11 @@ private: // (Y) // ) // ) - if (curr->type != Type::unreachable) { + // + // Ignore unreachable code here; leave that for DCE. + if (curr->type != Type::unreachable && + curr->ifTrue->type != Type::unreachable && + curr->ifFalse->type != Type::unreachable) { Unary* un; Expression* x; Const* c; |