summaryrefslogtreecommitdiff
path: root/src/passes/SimplifyLocals.cpp
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2023-11-01 12:43:15 -0700
committerGitHub <noreply@github.com>2023-11-01 12:43:15 -0700
commit1890834c69974bc956c26927b1953112e6a81bec (patch)
tree99951f1b1c39a15bee64be5b30a331bbdd03f06d /src/passes/SimplifyLocals.cpp
parent5618d2179e44252025831506a7b8b4dba25e7f2f (diff)
downloadbinaryen-1890834c69974bc956c26927b1953112e6a81bec.tar.gz
binaryen-1890834c69974bc956c26927b1953112e6a81bec.tar.bz2
binaryen-1890834c69974bc956c26927b1953112e6a81bec.zip
NonNullable => !Defaultable in SimplifyLocals (#6070)
We handled references but not tuples in one place.
Diffstat (limited to 'src/passes/SimplifyLocals.cpp')
-rw-r--r--src/passes/SimplifyLocals.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/passes/SimplifyLocals.cpp b/src/passes/SimplifyLocals.cpp
index fb46c79ec..28b13980b 100644
--- a/src/passes/SimplifyLocals.cpp
+++ b/src/passes/SimplifyLocals.cpp
@@ -794,12 +794,14 @@ struct SimplifyLocals
// In other words, local.get is not necessarily free of effects if the local
// is non-nullable - it must have been set already. We could check that
// here, but running that linear-time check may not be worth it as this
- // optimization is fairly minor, so just skip the non-nullable case.
+ // optimization is fairly minor, so just skip the non-nullable case (and in
+ // general, the non-defaultable case, of say a tuple with a non-nullable
+ // element).
//
// TODO investigate more
Index goodIndex = sinkables.begin()->first;
auto localType = this->getFunction()->getLocalType(goodIndex);
- if (localType.isNonNullable()) {
+ if (!localType.isDefaultable()) {
return;
}