From d09be7af5b00f5e739ed56077ac5fb6b8e4e2adf Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Tue, 19 Oct 2021 12:52:59 -0700 Subject: OptimizeInstructions: Ignore unreachable subsequent sets (#4259) Fuzzing followup to #4244. --- src/passes/OptimizeInstructions.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') 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. -- cgit v1.2.3