diff options
Diffstat (limited to 'src/ir/localize.h')
-rw-r--r-- | src/ir/localize.h | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/ir/localize.h b/src/ir/localize.h index d44fb9be5..85e4415f5 100644 --- a/src/ir/localize.h +++ b/src/ir/localize.h @@ -153,17 +153,20 @@ struct ChildLocalizer { // Nothing to add. return parent; } + auto* block = getChildrenReplacement(); + if (!hasUnreachableChild) { + block->list.push_back(parent); + block->finalize(); + } + return block; + } + // Like `getReplacement`, but the result never contains the parent. + Block* getChildrenReplacement() { auto* block = Builder(wasm).makeBlock(); block->list.set(sets); if (hasUnreachableChild) { - // If there is an unreachable child then we do not need the parent at all, - // and we know the type is unreachable. block->type = Type::unreachable; - } else { - // Otherwise, add the parent and finalize. - block->list.push_back(parent); - block->finalize(); } return block; } |