summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2023-06-12 16:10:14 -0700
committerGitHub <noreply@github.com>2023-06-12 16:10:14 -0700
commit585af93ec6a22feb8954bc118f0bff997d1fc165 (patch)
tree764471911b2baf7f81148591b4db76fae08f72e2 /src
parent87f3807796cb7b04321914bea491e806a54883b6 (diff)
downloadbinaryen-585af93ec6a22feb8954bc118f0bff997d1fc165.tar.gz
binaryen-585af93ec6a22feb8954bc118f0bff997d1fc165.tar.bz2
binaryen-585af93ec6a22feb8954bc118f0bff997d1fc165.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/ir/lubs.cpp7
1 files changed, 6 insertions, 1 deletions
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<CallRef>(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;
}
}