summaryrefslogtreecommitdiff
path: root/src/passes/GUFA.cpp
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2022-12-21 11:47:48 -0600
committerGitHub <noreply@github.com>2022-12-21 09:47:48 -0800
commit49fb2e23bb3c932389f23fdda33a32d034ca9a0c (patch)
treefbe18fa7d4809a59a0d9577fb723bf1873d8adeb /src/passes/GUFA.cpp
parent94a45c6aba605f0f7e0a2fac227a2dd7c03a391f (diff)
downloadbinaryen-49fb2e23bb3c932389f23fdda33a32d034ca9a0c.tar.gz
binaryen-49fb2e23bb3c932389f23fdda33a32d034ca9a0c.tar.bz2
binaryen-49fb2e23bb3c932389f23fdda33a32d034ca9a0c.zip
Support `ref.test null` (#5368)
This new variant of ref.test returns 1 if the input is null.
Diffstat (limited to 'src/passes/GUFA.cpp')
-rw-r--r--src/passes/GUFA.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/passes/GUFA.cpp b/src/passes/GUFA.cpp
index 4250c76e9..137ffda17 100644
--- a/src/passes/GUFA.cpp
+++ b/src/passes/GUFA.cpp
@@ -237,10 +237,8 @@ struct GUFAOptimizer
if (refType.isRef()) {
// We have some knowledge of the type here. Use that to optimize: RefTest
// returns 1 if the input is of a subtype of the intended type, that is,
- // we are looking for a type in that cone of types. (Note that we use a
- // non-nullable cone since only a non-null can pass the test.)
- auto intendedContents =
- PossibleContents::fullConeType(Type(curr->intendedType, NonNullable));
+ // we are looking for a type in that cone of types.
+ auto intendedContents = PossibleContents::fullConeType(curr->castType);
auto optimize = [&](int32_t result) {
auto* last = Builder(*getModule()).makeConst(Literal(int32_t(result)));