diff options
author | Alon Zakai <azakai@google.com> | 2021-10-19 12:52:59 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-19 12:52:59 -0700 |
commit | d09be7af5b00f5e739ed56077ac5fb6b8e4e2adf (patch) | |
tree | c8c66b78b2334928cdc1e0767ae35831440d2e89 /src/passes/OptimizeInstructions.cpp | |
parent | c19ff59c71824b34fa312aac9ad979e2198d7d36 (diff) | |
download | binaryen-d09be7af5b00f5e739ed56077ac5fb6b8e4e2adf.tar.gz binaryen-d09be7af5b00f5e739ed56077ac5fb6b8e4e2adf.tar.bz2 binaryen-d09be7af5b00f5e739ed56077ac5fb6b8e4e2adf.zip |
OptimizeInstructions: Ignore unreachable subsequent sets (#4259)
Fuzzing followup to #4244.
Diffstat (limited to 'src/passes/OptimizeInstructions.cpp')
-rw-r--r-- | src/passes/OptimizeInstructions.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/passes/OptimizeInstructions.cpp b/src/passes/OptimizeInstructions.cpp index ba18bfd74..f23c119ec 100644 --- a/src/passes/OptimizeInstructions.cpp +++ b/src/passes/OptimizeInstructions.cpp @@ -1415,6 +1415,11 @@ struct OptimizeInstructions bool optimizeSubsequentStructSet(StructNew* new_, StructSet* set, Index refLocalIndex) { + // Leave unreachable code for DCE, to avoid updating types here. + if (new_->type == Type::unreachable || set->type == Type::unreachable) { + return false; + } + if (new_->isWithDefault()) { // Ignore a new_default for now. If the fields are defaultable then we // could add them, in principle, but that might increase code size. |