summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ir/literal-utils.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/ir/literal-utils.h b/src/ir/literal-utils.h
index fbe5b3716..498085796 100644
--- a/src/ir/literal-utils.h
+++ b/src/ir/literal-utils.h
@@ -32,9 +32,17 @@ inline Expression* makeFromInt32(int32_t x, Type type, Module& wasm) {
}
inline bool canMakeZero(Type type) {
- // We can make a "zero" - a 0, or a null, or a trivial rtt, etc. - for pretty
- // much anything except a non-nullable reference type.
- return !type.isRef() || type.isNullable();
+ if (type.isRef() && !type.isNullable()) {
+ return false;
+ }
+ if (type.isTuple()) {
+ for (auto t : type) {
+ if (!canMakeZero(t)) {
+ return false;
+ }
+ }
+ }
+ return true;
}
inline Expression* makeZero(Type type, Module& wasm) {