diff options
author | Alon Zakai <azakai@google.com> | 2023-11-09 12:39:04 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-09 12:39:04 -0800 |
commit | 536b066a5606657adb7eea7eb4da89d3cd58306b (patch) | |
tree | ba5c0262b6f0faf125abb62635332056904f7f84 /src/passes/StackIR.cpp | |
parent | c37fc0995a6fc0dcfc3fef0622f591715610c948 (diff) | |
download | binaryen-536b066a5606657adb7eea7eb4da89d3cd58306b.tar.gz binaryen-536b066a5606657adb7eea7eb4da89d3cd58306b.tar.bz2 binaryen-536b066a5606657adb7eea7eb4da89d3cd58306b.zip |
[NFC] StackIR: Add comments on local2stack handling of tuples (#6092)
Also add testcases to be comprehensive and notice changes if we ever decide to
modify that behavior.
Diffstat (limited to 'src/passes/StackIR.cpp')
-rw-r--r-- | src/passes/StackIR.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/passes/StackIR.cpp b/src/passes/StackIR.cpp index 4d5b867bd..c57bea83f 100644 --- a/src/passes/StackIR.cpp +++ b/src/passes/StackIR.cpp @@ -389,10 +389,14 @@ private: assert(setIndex < getIndex); auto* set = insts[setIndex]->origin->cast<LocalSet>(); - if (func->isParam(set->index) || - !func->getLocalType(set->index).isNonNullable()) { + auto localType = func->getLocalType(set->index); + // Note we do not need to handle tuples here, as the parent ignores them + // anyhow (hence we can check non-nullability instead of non- + // defaultability). + assert(localType.isSingle()); + if (func->isParam(set->index) || !localType.isNonNullable()) { // This local cannot pose a problem for validation (params are always - // initialized, and nullable locals may be uninitialized). + // initialized, and it is ok if nullable locals are uninitialized). return true; } |