From 585af93ec6a22feb8954bc118f0bff997d1fc165 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Mon, 12 Jun 2023 16:10:14 -0700 Subject: DeadArgumentElimination: Do not error on bottom types in result refining (#5763) More generally, the LUB computation that code relies on did not handle bottom types properly. --- src/ir/lubs.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ir/lubs.cpp b/src/ir/lubs.cpp index ead1299b5..1f844c244 100644 --- a/src/ir/lubs.cpp +++ b/src/ir/lubs.cpp @@ -82,10 +82,15 @@ LUBFinder getResultsLUB(Function* func, Module& wasm) { for (auto* call : FindAll(func->body).list) { if (call->isReturn) { auto targetType = call->target->type; + // We can skip unreachable code and calls to bottom types, as both trap. if (targetType == Type::unreachable) { continue; } - if (!processReturnType(targetType.getHeapType().getSignature().results)) { + auto targetHeapType = targetType.getHeapType(); + if (targetHeapType.isBottom()) { + continue; + } + if (!processReturnType(targetHeapType.getSignature().results)) { return lub; } } -- cgit v1.2.3