From 8543f1651e626630cdce02609c8e5e8717f789e8 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Wed, 18 Sep 2024 18:37:27 -0700 Subject: [PATCH 01/56] [NFC-ish] Eagerly create Functions in binary parser In preparation for using IRBuilder in the binary parser, eagerly create Functions when parsing the function section so that they are already created once we parse the code section. IRBuilder will require the functions to exist when parsing calls so it can figure out what type each call should have, even when there is a call to a function whose body has not been parsed yet. NFC except that some error messages change to include the new empty functions. --- src/wasm-binary.h | 5 +++++ src/wasm/wasm-binary.cpp | 25 ++++++++++++++----------- test/lit/binary/debug-bad-binary.test | 6 ++++++ 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/src/wasm-binary.h b/src/wasm-binary.h index fe740d56a76..5021b6a297f 100644 --- a/src/wasm-binary.h +++ b/src/wasm-binary.h @@ -1532,6 +1532,11 @@ class WasmBinaryReader { // reconstructing the HeapTypes from the Signatures is expensive. std::vector functionTypes; + // Used to make sure the number of imported functions, signatures, and + // declared functions all match up. + Index numFuncImports = 0; + Index numFuncBodies = 0; + void readFunctionSignatures(); HeapType getTypeByIndex(Index index); HeapType getTypeByFunctionIndex(Index index); diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index d8a310103da..96e9317094b 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -2578,6 +2578,7 @@ void WasmBinaryReader::readImports() { } } } + numFuncImports = wasm.functions.size(); } Name WasmBinaryReader::getNextLabel() { @@ -2595,9 +2596,15 @@ void WasmBinaryReader::readFunctionSignatures() { size_t num = getU32LEB(); for (size_t i = 0; i < num; i++) { auto index = getU32LEB(); - functionTypes.push_back(getTypeByIndex(index)); + HeapType type = getTypeByIndex(index); + functionTypes.push_back(type); // Check that the type is a signature. getSignatureByTypeIndex(index); + // Create the function with a placeholder body so we don't trip over it if + // we have to print it as part of an error message. + Builder builder(wasm); + wasm.addFunction(builder.makeFunction( + makeName("", i), type, {}, builder.makeUnreachable())); } } @@ -2633,12 +2640,11 @@ Signature WasmBinaryReader::getSignatureByFunctionIndex(Index index) { } void WasmBinaryReader::readFunctions() { - auto numImports = wasm.functions.size(); - size_t total = getU32LEB(); - if (total != functionTypes.size() - numImports) { + numFuncBodies = getU32LEB(); + if (numFuncBodies + numFuncImports != wasm.functions.size()) { throwError("invalid function section size, must equal types"); } - for (size_t i = 0; i < total; i++) { + for (size_t i = 0; i < numFuncBodies; i++) { auto sizePos = pos; size_t size = getU32LEB(); if (size == 0) { @@ -2646,9 +2652,7 @@ void WasmBinaryReader::readFunctions() { } endOfFunction = pos + size; - auto func = std::make_unique(); - func->name = makeName("", i); - func->type = getTypeByFunctionIndex(numImports + i); + auto& func = wasm.functions[numFuncImports + i]; currFunction = func.get(); if (DWARF) { @@ -2715,7 +2719,6 @@ void WasmBinaryReader::readFunctions() { std::swap(func->epilogLocation, debugLocation); currFunction = nullptr; debugLocation.clear(); - wasm.addFunction(std::move(func)); } } @@ -3192,8 +3195,8 @@ void WasmBinaryReader::validateBinary() { throwError("Number of segments does not agree with DataCount section"); } - if (functionTypes.size() != wasm.functions.size()) { - throwError("function section without code section"); + if (functionTypes.size() != numFuncImports + numFuncBodies) { + throwError("function and code sections have inconsistent lengths"); } } diff --git a/test/lit/binary/debug-bad-binary.test b/test/lit/binary/debug-bad-binary.test index 63a2ed2ccac..634146a7653 100644 --- a/test/lit/binary/debug-bad-binary.test +++ b/test/lit/binary/debug-bad-binary.test @@ -38,4 +38,10 @@ RUN: not wasm-opt --debug %s.wasm 2>&1 | filecheck %s ;; CHECK-NEXT: (i32.const 10) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) +;; CHECK-NEXT: (func $1 +;; CHECK-NEXT: (unreachable) +;; CHECK-NEXT: ) +;; CHECK-NEXT: (func $2 +;; CHECK-NEXT: (unreachable) +;; CHECK-NEXT: ) ;; CHECK-NEXT: ) From b83bec4c82bbd1cb725b219473386c3902935a94 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Wed, 18 Sep 2024 21:17:55 -0700 Subject: [PATCH 02/56] [NFC] Eagerly create segments when parsing datacount The purpose of the datacount section is to pre-declare how many data segments there will be so that engines can allocate space for them and not have to back patch subsequent instructions in the code section that refer to them. Once we use IRBuilder in the binary parser, we will have to have the data segments available by the time we parse instructions that use them, so eagerly construct the data segments when parsing the datacount section. --- src/wasm/wasm-binary.cpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index 96e9317094b..11ee8fe2f46 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -3276,18 +3276,37 @@ void WasmBinaryReader::processNames() { void WasmBinaryReader::readDataSegmentCount() { hasDataCount = true; dataCount = getU32LEB(); + // Eagerly create the data segments so they are available during parsing of + // the code section. + for (size_t i = 0; i < dataCount; ++i) { + auto curr = Builder::makeDataSegment(); + curr->setName(Name::fromInt(i), false); + wasm.addDataSegment(std::move(curr)); + } } void WasmBinaryReader::readDataSegments() { auto num = getU32LEB(); + if (hasDataCount) { + if (num != dataCount) { + throwError("data count and data sections disagree on size"); + } + } else { + // We haven't already created the data segments, so create them now. + for (size_t i = 0; i < num; ++i) { + auto curr = Builder::makeDataSegment(); + curr->setName(Name::fromInt(i), false); + wasm.addDataSegment(std::move(curr)); + } + } + assert(wasm.dataSegments.size() == num); for (size_t i = 0; i < num; i++) { - auto curr = Builder::makeDataSegment(); + auto& curr = wasm.dataSegments[i]; uint32_t flags = getU32LEB(); if (flags > 2) { throwError("bad segment flags, must be 0, 1, or 2, not " + std::to_string(flags)); } - curr->setName(Name::fromInt(i), false); curr->isPassive = flags & BinaryConsts::IsPassive; if (curr->isPassive) { curr->memory = Name(); @@ -3303,7 +3322,6 @@ void WasmBinaryReader::readDataSegments() { auto size = getU32LEB(); auto data = getByteView(size); curr->data = {data.begin(), data.end()}; - wasm.addDataSegment(std::move(curr)); } } From a124292894c6ef0c2fa9b59256706da473869d56 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Wed, 18 Sep 2024 21:08:10 -0700 Subject: [PATCH 03/56] [NFC] Walk module to update names in binary parser The binary parser generally does not know the final names of module elements when it parses them, or even when it parses instructions that refer to them, since the name section comes at the end of a binary. The parser previously kept a list of pointers to locations where each module element's name would have to be used, then it patched those locations after parsing the names section to discover the final names. When the binary parser starts using IRBuilder, the parsed expressions will be constructed and managed by IRBuilder rather than by the parser itself. This means that the parser will no longer be able to collect pointers to places where module element names are used; it won't have access to the instructions at all. Since the strategy of collecting locations to patch will no longer work, switch to a strategy of traversing the module to find and update names instead. This is generally less efficient because the locations have to be found before they can be updated, but on the other hand it only happens when preserving debug info and it is parallelizable anyway. --- src/wasm-binary.h | 32 +--- src/wasm/wasm-binary.cpp | 388 +++++++++++++++++++-------------------- 2 files changed, 194 insertions(+), 226 deletions(-) diff --git a/src/wasm-binary.h b/src/wasm-binary.h index 5021b6a297f..c394c400855 100644 --- a/src/wasm-binary.h +++ b/src/wasm-binary.h @@ -1547,36 +1547,24 @@ class WasmBinaryReader { Name getNextLabel(); - // We read functions and globals before we know their names, so we need to - // backpatch the names later + // We read functions, globals, etc. before we know their final names, so we + // need to backpatch the names later. Map the original names to their indices + // so we can find the final names based on index. + std::unordered_map functionIndices; + std::unordered_map tableIndices; + std::unordered_map memoryIndices; + std::unordered_map globalIndices; + std::unordered_map tagIndices; + std::unordered_map dataIndices; + std::unordered_map elemIndices; - // at index i we have all refs to the function i - std::map> functionRefs; Function* currFunction = nullptr; // before we see a function (like global init expressions), there is no end of // function to check Index endOfFunction = -1; - // at index i we have all references to the table i - std::map> tableRefs; - std::map elemTables; - // at index i we have all references to the memory i - std::map> memoryRefs; - - // at index i we have all refs to the global i - std::map> globalRefs; - - // at index i we have all refs to the tag i - std::map> tagRefs; - - // at index i we have all refs to the data segment i - std::map> dataRefs; - - // at index i we have all refs to the element segment i - std::map> elemRefs; - // Throws a parsing error if we are not in a function context void requireFunctionContext(const char* error); diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index 11ee8fe2f46..f146e04abaa 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -23,6 +23,7 @@ #include "ir/names.h" #include "ir/table-utils.h" #include "ir/type-updating.h" +#include "pass.h" #include "support/bits.h" #include "support/debug.h" #include "support/stdckdint.h" @@ -2222,6 +2223,7 @@ void WasmBinaryReader::readMemories() { memory->shared, memory->indexType, Memory::kUnlimitedSize); + memoryIndices[memory->name] = wasm.memories.size(); wasm.addMemory(std::move(memory)); } } @@ -2487,11 +2489,6 @@ void WasmBinaryReader::getResizableLimits(Address& initial, void WasmBinaryReader::readImports() { size_t num = getU32LEB(); Builder builder(wasm); - size_t tableCounter = 0; - size_t memoryCounter = 0; - size_t functionCounter = 0; - size_t globalCounter = 0; - size_t tagCounter = 0; for (size_t i = 0; i < num; i++) { auto module = getInlineString(); auto base = getInlineString(); @@ -2501,7 +2498,7 @@ void WasmBinaryReader::readImports() { // could occur later due to the names section. switch (kind) { case ExternalKind::Function: { - Name name = makeName("fimport$", functionCounter++); + Name name = makeName("fimport$", wasm.functions.size()); auto index = getU32LEB(); functionTypes.push_back(getTypeByIndex(index)); auto type = getTypeByIndex(index); @@ -2513,11 +2510,13 @@ void WasmBinaryReader::readImports() { auto curr = builder.makeFunction(name, type, {}); curr->module = module; curr->base = base; + functionIndices[name] = wasm.functions.size(); wasm.addFunction(std::move(curr)); break; } case ExternalKind::Table: { - auto table = builder.makeTable(makeName("timport$", tableCounter++)); + Name name = makeName("timport$", wasm.tables.size()); + auto table = builder.makeTable(name); table->module = module; table->base = base; table->type = getType(); @@ -2531,12 +2530,13 @@ void WasmBinaryReader::readImports() { if (is_shared) { throwError("Tables may not be shared"); } - + tableIndices[name] = wasm.tables.size(); wasm.addTable(std::move(table)); break; } case ExternalKind::Memory: { - auto memory = builder.makeMemory(makeName("mimport$", memoryCounter++)); + Name name = makeName("mimport$", wasm.memories.size()); + auto memory = builder.makeMemory(name); memory->module = module; memory->base = base; getResizableLimits(memory->initial, @@ -2544,32 +2544,36 @@ void WasmBinaryReader::readImports() { memory->shared, memory->indexType, Memory::kUnlimitedSize); + memoryIndices[name] = wasm.memories.size(); wasm.addMemory(std::move(memory)); break; } case ExternalKind::Global: { + Name name = makeName("gimport$", wasm.globals.size()); auto type = getConcreteType(); auto mutable_ = getU32LEB(); if (mutable_ & ~1) { throwError("Global mutability must be 0 or 1"); } auto curr = - builder.makeGlobal(makeName("gimport$", globalCounter++), + builder.makeGlobal(name, type, nullptr, mutable_ ? Builder::Mutable : Builder::Immutable); curr->module = module; curr->base = base; + globalIndices[name] = wasm.globals.size(); wasm.addGlobal(std::move(curr)); break; } case ExternalKind::Tag: { - Name name = makeName("eimport$", tagCounter++); + Name name = makeName("eimport$", wasm.tags.size()); getInt8(); // Reserved 'attribute' field auto index = getU32LEB(); auto curr = builder.makeTag(name, getSignatureByTypeIndex(index)); curr->module = module; curr->base = base; + tagIndices[name] = wasm.tags.size(); wasm.addTag(std::move(curr)); break; } @@ -2603,8 +2607,10 @@ void WasmBinaryReader::readFunctionSignatures() { // Create the function with a placeholder body so we don't trip over it if // we have to print it as part of an error message. Builder builder(wasm); - wasm.addFunction(builder.makeFunction( - makeName("", i), type, {}, builder.makeUnreachable())); + auto name = makeName("", i); + functionIndices[name] = wasm.functions.size(); + wasm.addFunction( + builder.makeFunction(name, type, {}, builder.makeUnreachable())); } } @@ -3004,11 +3010,13 @@ void WasmBinaryReader::readGlobals() { throwError("Global mutability must be 0 or 1"); } auto* init = readExpression(); - wasm.addGlobal( + auto global = Builder::makeGlobal(makeName("global$", i), type, init, - mutable_ ? Builder::Mutable : Builder::Immutable)); + mutable_ ? Builder::Mutable : Builder::Immutable); + globalIndices[global->name] = wasm.globals.size(); + wasm.addGlobal(std::move(global)); } } @@ -3201,7 +3209,112 @@ void WasmBinaryReader::validateBinary() { } void WasmBinaryReader::processNames() { - // now that we have names, apply things + // Now that we have final names for module elements, update the names used in + // expressions and anywhere else. + struct NameUpdater + : WalkerPass< + PostWalker>> { + WasmBinaryReader& parent; + NameUpdater(WasmBinaryReader& parent) : parent(parent) {} + bool isFunctionParallel() override { return true; } + std::unique_ptr create() override { + return std::make_unique(parent); + } + + void visitExpression(Expression* curr) { + auto& wasm = *getModule(); + +#define DELEGATE_ID curr->_id +#define DELEGATE_START(id) [[maybe_unused]] auto* cast = curr->cast(); +#define DELEGATE_GET_FIELD(id, field) cast->field +#define DELEGATE_FIELD_TYPE(id, field) +#define DELEGATE_FIELD_HEAPTYPE(id, field) +#define DELEGATE_FIELD_CHILD(id, field) +#define DELEGATE_FIELD_OPTIONAL_CHILD(id, field) +#define DELEGATE_FIELD_INT(id, field) +#define DELEGATE_FIELD_LITERAL(id, field) +#define DELEGATE_FIELD_NAME(id, field) +#define DELEGATE_FIELD_SCOPE_NAME_DEF(id, field) +#define DELEGATE_FIELD_SCOPE_NAME_USE(id, field) +#define DELEGATE_FIELD_ADDRESS(id, field) + +#define DELEGATE_FIELD_NAME_KIND(id, field, kind) \ + switch (kind) { \ + case ModuleItemKind::Function: \ + if (auto it = parent.functionIndices.find(cast->field); \ + it != parent.functionIndices.end()) { \ + cast->field = wasm.functions[it->second]->name; \ + } \ + break; \ + case ModuleItemKind::Table: \ + if (auto it = parent.tableIndices.find(cast->field); \ + it != parent.tableIndices.end()) { \ + cast->field = wasm.tables[it->second]->name; \ + } \ + break; \ + case ModuleItemKind::Memory: \ + if (auto it = parent.memoryIndices.find(cast->field); \ + it != parent.memoryIndices.end()) { \ + cast->field = wasm.memories[it->second]->name; \ + } \ + break; \ + case ModuleItemKind::Global: \ + if (auto it = parent.globalIndices.find(cast->field); \ + it != parent.globalIndices.end()) { \ + cast->field = wasm.globals[it->second]->name; \ + } \ + break; \ + case ModuleItemKind::Tag: \ + if (auto it = parent.tagIndices.find(cast->field); \ + it != parent.tagIndices.end()) { \ + cast->field = wasm.tags[it->second]->name; \ + } \ + break; \ + case ModuleItemKind::DataSegment: \ + if (auto it = parent.dataIndices.find(cast->field); \ + it != parent.dataIndices.end()) { \ + cast->field = wasm.dataSegments[it->second]->name; \ + } \ + break; \ + case ModuleItemKind::ElementSegment: \ + if (auto it = parent.elemIndices.find(cast->field); \ + it != parent.elemIndices.end()) { \ + cast->field = wasm.elementSegments[it->second]->name; \ + } \ + break; \ + case ModuleItemKind::Invalid: \ + WASM_UNREACHABLE("unexpected kind"); \ + } +#include "wasm-delegations-fields.def" + } + }; + + if (debugInfo) { + // Perform the replacement. Mark the runner nested to avoid unnecessary + // validation. + PassRunner runner(&wasm); + runner.setIsNested(true); + runner.add(std::make_unique(*this)); + runner.run(); + NameUpdater(*this).runOnModuleCode(&runner, &wasm); + + for (auto& seg : wasm.elementSegments) { + if (seg->table) { + if (auto it = tableIndices.find(seg->table); it != tableIndices.end()) { + seg->table = wasm.tables[it->second]->name; + } + } + } + + for (auto& seg : wasm.dataSegments) { + if (seg->memory) { + if (auto it = memoryIndices.find(seg->memory); + it != memoryIndices.end()) { + seg->memory = wasm.memories[it->second]->name; + } + } + } + } if (startIndex != static_cast(-1)) { wasm.start = getFunctionName(startIndex); @@ -3232,44 +3345,7 @@ void WasmBinaryReader::processNames() { wasm.addExport(std::move(curr)); } - for (auto& [index, refs] : functionRefs) { - for (auto* ref : refs) { - *ref = getFunctionName(index); - } - } - for (auto& [index, refs] : tableRefs) { - for (auto* ref : refs) { - *ref = getTableName(index); - } - } - for (auto& [index, refs] : memoryRefs) { - for (auto ref : refs) { - *ref = getMemoryName(index); - } - } - for (auto& [index, refs] : globalRefs) { - for (auto* ref : refs) { - *ref = getGlobalName(index); - } - } - for (auto& [index, refs] : tagRefs) { - for (auto* ref : refs) { - *ref = getTagName(index); - } - } - for (auto& [index, refs] : dataRefs) { - for (auto* ref : refs) { - *ref = getDataName(index); - } - } - for (auto& [index, refs] : elemRefs) { - for (auto* ref : refs) { - *ref = getElemName(index); - } - } - // Everything now has its proper name. - wasm.updateMaps(); } @@ -3281,6 +3357,7 @@ void WasmBinaryReader::readDataSegmentCount() { for (size_t i = 0; i < dataCount; ++i) { auto curr = Builder::makeDataSegment(); curr->setName(Name::fromInt(i), false); + dataIndices[curr->name] = wasm.dataSegments.size(); wasm.addDataSegment(std::move(curr)); } } @@ -3296,6 +3373,7 @@ void WasmBinaryReader::readDataSegments() { for (size_t i = 0; i < num; ++i) { auto curr = Builder::makeDataSegment(); curr->setName(Name::fromInt(i), false); + dataIndices[curr->name] = wasm.dataSegments.size(); wasm.addDataSegment(std::move(curr)); } } @@ -3316,7 +3394,7 @@ void WasmBinaryReader::readDataSegments() { if (flags & BinaryConsts::HasIndex) { memIdx = getU32LEB(); } - memoryRefs[memIdx].push_back(&curr->memory); + curr->memory = getMemoryName(memIdx); curr->offset = readExpression(); } auto size = getU32LEB(); @@ -3343,6 +3421,7 @@ void WasmBinaryReader::readTableDeclarations() { if (is_shared) { throwError("Tables may not be shared"); } + tableIndices[table->name] = wasm.tables.size(); wasm.addTable(std::move(table)); } } @@ -3413,13 +3492,12 @@ void WasmBinaryReader::readElementSegments() { for (Index j = 0; j < size; j++) { Index index = getU32LEB(); auto sig = getTypeByFunctionIndex(index); - // Use a placeholder name for now - auto* refFunc = Builder(wasm).makeRefFunc(Name::fromInt(index), sig); - functionRefs[index].push_back(&refFunc->func); + auto* refFunc = Builder(wasm).makeRefFunc(getFunctionName(index), sig); segmentData.push_back(refFunc); } } + elemIndices[segment->name] = wasm.elementSegments.size(); wasm.addElementSegment(std::move(segment)); } } @@ -3429,8 +3507,10 @@ void WasmBinaryReader::readTags() { for (size_t i = 0; i < numTags; i++) { getInt8(); // Reserved 'attribute' field auto typeIndex = getU32LEB(); - wasm.addTag(Builder::makeTag(makeName("tag$", i), - getSignatureByTypeIndex(typeIndex))); + auto tag = + Builder::makeTag(makeName("tag$", i), getSignatureByTypeIndex(typeIndex)); + tagIndices[tag->name] = wasm.tags.size(); + wasm.addTag(std::move(tag)); } } @@ -4557,21 +4637,20 @@ void WasmBinaryReader::visitSwitch(Switch* curr) { void WasmBinaryReader::visitCall(Call* curr) { auto index = getU32LEB(); auto sig = getSignatureByFunctionIndex(index); + curr->target = getFunctionName(index); auto num = sig.params.size(); curr->operands.resize(num); for (size_t i = 0; i < num; i++) { curr->operands[num - i - 1] = popNonVoidExpression(); } curr->type = sig.results; - // We don't know function names yet. - functionRefs[index].push_back(&curr->target); curr->finalize(); } void WasmBinaryReader::visitCallIndirect(CallIndirect* curr) { auto index = getU32LEB(); curr->heapType = getTypeByIndex(index); - Index tableIdx = getU32LEB(); + curr->table = getTableName(getU32LEB()); // TODO: Handle error cases where `heapType` is not a signature? auto num = curr->heapType.getSignature().params.size(); curr->operands.resize(num); @@ -4579,8 +4658,6 @@ void WasmBinaryReader::visitCallIndirect(CallIndirect* curr) { for (size_t i = 0; i < num; i++) { curr->operands[num - i - 1] = popNonVoidExpression(); } - // Defer setting the table name for later, when we know it. - tableRefs[tableIdx].push_back(&curr->table); curr->finalize(); } @@ -4617,7 +4694,6 @@ void WasmBinaryReader::visitGlobalGet(GlobalGet* curr) { auto* global = wasm.globals[index].get(); curr->name = global->name; curr->type = global->type; - globalRefs[index].push_back(&curr->name); // we don't know the final name yet } void WasmBinaryReader::visitGlobalSet(GlobalSet* curr) { @@ -4627,7 +4703,6 @@ void WasmBinaryReader::visitGlobalSet(GlobalSet* curr) { } curr->name = wasm.globals[index]->name; curr->value = popNonVoidExpression(); - globalRefs[index].push_back(&curr->name); // we don't know the final name yet curr->finalize(); } @@ -4802,7 +4877,7 @@ bool WasmBinaryReader::maybeVisitLoad( curr->isAtomic = prefix == BinaryConsts::AtomicPrefix; Index memIdx = readMemoryAccess(curr->align, curr->offset); - memoryRefs[memIdx].push_back(&curr->memory); + curr->memory = getMemoryName(memIdx); curr->ptr = popNonVoidExpression(); curr->finalize(); out = curr; @@ -4920,7 +4995,7 @@ bool WasmBinaryReader::maybeVisitStore( curr->isAtomic = prefix == BinaryConsts::AtomicPrefix; Index memIdx = readMemoryAccess(curr->align, curr->offset); - memoryRefs[memIdx].push_back(&curr->memory); + curr->memory = getMemoryName(memIdx); curr->value = popNonVoidExpression(); curr->ptr = popNonVoidExpression(); curr->finalize(); @@ -4980,7 +5055,7 @@ bool WasmBinaryReader::maybeVisitAtomicRMW(Expression*& out, uint8_t code) { Address readAlign; Index memIdx = readMemoryAccess(readAlign, curr->offset); - memoryRefs[memIdx].push_back(&curr->memory); + curr->memory = getMemoryName(memIdx); if (readAlign != curr->bytes) { throwError("Align of AtomicRMW must match size"); } @@ -5031,7 +5106,7 @@ bool WasmBinaryReader::maybeVisitAtomicCmpxchg(Expression*& out, uint8_t code) { Address readAlign; Index memIdx = readMemoryAccess(readAlign, curr->offset); - memoryRefs[memIdx].push_back(&curr->memory); + curr->memory = getMemoryName(memIdx); if (readAlign != curr->bytes) { throwError("Align of AtomicCpxchg must match size"); } @@ -5066,7 +5141,7 @@ bool WasmBinaryReader::maybeVisitAtomicWait(Expression*& out, uint8_t code) { curr->ptr = popNonVoidExpression(); Address readAlign; Index memIdx = readMemoryAccess(readAlign, curr->offset); - memoryRefs[memIdx].push_back(&curr->memory); + curr->memory = getMemoryName(memIdx); if (readAlign != curr->expectedType.getByteSize()) { throwError("Align of AtomicWait must match size"); } @@ -5086,7 +5161,7 @@ bool WasmBinaryReader::maybeVisitAtomicNotify(Expression*& out, uint8_t code) { curr->ptr = popNonVoidExpression(); Address readAlign; Index memIdx = readMemoryAccess(readAlign, curr->offset); - memoryRefs[memIdx].push_back(&curr->memory); + curr->memory = getMemoryName(memIdx); if (readAlign != curr->type.getByteSize()) { throwError("Align of AtomicNotify must match size"); } @@ -5412,10 +5487,8 @@ bool WasmBinaryReader::maybeVisitMemoryInit(Expression*& out, uint32_t code) { curr->size = popNonVoidExpression(); curr->offset = popNonVoidExpression(); curr->dest = popNonVoidExpression(); - Index segIdx = getU32LEB(); - dataRefs[segIdx].push_back(&curr->segment); - Index memIdx = getU32LEB(); - memoryRefs[memIdx].push_back(&curr->memory); + curr->segment = getDataName(getU32LEB()); + curr->memory = getMemoryName(getU32LEB()); curr->finalize(); out = curr; return true; @@ -5426,8 +5499,7 @@ bool WasmBinaryReader::maybeVisitDataDrop(Expression*& out, uint32_t code) { return false; } auto* curr = allocator.alloc(); - Index segIdx = getU32LEB(); - dataRefs[segIdx].push_back(&curr->segment); + curr->segment = getDataName(getU32LEB()); curr->finalize(); out = curr; return true; @@ -5441,11 +5513,9 @@ bool WasmBinaryReader::maybeVisitMemoryCopy(Expression*& out, uint32_t code) { curr->size = popNonVoidExpression(); curr->source = popNonVoidExpression(); curr->dest = popNonVoidExpression(); - Index destIdx = getU32LEB(); - Index sourceIdx = getU32LEB(); + curr->destMemory = getMemoryName(getU32LEB()); + curr->sourceMemory = getMemoryName(getU32LEB()); curr->finalize(); - memoryRefs[destIdx].push_back(&curr->destMemory); - memoryRefs[sourceIdx].push_back(&curr->sourceMemory); out = curr; return true; } @@ -5458,9 +5528,8 @@ bool WasmBinaryReader::maybeVisitMemoryFill(Expression*& out, uint32_t code) { curr->size = popNonVoidExpression(); curr->value = popNonVoidExpression(); curr->dest = popNonVoidExpression(); - Index memIdx = getU32LEB(); + curr->memory = getMemoryName(getU32LEB()); curr->finalize(); - memoryRefs[memIdx].push_back(&curr->memory); out = curr; return true; } @@ -5469,17 +5538,13 @@ bool WasmBinaryReader::maybeVisitTableSize(Expression*& out, uint32_t code) { if (code != BinaryConsts::TableSize) { return false; } - Index tableIdx = getU32LEB(); - if (tableIdx >= wasm.tables.size()) { - throwError("bad table index"); - } auto* curr = allocator.alloc(); + Index tableIdx = getU32LEB(); + curr->table = getTableName(tableIdx); if (getTable(tableIdx)->is64()) { curr->type = Type::i64; } curr->finalize(); - // Defer setting the table name for later, when we know it. - tableRefs[tableIdx].push_back(&curr->table); out = curr; return true; } @@ -5488,19 +5553,15 @@ bool WasmBinaryReader::maybeVisitTableGrow(Expression*& out, uint32_t code) { if (code != BinaryConsts::TableGrow) { return false; } - Index tableIdx = getU32LEB(); - if (tableIdx >= wasm.tables.size()) { - throwError("bad table index"); - } auto* curr = allocator.alloc(); + Index tableIdx = getU32LEB(); + curr->table = getTableName(tableIdx); curr->delta = popNonVoidExpression(); curr->value = popNonVoidExpression(); if (getTable(tableIdx)->is64()) { curr->type = Type::i64; } curr->finalize(); - // Defer setting the table name for later, when we know it. - tableRefs[tableIdx].push_back(&curr->table); out = curr; return true; } @@ -5509,16 +5570,11 @@ bool WasmBinaryReader::maybeVisitTableFill(Expression*& out, uint32_t code) { if (code != BinaryConsts::TableFill) { return false; } - Index tableIdx = getU32LEB(); - if (tableIdx >= wasm.tables.size()) { - throwError("bad table index"); - } + auto table = getTableName(getU32LEB()); auto* size = popNonVoidExpression(); auto* value = popNonVoidExpression(); auto* dest = popNonVoidExpression(); - auto* ret = Builder(wasm).makeTableFill(Name(), dest, value, size); - tableRefs[tableIdx].push_back(&ret->table); - out = ret; + out = Builder(wasm).makeTableFill(table, dest, value, size); return true; } @@ -5526,21 +5582,12 @@ bool WasmBinaryReader::maybeVisitTableCopy(Expression*& out, uint32_t code) { if (code != BinaryConsts::TableCopy) { return false; } - Index destTableIdx = getU32LEB(); - if (destTableIdx >= wasm.tables.size()) { - throwError("bad table index"); - } - Index sourceTableIdx = getU32LEB(); - if (sourceTableIdx >= wasm.tables.size()) { - throwError("bad table index"); - } + auto destTable = getTableName(getU32LEB()); + auto srcTable = getTableName(getU32LEB()); auto* size = popNonVoidExpression(); auto* source = popNonVoidExpression(); auto* dest = popNonVoidExpression(); - auto* ret = Builder(wasm).makeTableCopy(dest, source, size, Name(), Name()); - tableRefs[destTableIdx].push_back(&ret->destTable); - tableRefs[sourceTableIdx].push_back(&ret->sourceTable); - out = ret; + out = Builder(wasm).makeTableCopy(dest, source, size, destTable, srcTable); return true; } @@ -5552,10 +5599,8 @@ bool WasmBinaryReader::maybeVisitTableInit(Expression*& out, uint32_t code) { curr->size = popNonVoidExpression(); curr->offset = popNonVoidExpression(); curr->dest = popNonVoidExpression(); - Index segIdx = getU32LEB(); - elemRefs[segIdx].push_back(&curr->segment); - Index memIdx = getU32LEB(); - tableRefs[memIdx].push_back(&curr->table); + curr->segment = getElemName(getU32LEB()); + curr->table = getTableName(getU32LEB()); curr->finalize(); out = curr; return true; @@ -6553,7 +6598,7 @@ bool WasmBinaryReader::maybeVisitSIMDStore(Expression*& out, uint32_t code) { curr->bytes = 16; curr->valueType = Type::v128; Index memIdx = readMemoryAccess(curr->align, curr->offset); - memoryRefs[memIdx].push_back(&curr->memory); + curr->memory = getMemoryName(memIdx); curr->isAtomic = false; curr->value = popNonVoidExpression(); curr->ptr = popNonVoidExpression(); @@ -6811,7 +6856,7 @@ bool WasmBinaryReader::maybeVisitSIMDLoad(Expression*& out, uint32_t code) { curr->type = Type::v128; curr->bytes = 16; Index memIdx = readMemoryAccess(curr->align, curr->offset); - memoryRefs[memIdx].push_back(&curr->memory); + curr->memory = getMemoryName(memIdx); curr->isAtomic = false; curr->ptr = popNonVoidExpression(); curr->finalize(); @@ -6872,7 +6917,7 @@ bool WasmBinaryReader::maybeVisitSIMDLoad(Expression*& out, uint32_t code) { return false; } Index memIdx = readMemoryAccess(curr->align, curr->offset); - memoryRefs[memIdx].push_back(&curr->memory); + curr->memory = getMemoryName(memIdx); curr->ptr = popNonVoidExpression(); curr->finalize(); out = curr; @@ -6922,7 +6967,7 @@ bool WasmBinaryReader::maybeVisitSIMDLoadStoreLane(Expression*& out, auto* curr = allocator.alloc(); curr->op = op; Index memIdx = readMemoryAccess(curr->align, curr->offset); - memoryRefs[memIdx].push_back(&curr->memory); + curr->memory = getMemoryName(memIdx); curr->index = getLaneIndex(lanes); curr->vec = popNonVoidExpression(); curr->ptr = popNonVoidExpression(); @@ -6965,20 +7010,21 @@ void WasmBinaryReader::visitReturn(Return* curr) { void WasmBinaryReader::visitMemorySize(MemorySize* curr) { Index index = getU32LEB(); + curr->memory = getMemoryName(index); if (getMemory(index)->is64()) { curr->type = Type::i64; } curr->finalize(); - memoryRefs[index].push_back(&curr->memory); } void WasmBinaryReader::visitMemoryGrow(MemoryGrow* curr) { - curr->delta = popNonVoidExpression(); Index index = getU32LEB(); + curr->memory = getMemoryName(index); if (getMemory(index)->is64()) { curr->type = Type::i64; } - memoryRefs[index].push_back(&curr->memory); + curr->delta = popNonVoidExpression(); + curr->finalize(); } void WasmBinaryReader::visitNop(Nop* curr) {} @@ -7001,14 +7047,9 @@ void WasmBinaryReader::visitRefIsNull(RefIsNull* curr) { void WasmBinaryReader::visitRefFunc(RefFunc* curr) { Index index = getU32LEB(); - // We don't know function names yet, so record this use to be updated later. - // Note that we do not need to check that 'index' is in bounds, as that will - // be verified in the next line. (Also, note that functionRefs[index] may - // write to an odd place in the functionRefs map if index is invalid, but that - // is harmless.) - functionRefs[index].push_back(&curr->func); // To support typed function refs, we give the reference not just a general // funcref, but a specific subtype with the actual signature. + curr->func = getFunctionName(index); curr->finalize(Type(getTypeByFunctionIndex(index), NonNullable)); } @@ -7020,26 +7061,18 @@ void WasmBinaryReader::visitRefEq(RefEq* curr) { void WasmBinaryReader::visitTableGet(TableGet* curr) { Index tableIdx = getU32LEB(); - if (tableIdx >= wasm.tables.size()) { - throwError("bad table index"); - } + curr->table = getTableName(tableIdx); curr->index = popNonVoidExpression(); curr->type = wasm.tables[tableIdx]->type; curr->finalize(); - // Defer setting the table name for later, when we know it. - tableRefs[tableIdx].push_back(&curr->table); } void WasmBinaryReader::visitTableSet(TableSet* curr) { Index tableIdx = getU32LEB(); - if (tableIdx >= wasm.tables.size()) { - throwError("bad table index"); - } + curr->table = getTableName(tableIdx); curr->value = popNonVoidExpression(); curr->index = popNonVoidExpression(); curr->finalize(); - // Defer setting the table name for later, when we know it. - tableRefs[tableIdx].push_back(&curr->table); } void WasmBinaryReader::visitTryOrTryInBlock(Expression*& out) { @@ -7076,11 +7109,6 @@ void WasmBinaryReader::visitTryOrTryInBlock(Expression*& out) { } }; - // We cannot immediately update tagRefs in the loop below, as catchTags is - // being grown, an so references would get invalidated. Store the indexes - // here, then do that later. - std::vector tagIndexes; - while (lastSeparator == BinaryConsts::Catch_Legacy || lastSeparator == BinaryConsts::CatchAll_Legacy) { if (lastSeparator == BinaryConsts::Catch_Legacy) { @@ -7088,7 +7116,6 @@ void WasmBinaryReader::visitTryOrTryInBlock(Expression*& out) { if (index >= wasm.tags.size()) { throwError("bad tag index"); } - tagIndexes.push_back(index); auto* tag = wasm.tags[index].get(); curr->catchTags.push_back(tag->name); readCatchBody(tag->sig.params); @@ -7101,11 +7128,6 @@ void WasmBinaryReader::visitTryOrTryInBlock(Expression*& out) { } breakStack.pop_back(); - for (Index i = 0; i < tagIndexes.size(); i++) { - // We don't know the final name yet. - tagRefs[tagIndexes[i]].push_back(&curr->catchTags[i]); - } - if (lastSeparator == BinaryConsts::Delegate) { curr->delegateTarget = getExceptionTargetName(getU32LEB()); } @@ -7200,10 +7222,6 @@ void WasmBinaryReader::visitTryTable(TryTable* curr) { // within each try-body, and let branches target those inner blocks instead. curr->type = getType(); auto numCatches = getU32LEB(); - // We cannot immediately update tagRefs in the loop below, as catchTags is - // being grown, an so references would get invalidated. Store the indexes - // here, then do that later. - std::vector tagIndexes; for (size_t i = 0; i < numCatches; i++) { uint8_t code = getInt8(); @@ -7212,11 +7230,9 @@ void WasmBinaryReader::visitTryTable(TryTable* curr) { if (index >= wasm.tags.size()) { throwError("bad tag index"); } - tagIndexes.push_back(index); auto* tag = wasm.tags[index].get(); curr->catchTags.push_back(tag->name); } else { - tagIndexes.push_back(-1); // unused curr->catchTags.push_back(Name()); } curr->catchDests.push_back(getBreakTarget(getU32LEB()).name); @@ -7224,13 +7240,6 @@ void WasmBinaryReader::visitTryTable(TryTable* curr) { code == BinaryConsts::CatchAllRef); } - for (Index i = 0; i < tagIndexes.size(); i++) { - if (curr->catchTags[i]) { - // We don't know the final name yet. - tagRefs[tagIndexes[i]].push_back(&curr->catchTags[i]); - } - } - // catch_*** clauses should refer to block labels without entering the try // scope. So we do this after reading catch clauses. startControlFlow(curr); @@ -7245,7 +7254,6 @@ void WasmBinaryReader::visitThrow(Throw* curr) { } auto* tag = wasm.tags[index].get(); curr->tag = tag->name; - tagRefs[index].push_back(&curr->tag); // we don't know the final name yet size_t num = tag->sig.params.size(); curr->operands.resize(num); for (size_t i = 0; i < num; i++) { @@ -7493,18 +7501,13 @@ bool WasmBinaryReader::maybeVisitArrayNewElem(Expression*& out, uint32_t code) { throwError("Expected array heaptype"); } auto segIdx = getU32LEB(); + auto segment = isData ? getDataName(segIdx) : getElemName(segIdx); auto* size = popNonVoidExpression(); auto* offset = popNonVoidExpression(); if (isData) { - auto* curr = - Builder(wasm).makeArrayNewData(heapType, Name(), offset, size); - dataRefs[segIdx].push_back(&curr->segment); - out = curr; + out = Builder(wasm).makeArrayNewData(heapType, segment, offset, size); } else { - auto* curr = - Builder(wasm).makeArrayNewElem(heapType, Name(), offset, size); - elemRefs[segIdx].push_back(&curr->segment); - out = curr; + out = Builder(wasm).makeArrayNewElem(heapType, segment, offset, size); } return true; } @@ -7635,21 +7638,16 @@ bool WasmBinaryReader::maybeVisitArrayInit(Expression*& out, uint32_t code) { throwError("Expected array heaptype"); } Index segIdx = getU32LEB(); + auto segment = isData ? getDataName(segIdx) : getElemName(segIdx); auto* size = popNonVoidExpression(); auto* offset = popNonVoidExpression(); auto* index = popNonVoidExpression(); auto* ref = popNonVoidExpression(); validateHeapTypeUsingChild(ref, heapType); if (isData) { - auto* curr = - Builder(wasm).makeArrayInitData(Name(), ref, index, offset, size); - dataRefs[segIdx].push_back(&curr->segment); - out = curr; + out = Builder(wasm).makeArrayInitData(segment, ref, index, offset, size); } else { - auto* curr = - Builder(wasm).makeArrayInitElem(Name(), ref, index, offset, size); - elemRefs[segIdx].push_back(&curr->segment); - out = curr; + out = Builder(wasm).makeArrayInitElem(segment, ref, index, offset, size); } return true; } @@ -7858,25 +7856,12 @@ void WasmBinaryReader::visitResume(Resume* curr) { } auto numHandlers = getU32LEB(); - - // We *must* bring the handlerTags vector to an appropriate size to ensure - // that we do not invalidate the pointers we add to tagRefs. They need to stay - // valid until processNames ran. curr->handlerTags.resize(numHandlers); curr->handlerBlocks.resize(numHandlers); for (size_t i = 0; i < numHandlers; i++) { - auto tagIndex = getU32LEB(); - auto tag = getTagName(tagIndex); - - auto handlerIndex = getU32LEB(); - auto handler = getBreakTarget(handlerIndex).name; - - curr->handlerTags[i] = tag; - curr->handlerBlocks[i] = handler; - - // We don't know the final name yet - tagRefs[tagIndex].push_back(&curr->handlerTags[i]); + curr->handlerTags[i] = getTagName(getU32LEB()); + curr->handlerBlocks[i] = getBreakTarget(getU32LEB()).name; } curr->cont = popNonVoidExpression(); @@ -7892,14 +7877,9 @@ void WasmBinaryReader::visitResume(Resume* curr) { } void WasmBinaryReader::visitSuspend(Suspend* curr) { - auto tagIndex = getU32LEB(); - if (tagIndex >= wasm.tags.size()) { - throwError("bad tag index"); - } + curr->tag = getTagName(tagIndex); auto* tag = wasm.tags[tagIndex].get(); - curr->tag = tag->name; - tagRefs[tagIndex].push_back(&curr->tag); auto numArgs = tag->sig.params.size(); curr->operands.resize(numArgs); From 8f4ca9f5e87c4921ce46eb316b0f281ba80c64f6 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Thu, 19 Sep 2024 14:18:22 -0700 Subject: [PATCH 04/56] skip unparsed functions when printing --- src/ir/module-utils.cpp | 5 ++++- src/passes/Print.cpp | 3 +++ src/wasm/wasm-binary.cpp | 7 ++----- test/lit/binary/debug-bad-binary.test | 6 ------ 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/ir/module-utils.cpp b/src/ir/module-utils.cpp index 1efbe490a07..490955866b0 100644 --- a/src/ir/module-utils.cpp +++ b/src/ir/module-utils.cpp @@ -448,7 +448,10 @@ InsertOrderedMap collectHeapTypeInfo( for (auto type : func->vars) { info.note(type); } - if (!func->imported()) { + // Don't just use `func->imported()` here because we also might be + // printing an error message on a partially parsed module whose declared + // function bodies have not all been parsed yet. + if (func->body) { CodeScanner(wasm, info, inclusion).walk(func->body); } }); diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index 46d519e9eda..d49bc297472 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -2980,6 +2980,9 @@ void PrintSExpression::visitDefinedGlobal(Global* curr) { void PrintSExpression::visitFunction(Function* curr) { if (curr->imported()) { visitImportedFunction(curr); + } else if (curr->body == nullptr) { + // We are in the middle of parsing the module and have not parsed this + // function's code yet. Skip it. } else { visitDefinedFunction(curr); } diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index 96e9317094b..d999141fd4a 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -2600,11 +2600,8 @@ void WasmBinaryReader::readFunctionSignatures() { functionTypes.push_back(type); // Check that the type is a signature. getSignatureByTypeIndex(index); - // Create the function with a placeholder body so we don't trip over it if - // we have to print it as part of an error message. - Builder builder(wasm); - wasm.addFunction(builder.makeFunction( - makeName("", i), type, {}, builder.makeUnreachable())); + wasm.addFunction( + Builder(wasm).makeFunction(makeName("", i), type, {}, nullptr)); } } diff --git a/test/lit/binary/debug-bad-binary.test b/test/lit/binary/debug-bad-binary.test index 634146a7653..63a2ed2ccac 100644 --- a/test/lit/binary/debug-bad-binary.test +++ b/test/lit/binary/debug-bad-binary.test @@ -38,10 +38,4 @@ RUN: not wasm-opt --debug %s.wasm 2>&1 | filecheck %s ;; CHECK-NEXT: (i32.const 10) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) -;; CHECK-NEXT: (func $1 -;; CHECK-NEXT: (unreachable) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (func $2 -;; CHECK-NEXT: (unreachable) -;; CHECK-NEXT: ) ;; CHECK-NEXT: ) From 8d8eb1397e6c6c0b108f2895c7a6007ee8438b0d Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Thu, 19 Sep 2024 15:19:48 -0700 Subject: [PATCH 05/56] update and fix test of datacount error --- src/passes/Print.cpp | 5 +++++ test/lit/binary/bad-datacount.test | 9 +++++++++ .../binary/bad-datacount.test.wasm} | Bin test/unit/test_datacount.py | 15 --------------- 4 files changed, 14 insertions(+), 15 deletions(-) create mode 100644 test/lit/binary/bad-datacount.test rename test/{unit/input/bulkmem_bad_datacount.wasm => lit/binary/bad-datacount.test.wasm} (100%) delete mode 100644 test/unit/test_datacount.py diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index 46d519e9eda..2fbdb62798f 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -3235,6 +3235,11 @@ void PrintSExpression::visitMemory(Memory* curr) { } void PrintSExpression::visitDataSegment(DataSegment* curr) { + if (!curr->isPassive && !curr->offset) { + // This data segment must have been created from the datacount section but + // not parsed yet. Skip it. + return; + } doIndent(o, indent); o << '('; printMajor(o, "data "); diff --git a/test/lit/binary/bad-datacount.test b/test/lit/binary/bad-datacount.test new file mode 100644 index 00000000000..27e0c72a398 --- /dev/null +++ b/test/lit/binary/bad-datacount.test @@ -0,0 +1,9 @@ +RUN: not wasm-opt --debug %s.wasm 2>&1 | filecheck %s + +;; Check that we get the expected error. + +;; CHECK: data count and data sections disagree on size + +;; Check that we print out the module rather than hitting an assertion error. + +;; CHECK: (module diff --git a/test/unit/input/bulkmem_bad_datacount.wasm b/test/lit/binary/bad-datacount.test.wasm similarity index 100% rename from test/unit/input/bulkmem_bad_datacount.wasm rename to test/lit/binary/bad-datacount.test.wasm diff --git a/test/unit/test_datacount.py b/test/unit/test_datacount.py deleted file mode 100644 index b996865a53c..00000000000 --- a/test/unit/test_datacount.py +++ /dev/null @@ -1,15 +0,0 @@ -from scripts.test import shared -from . import utils - - -class DataCountTest(utils.BinaryenTestCase): - def test_datacount(self): - self.roundtrip('bulkmem_data.wasm') - - def test_bad_datacount(self): - path = self.input_path('bulkmem_bad_datacount.wasm') - p = shared.run_process(shared.WASM_OPT + ['-g', '-o', '-', path], - check=False, capture_output=True) - self.assertNotEqual(p.returncode, 0) - self.assertIn('Number of segments does not agree with DataCount section', - p.stderr) From 4d5096fc9bdb93bab1290a55cc529fb4a41eb001 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Wed, 18 Sep 2024 16:18:02 -0700 Subject: [PATCH 06/56] Use IRBuilder in the binary parser IRBuilder is a utility for turning arbitrary valid streams of Wasm instructions into valid Binaryen IR. It is already used in the text parser, so now use it in the binary parser as well. Since the IRBuilder API for building each intruction requires only the information that the binary and text formats include as immediates to that instruction, the parser is now much simpler than before. In particular, it does not need to manage a stack of instructions to figure out what the children of each expression should be; IRBuilder handles this instead. There are some differences between the IR constructed by IRBuilder and the IR the binary parser constructed before this change. Most importantly, IRBuilder generates better multivalue code because it avoids eagerly breaking up multivalue results into individual components that might need to be immediately reassembled into a tuple. It also parses try-delegate more correctly, allowing the delegate to target arbitrary labels, not just other `try`s. There are also a couple superficial differences in the generated label and scratch local names. There are two remaining bugs: First, support for creating DWARF location spans is missing because IRBuilder does not have an API for that yet (but source map locations work fine). Second, IRBuilder generates pops inside nameless blocks in some circumstances involving stacky code. This is currently an IR validation error, so #6950 will have to be resolved before this can land. This change also makes the binary parser significantly slower (by about 50%). The lowest hanging performance fruit seems to be tracking branch targets in IRBuilder to avoid having to scan for branches when finalizing blocks. --- src/wasm-binary.h | 190 +- src/wasm-ir-builder.h | 4 + src/wasm/wasm-binary.cpp | 5603 +++++------------ test/br_to_exit.wasm.fromBinary | 4 +- test/br_to_try.wasm.fromBinary | 16 +- test/break-to-return.wasm.fromBinary | 4 +- test/break-within-catch.wasm.fromBinary | 6 +- test/consume-stacky.wasm.fromBinary | 6 +- test/elided-br.wasm.fromBinary | 5 +- test/example/c-api-unused-mem.txt | 4 +- test/fib-dbg.wasm.fromBinary | 32 +- ...fn_prolog_epilog.debugInfo.wasm.fromBinary | 6 +- test/lit/basic/exception-handling-legacy.wast | 368 +- test/lit/basic/exception-handling.wast | 576 +- .../lit/basic/fn_prolog_epilog.debugInfo.wast | 12 +- test/lit/basic/min.wast | 28 +- test/lit/basic/polymorphic_stack.wast | 82 +- test/lit/basic/reference-types.wast | 228 +- test/lit/basic/reg_switch.wast | 8 +- .../lit/basic/typed_continuations_resume.wast | 70 +- test/lit/basic/types-function-references.wast | 58 +- test/lit/basic/unit.wat | 226 +- test/lit/basic/unreachable-code.wast | 30 +- test/lit/basic/untaken-br_if.wast | 16 +- test/lit/binary/bad-delegate.test | 17 - .../binary/declarative-element-use-expr.test | 8 +- test/lit/binary/delegate-block.test | 27 + ...ate.test.wasm => delegate-block.test.wasm} | Bin test/lit/binary/dwarf-multivalue.test | 8 +- test/lit/binary/stacky-eh-legacy.test | 2 +- test/lit/binary/stacky-nn-tuple.test | 2 +- test/lit/blocktype.wast | 52 +- test/lit/cast-and-recast-tuple.wast | 383 +- test/lit/cast-and-recast.wast | 28 +- test/lit/cast-to-basic.wast | 12 +- test/lit/debug/source-map-stop.wast | 2 + test/lit/downgrade-reftypes.wast | 16 +- test/lit/multivalue-stack-ir.wast | 6 +- test/lit/multivalue.wast | 328 +- test/lit/parse-double-unreachable.wast | 19 +- test/lit/passes/roundtrip-gc.wast | 8 +- test/lit/passes/roundtrip.wast | 27 +- test/lit/passes/signature-refining_gto.wat | 4 +- .../passes/stack-ir-roundtrip-eh-legacy.wast | 6 +- test/lit/reftypes-without-gc.wast | 4 +- test/lit/source-map.wast | 8 +- test/lit/string.as_wtf16.wast | 100 +- test/lld/em_asm_pthread.wasm.out | 1903 +++--- test/lld/shared_add_to_table.wasm.out | 1 + test/passes/O.bin.txt | 8 +- test/passes/converge_O3_metrics.bin.txt | 36 +- .../dce_vacuum_remove-unused-names.bin.txt | 12 +- test/passes/flatten.bin.txt | 114 +- test/passes/print.bin.txt | 8 +- test/passes/print_g_metrics.bin.txt | 8 +- test/reduce/memory_table.wast.txt | 1 + test/stacky.wasm.fromBinary | 6 +- test/try-delegate.wasm.fromBinary | 37 +- test/unreachable-pops.wasm.fromBinary | 3 +- 59 files changed, 3928 insertions(+), 6858 deletions(-) delete mode 100644 test/lit/binary/bad-delegate.test create mode 100644 test/lit/binary/delegate-block.test rename test/lit/binary/{bad-delegate.test.wasm => delegate-block.test.wasm} (100%) diff --git a/src/wasm-binary.h b/src/wasm-binary.h index c394c400855..412b2d97288 100644 --- a/src/wasm-binary.h +++ b/src/wasm-binary.h @@ -29,6 +29,7 @@ #include "ir/module-utils.h" #include "parsing.h" #include "wasm-builder.h" +#include "wasm-ir-builder.h" #include "wasm-traversal.h" #include "wasm-validator.h" #include "wasm.h" @@ -1543,10 +1544,6 @@ class WasmBinaryReader { Signature getSignatureByTypeIndex(Index index); Signature getSignatureByFunctionIndex(Index index); - size_t nextLabel; - - Name getNextLabel(); - // We read functions, globals, etc. before we know their final names, so we // need to backpatch the names later. Map the original names to their indices // so we can find the final names based on index. @@ -1559,18 +1556,14 @@ class WasmBinaryReader { std::unordered_map elemIndices; Function* currFunction = nullptr; - // before we see a function (like global init expressions), there is no end of - // function to check - Index endOfFunction = -1; std::map elemTables; - // Throws a parsing error if we are not in a function context - void requireFunctionContext(const char* error); - void readFunctions(); void readVars(); + [[nodiscard]] Result<> readInst(); + std::map exportIndices; std::vector> exportOrder; void readExports(); @@ -1578,62 +1571,12 @@ class WasmBinaryReader { // The strings in the strings section (which are referred to by StringConst). std::vector strings; void readStrings(); + Name getIndexedString(); Expression* readExpression(); void readGlobals(); - struct BreakTarget { - Name name; - Type type; - BreakTarget(Name name, Type type) : name(name), type(type) {} - }; - std::vector breakStack; - // the names that breaks target. this lets us know if a block has breaks to it - // or not. - std::unordered_set breakTargetNames; - // the names that delegates target. - std::unordered_set exceptionTargetNames; - - std::vector expressionStack; - - // Control flow structure parsing: these have not just the normal binary - // data for an instruction, but also some bytes later on like "end" or "else". - // We must be aware of the connection between those things, for debug info. - std::vector controlFlowStack; - - // Called when we parse the beginning of a control flow structure. - void startControlFlow(Expression* curr); - - // set when we know code is unreachable in the sense of the wasm spec: we are - // in a block and after an unreachable element. this helps parse stacky wasm - // code, which can be unsuitable for our IR when unreachable. - bool unreachableInTheWasmSense; - - // set when the current code being processed will not be emitted in the - // output, which is the case when it is literally unreachable, for example, - // (block $a - // (unreachable) - // (block $b - // ;; code here is reachable in the wasm sense, even though $b as a whole - // ;; is not - // (unreachable) - // ;; code here is unreachable in the wasm sense - // ) - // ) - bool willBeIgnored; - - BinaryConsts::ASTNodes lastSeparator = BinaryConsts::End; - - // process a block-type scope, until an end or else marker, or the end of the - // function - void processExpressions(); - void skipUnreachableCode(); - - void pushExpression(Expression* curr); - Expression* popExpression(); - Expression* popNonVoidExpression(); - Expression* popTuple(size_t numElems); - Expression* popTypedExpression(Type type); + IRBuilder builder; void validateBinary(); // validations that cannot be performed on the Module void processNames(); @@ -1661,127 +1604,12 @@ class WasmBinaryReader { void readNextDebugLocation(); void readSourceMapHeader(); - // AST reading - int depth = 0; // only for debugging - - BinaryConsts::ASTNodes readExpression(Expression*& curr); - void pushBlockElements(Block* curr, Type type, size_t start); - void visitBlock(Block* curr); - - // Gets a block of expressions. If it's just one, return that singleton. - Expression* getBlockOrSingleton(Type type); - - BreakTarget getBreakTarget(int32_t offset); - Name getExceptionTargetName(int32_t offset); - Index readMemoryAccess(Address& alignment, Address& offset); + std::tuple getMemarg(); - void visitIf(If* curr); - void visitLoop(Loop* curr); - void visitBreak(Break* curr, uint8_t code); - void visitSwitch(Switch* curr); - void visitCall(Call* curr); - void visitCallIndirect(CallIndirect* curr); - void visitLocalGet(LocalGet* curr); - void visitLocalSet(LocalSet* curr, uint8_t code); - void visitGlobalGet(GlobalGet* curr); - void visitGlobalSet(GlobalSet* curr); - bool maybeVisitLoad(Expression*& out, - uint8_t code, - std::optional prefix); - bool maybeVisitStore(Expression*& out, - uint8_t code, - std::optional prefix); - bool maybeVisitNontrappingTrunc(Expression*& out, uint32_t code); - bool maybeVisitAtomicRMW(Expression*& out, uint8_t code); - bool maybeVisitAtomicCmpxchg(Expression*& out, uint8_t code); - bool maybeVisitAtomicWait(Expression*& out, uint8_t code); - bool maybeVisitAtomicNotify(Expression*& out, uint8_t code); - bool maybeVisitAtomicFence(Expression*& out, uint8_t code); - bool maybeVisitConst(Expression*& out, uint8_t code); - bool maybeVisitUnary(Expression*& out, uint8_t code); - bool maybeVisitBinary(Expression*& out, uint8_t code); - bool maybeVisitTruncSat(Expression*& out, uint32_t code); - bool maybeVisitSIMDBinary(Expression*& out, uint32_t code); - bool maybeVisitSIMDUnary(Expression*& out, uint32_t code); - bool maybeVisitSIMDConst(Expression*& out, uint32_t code); - bool maybeVisitSIMDStore(Expression*& out, uint32_t code); - bool maybeVisitSIMDExtract(Expression*& out, uint32_t code); - bool maybeVisitSIMDReplace(Expression*& out, uint32_t code); - bool maybeVisitSIMDShuffle(Expression*& out, uint32_t code); - bool maybeVisitSIMDTernary(Expression*& out, uint32_t code); - bool maybeVisitSIMDShift(Expression*& out, uint32_t code); - bool maybeVisitSIMDLoad(Expression*& out, uint32_t code); - bool maybeVisitSIMDLoadStoreLane(Expression*& out, uint32_t code); - bool maybeVisitMemoryInit(Expression*& out, uint32_t code); - bool maybeVisitDataDrop(Expression*& out, uint32_t code); - bool maybeVisitMemoryCopy(Expression*& out, uint32_t code); - bool maybeVisitMemoryFill(Expression*& out, uint32_t code); - bool maybeVisitTableSize(Expression*& out, uint32_t code); - bool maybeVisitTableGrow(Expression*& out, uint32_t code); - bool maybeVisitTableFill(Expression*& out, uint32_t code); - bool maybeVisitTableCopy(Expression*& out, uint32_t code); - bool maybeVisitTableInit(Expression*& out, uint32_t code); - bool maybeVisitRefI31(Expression*& out, uint32_t code); - bool maybeVisitI31Get(Expression*& out, uint32_t code); - bool maybeVisitRefTest(Expression*& out, uint32_t code); - bool maybeVisitRefCast(Expression*& out, uint32_t code); - bool maybeVisitBrOn(Expression*& out, uint32_t code); - bool maybeVisitStructNew(Expression*& out, uint32_t code); - bool maybeVisitStructGet(Expression*& out, uint32_t code); - bool maybeVisitStructSet(Expression*& out, uint32_t code); - bool maybeVisitArrayNewData(Expression*& out, uint32_t code); - bool maybeVisitArrayNewElem(Expression*& out, uint32_t code); - bool maybeVisitArrayNewFixed(Expression*& out, uint32_t code); - bool maybeVisitArrayGet(Expression*& out, uint32_t code); - bool maybeVisitArraySet(Expression*& out, uint32_t code); - bool maybeVisitArrayLen(Expression*& out, uint32_t code); - bool maybeVisitArrayCopy(Expression*& out, uint32_t code); - bool maybeVisitArrayFill(Expression*& out, uint32_t code); - bool maybeVisitArrayInit(Expression*& out, uint32_t code); - bool maybeVisitStringNew(Expression*& out, uint32_t code); - bool maybeVisitStringAsWTF16(Expression*& out, uint32_t code); - bool maybeVisitStringConst(Expression*& out, uint32_t code); - bool maybeVisitStringMeasure(Expression*& out, uint32_t code); - bool maybeVisitStringEncode(Expression*& out, uint32_t code); - bool maybeVisitStringConcat(Expression*& out, uint32_t code); - bool maybeVisitStringEq(Expression*& out, uint32_t code); - bool maybeVisitStringWTF16Get(Expression*& out, uint32_t code); - bool maybeVisitStringSliceWTF(Expression*& out, uint32_t code); - void visitSelect(Select* curr, uint8_t code); - void visitReturn(Return* curr); - void visitMemorySize(MemorySize* curr); - void visitMemoryGrow(MemoryGrow* curr); - void visitNop(Nop* curr); - void visitUnreachable(Unreachable* curr); - void visitDrop(Drop* curr); - void visitRefNull(RefNull* curr); - void visitRefIsNull(RefIsNull* curr); - void visitRefFunc(RefFunc* curr); - void visitRefEq(RefEq* curr); - void visitTableGet(TableGet* curr); - void visitTableSet(TableSet* curr); - void visitTryOrTryInBlock(Expression*& out); - void visitTryTable(TryTable* curr); - void visitThrow(Throw* curr); - void visitRethrow(Rethrow* curr); - void visitThrowRef(ThrowRef* curr); - void visitCallRef(CallRef* curr); - void visitRefAsCast(RefCast* curr, uint32_t code); - void visitRefAs(RefAs* curr, uint8_t code); - void visitContNew(ContNew* curr); - void visitContBind(ContBind* curr); - void visitResume(Resume* curr); - void visitSuspend(Suspend* curr); - - [[noreturn]] void throwError(std::string text); - - // Struct/Array instructions have an unnecessary heap type that is just for - // validation (except for the case of unreachability, but that's not a problem - // anyhow, we can ignore it there). That is, we also have a reference typed - // child from which we can infer the type anyhow, and we just need to check - // that type is the same. - void validateHeapTypeUsingChild(Expression* child, HeapType heapType); + [[noreturn]] void throwError(std::string text) { + throw ParseException(text, 0, pos); + } private: bool hasDWARFSections(); diff --git a/src/wasm-ir-builder.h b/src/wasm-ir-builder.h index d7a1dde87b9..d968dd96868 100644 --- a/src/wasm-ir-builder.h +++ b/src/wasm-ir-builder.h @@ -48,6 +48,10 @@ class IRBuilder : public UnifiedExpressionVisitor> { // of instructions after this is called. [[nodiscard]] Result build(); + // If the IRBuilder is empty, then it's ready to parse a new self-contained + // sequence of instructions. + [[nodiscard]] bool empty() { return scopeStack.empty(); } + // Call visit() on an existing Expression with its non-child fields // initialized to initialize the child fields and refinalize it. [[nodiscard]] Result<> visit(Expression*); diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index a5139552bad..ba8bd39e45d 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -1714,7 +1714,7 @@ WasmBinaryReader::WasmBinaryReader(Module& wasm, const std::vector& input) : wasm(wasm), allocator(wasm.allocator), input(input), sourceMap(nullptr), nextDebugPos(0), nextDebugLocation{0, 0, 0}, - nextDebugLocationHasDebugInfo(false), debugLocation() { + nextDebugLocationHasDebugInfo(false), debugLocation(), builder(wasm) { wasm.features = features; } @@ -2585,17 +2585,6 @@ void WasmBinaryReader::readImports() { numFuncImports = wasm.functions.size(); } -Name WasmBinaryReader::getNextLabel() { - requireFunctionContext("getting a label"); - return makeName("label$", nextLabel++); -} - -void WasmBinaryReader::requireFunctionContext(const char* error) { - if (!currFunction) { - throwError(std::string("in a non-function context: ") + error); - } -} - void WasmBinaryReader::readFunctionSignatures() { size_t num = getU32LEB(); for (size_t i = 0; i < num; i++) { @@ -2652,7 +2641,7 @@ void WasmBinaryReader::readFunctions() { if (size == 0) { throwError("empty function size"); } - endOfFunction = pos + size; + Index endOfFunction = pos + size; auto& func = wasm.functions[numFuncImports + i]; currFunction = func.get(); @@ -2670,49 +2659,38 @@ void WasmBinaryReader::readFunctions() { func->prologLocation = debugLocation; { - // process the function body - nextLabel = 0; - willBeIgnored = false; - // process body - assert(breakStack.empty()); - assert(breakTargetNames.empty()); - assert(exceptionTargetNames.empty()); - assert(expressionStack.empty()); - assert(controlFlowStack.empty()); - assert(depth == 0); - // Even if we are skipping function bodies we need to not skip the start - // function. That contains important code for wasm-emscripten-finalize in - // the form of pthread-related segment initializations. As this is just - // one function, it doesn't add significant time, so the optimization of - // skipping bodies is still very useful. + // Process the function body. Even if we are skipping function bodies we + // need to not skip the start function. That contains important code for + // wasm-emscripten-finalize in the form of pthread-related segment + // initializations. As this is just one function, it doesn't add + // significant time, so the optimization of skipping bodies is still very + // useful. auto currFunctionIndex = wasm.functions.size(); bool isStart = startIndex == currFunctionIndex; - if (!skipFunctionBodies || isStart) { - func->body = getBlockOrSingleton(func->getResults()); - } else { + if (skipFunctionBodies && !isStart) { // When skipping the function body we need to put something valid in // their place so we validate. An unreachable is always acceptable // there. func->body = Builder(wasm).makeUnreachable(); - // Skip reading the contents. pos = endOfFunction; - } - assert(depth == 0); - assert(breakStack.empty()); - assert(breakTargetNames.empty()); - if (!exceptionTargetNames.empty()) { - // A delegate index existed that did not end up referring to any valid - // outer try-catch (we remove valid ones from exceptionTargetNames as we - // go). - throwError("exceptionTargetNames not empty - invalid delegate"); - } - if (!expressionStack.empty()) { - throwError("stack not empty on function exit"); - } - assert(controlFlowStack.empty()); - if (pos != endOfFunction) { - throwError("binary offset at function exit not at expected location"); + } else { + auto start = builder.visitFunctionStart(func.get()); + if (auto* err = start.getErr()) { + throwError(err->msg); + } + while (pos < endOfFunction) { + auto inst = readInst(); + if (auto* err = inst.getErr()) { + throwError(err->msg); + } + } + if (pos != endOfFunction) { + throwError("function overflowed its bounds"); + } + if (!builder.empty()) { + throwError("expected function end"); + } } } @@ -2744,6 +2722,1362 @@ void WasmBinaryReader::readVars() { } } +Result<> WasmBinaryReader::readInst() { + readNextDebugLocation(); + if (debugLocation.size()) { + builder.setDebugLocation(*debugLocation.begin()); + } + uint8_t code = getInt8(); + switch (code) { + case BinaryConsts::Block: + return builder.makeBlock(Name(), getType()); + case BinaryConsts::If: + return builder.makeIf(Name(), getType()); + case BinaryConsts::Loop: + return builder.makeLoop(Name(), getType()); + case BinaryConsts::Br: + return builder.makeBreak(getU32LEB(), false); + case BinaryConsts::BrIf: + return builder.makeBreak(getU32LEB(), true); + case BinaryConsts::BrTable: { + auto numTargets = getU32LEB(); + std::vector labels(numTargets); + for (Index i = 0; i < numTargets; ++i) { + labels[i] = getU32LEB(); + } + return builder.makeSwitch(labels, getU32LEB()); + } + case BinaryConsts::CallFunction: + case BinaryConsts::RetCallFunction: + return builder.makeCall(getFunctionName(getU32LEB()), + code == BinaryConsts::RetCallFunction); + case BinaryConsts::CallIndirect: + case BinaryConsts::RetCallIndirect: { + auto type = getIndexedHeapType(); + auto table = getTableName(getU32LEB()); + return builder.makeCallIndirect( + table, type, code == BinaryConsts::RetCallIndirect); + } + case BinaryConsts::LocalGet: + return builder.makeLocalGet(getU32LEB()); + case BinaryConsts::LocalSet: + return builder.makeLocalSet(getU32LEB()); + case BinaryConsts::LocalTee: + return builder.makeLocalTee(getU32LEB()); + case BinaryConsts::GlobalGet: + return builder.makeGlobalGet(getGlobalName(getU32LEB())); + case BinaryConsts::GlobalSet: + return builder.makeGlobalSet(getGlobalName(getU32LEB())); + case BinaryConsts::Select: + return builder.makeSelect(std::nullopt); + case BinaryConsts::SelectWithType: { + auto numTypes = getU32LEB(); + std::vector types; + for (Index i = 0; i < numTypes; ++i) { + auto t = getType(); + if (!t.isConcrete()) { + return Err{"bad select type"}; + } + types.push_back(t); + } + return builder.makeSelect(Type(types)); + } + case BinaryConsts::Return: + return builder.makeReturn(); + case BinaryConsts::Nop: + return builder.makeNop(); + case BinaryConsts::Unreachable: + return builder.makeUnreachable(); + case BinaryConsts::Drop: + return builder.makeDrop(); + case BinaryConsts::End: + return builder.visitEnd(); + case BinaryConsts::Else: + return builder.visitElse(); + case BinaryConsts::Catch_Legacy: + return builder.visitCatch(getTagName(getU32LEB())); + case BinaryConsts::CatchAll_Legacy: + return builder.visitCatchAll(); + case BinaryConsts::Delegate: + return builder.visitDelegate(getU32LEB()); + case BinaryConsts::RefNull: + return builder.makeRefNull(getHeapType()); + case BinaryConsts::RefIsNull: + return builder.makeRefIsNull(); + case BinaryConsts::RefFunc: + return builder.makeRefFunc(getFunctionName(getU32LEB())); + case BinaryConsts::RefEq: + return builder.makeRefEq(); + case BinaryConsts::RefAsNonNull: + return builder.makeRefAs(RefAsNonNull); + case BinaryConsts::BrOnNull: + return builder.makeBrOn(getU32LEB(), BrOnNull); + case BinaryConsts::BrOnNonNull: + return builder.makeBrOn(getU32LEB(), BrOnNonNull); + case BinaryConsts::TableGet: + return builder.makeTableGet(getTableName(getU32LEB())); + case BinaryConsts::TableSet: + return builder.makeTableSet(getTableName(getU32LEB())); + case BinaryConsts::Try: + return builder.makeTry(Name(), getType()); + case BinaryConsts::TryTable: { + auto type = getType(); + std::vector tags; + std::vector labels; + std::vector isRefs; + auto numHandlers = getU32LEB(); + for (Index i = 0; i < numHandlers; ++i) { + uint8_t code = getInt8(); + if (code == BinaryConsts::Catch || code == BinaryConsts::CatchRef) { + tags.push_back(getTagName(getU32LEB())); + } else { + tags.push_back(Name()); + } + labels.push_back(getU32LEB()); + isRefs.push_back(code == BinaryConsts::CatchRef || + code == BinaryConsts::CatchAllRef); + } + return builder.makeTryTable(Name(), type, tags, labels, isRefs); + } + case BinaryConsts::Throw: + return builder.makeThrow(getTagName(getU32LEB())); + case BinaryConsts::Rethrow: + return builder.makeRethrow(getU32LEB()); + case BinaryConsts::ThrowRef: + return builder.makeThrowRef(); + case BinaryConsts::MemorySize: + return builder.makeMemorySize(getMemoryName(getU32LEB())); + case BinaryConsts::MemoryGrow: + return builder.makeMemoryGrow(getMemoryName(getU32LEB())); + case BinaryConsts::CallRef: + case BinaryConsts::RetCallRef: + return builder.makeCallRef(getIndexedHeapType(), + code == BinaryConsts::RetCallRef); + case BinaryConsts::ContBind: { + auto before = getIndexedHeapType(); + auto after = getIndexedHeapType(); + return builder.makeContBind(before, after); + } + case BinaryConsts::ContNew: + return builder.makeContNew(getIndexedHeapType()); + case BinaryConsts::Resume: { + auto type = getIndexedHeapType(); + std::vector tags; + std::vector labels; + auto numHandlers = getU32LEB(); + for (Index i = 0; i < numHandlers; ++i) { + tags.push_back(getTagName(getU32LEB())); + labels.push_back(getU32LEB()); + } + return builder.makeResume(type, tags, labels); + } + case BinaryConsts::Suspend: + return builder.makeSuspend(getTagName(getU32LEB())); + +#define BINARY_INT(code) \ + case BinaryConsts::I32##code: \ + return builder.makeBinary(code##Int32); \ + case BinaryConsts::I64##code: \ + return builder.makeBinary(code##Int64); +#define BINARY_FLOAT(code) \ + case BinaryConsts::F32##code: \ + return builder.makeBinary(code##Float32); \ + case BinaryConsts::F64##code: \ + return builder.makeBinary(code##Float64); +#define BINARY_NUM(code) \ + BINARY_INT(code) \ + BINARY_FLOAT(code) + + BINARY_NUM(Add); + BINARY_NUM(Sub); + BINARY_NUM(Mul); + BINARY_INT(DivS); + BINARY_INT(DivU); + BINARY_INT(RemS); + BINARY_INT(RemU); + BINARY_INT(And); + BINARY_INT(Or); + BINARY_INT(Xor); + BINARY_INT(Shl); + BINARY_INT(ShrU); + BINARY_INT(ShrS); + BINARY_INT(RotL); + BINARY_INT(RotR); + BINARY_FLOAT(Div); + BINARY_FLOAT(CopySign); + BINARY_FLOAT(Min); + BINARY_FLOAT(Max); + BINARY_NUM(Eq); + BINARY_NUM(Ne); + BINARY_INT(LtS); + BINARY_INT(LtU); + BINARY_INT(LeS); + BINARY_INT(LeU); + BINARY_INT(GtS); + BINARY_INT(GtU); + BINARY_INT(GeS); + BINARY_INT(GeU); + BINARY_FLOAT(Lt); + BINARY_FLOAT(Le); + BINARY_FLOAT(Gt); + BINARY_FLOAT(Ge); + +#define UNARY_INT(code) \ + case BinaryConsts::I32##code: \ + return builder.makeUnary(code##Int32); \ + case BinaryConsts::I64##code: \ + return builder.makeUnary(code##Int64); +#define UNARY_FLOAT(code) \ + case BinaryConsts::F32##code: \ + return builder.makeUnary(code##Float32); \ + case BinaryConsts::F64##code: \ + return builder.makeUnary(code##Float64); + + UNARY_INT(Clz); + UNARY_INT(Ctz); + UNARY_INT(Popcnt); + UNARY_INT(EqZ); + UNARY_FLOAT(Neg); + UNARY_FLOAT(Abs); + UNARY_FLOAT(Ceil); + UNARY_FLOAT(Floor); + // UNARY_FLOAT(NearestInt); + case BinaryConsts::F32NearestInt: + return builder.makeUnary(NearestFloat32); + case BinaryConsts::F64NearestInt: + return builder.makeUnary(NearestFloat64); + UNARY_FLOAT(Sqrt); + + case BinaryConsts::F32UConvertI32: + return builder.makeUnary(ConvertUInt32ToFloat32); + case BinaryConsts::F64UConvertI32: + return builder.makeUnary(ConvertUInt32ToFloat64); + case BinaryConsts::F32SConvertI32: + return builder.makeUnary(ConvertSInt32ToFloat32); + case BinaryConsts::F64SConvertI32: + return builder.makeUnary(ConvertSInt32ToFloat64); + case BinaryConsts::F32UConvertI64: + return builder.makeUnary(ConvertUInt64ToFloat32); + case BinaryConsts::F64UConvertI64: + return builder.makeUnary(ConvertUInt64ToFloat64); + case BinaryConsts::F32SConvertI64: + return builder.makeUnary(ConvertSInt64ToFloat32); + case BinaryConsts::F64SConvertI64: + return builder.makeUnary(ConvertSInt64ToFloat64); + case BinaryConsts::I64SExtendI32: + return builder.makeUnary(ExtendSInt32); + case BinaryConsts::I64UExtendI32: + return builder.makeUnary(ExtendUInt32); + case BinaryConsts::I32WrapI64: + return builder.makeUnary(WrapInt64); + case BinaryConsts::I32UTruncF32: + return builder.makeUnary(TruncUFloat32ToInt32); + case BinaryConsts::I32UTruncF64: + return builder.makeUnary(TruncUFloat64ToInt32); + case BinaryConsts::I32STruncF32: + return builder.makeUnary(TruncSFloat32ToInt32); + case BinaryConsts::I32STruncF64: + return builder.makeUnary(TruncSFloat64ToInt32); + case BinaryConsts::I64UTruncF32: + return builder.makeUnary(TruncUFloat32ToInt64); + case BinaryConsts::I64UTruncF64: + return builder.makeUnary(TruncUFloat64ToInt64); + case BinaryConsts::I64STruncF32: + return builder.makeUnary(TruncSFloat32ToInt64); + case BinaryConsts::I64STruncF64: + return builder.makeUnary(TruncSFloat64ToInt64); + case BinaryConsts::F32Trunc: + return builder.makeUnary(TruncFloat32); + case BinaryConsts::F64Trunc: + return builder.makeUnary(TruncFloat64); + case BinaryConsts::F32DemoteI64: + return builder.makeUnary(DemoteFloat64); + case BinaryConsts::F64PromoteF32: + return builder.makeUnary(PromoteFloat32); + case BinaryConsts::I32ReinterpretF32: + return builder.makeUnary(ReinterpretFloat32); + case BinaryConsts::I64ReinterpretF64: + return builder.makeUnary(ReinterpretFloat64); + case BinaryConsts::F32ReinterpretI32: + return builder.makeUnary(ReinterpretInt32); + case BinaryConsts::F64ReinterpretI64: + return builder.makeUnary(ReinterpretInt64); + case BinaryConsts::I32ExtendS8: + return builder.makeUnary(ExtendS8Int32); + case BinaryConsts::I32ExtendS16: + return builder.makeUnary(ExtendS16Int32); + case BinaryConsts::I64ExtendS8: + return builder.makeUnary(ExtendS8Int64); + case BinaryConsts::I64ExtendS16: + return builder.makeUnary(ExtendS16Int64); + case BinaryConsts::I64ExtendS32: + return builder.makeUnary(ExtendS32Int64); + case BinaryConsts::I32Const: + return builder.makeConst(Literal(getS32LEB())); + case BinaryConsts::I64Const: + return builder.makeConst(Literal(getS64LEB())); + case BinaryConsts::F32Const: + return builder.makeConst(getFloat32Literal()); + case BinaryConsts::F64Const: + return builder.makeConst(getFloat64Literal()); + case BinaryConsts::I32LoadMem8S: { + auto [mem, align, offset] = getMemarg(); + return builder.makeLoad(1, true, offset, align, Type::i32, mem); + } + case BinaryConsts::I32LoadMem8U: { + auto [mem, align, offset] = getMemarg(); + return builder.makeLoad(1, false, offset, align, Type::i32, mem); + } + case BinaryConsts::I32LoadMem16S: { + auto [mem, align, offset] = getMemarg(); + return builder.makeLoad(2, true, offset, align, Type::i32, mem); + } + case BinaryConsts::I32LoadMem16U: { + auto [mem, align, offset] = getMemarg(); + return builder.makeLoad(2, false, offset, align, Type::i32, mem); + } + case BinaryConsts::I32LoadMem: { + auto [mem, align, offset] = getMemarg(); + return builder.makeLoad(4, false, offset, align, Type::i32, mem); + } + case BinaryConsts::I64LoadMem8S: { + auto [mem, align, offset] = getMemarg(); + return builder.makeLoad(1, true, offset, align, Type::i64, mem); + } + case BinaryConsts::I64LoadMem8U: { + auto [mem, align, offset] = getMemarg(); + return builder.makeLoad(1, false, offset, align, Type::i64, mem); + } + case BinaryConsts::I64LoadMem16S: { + auto [mem, align, offset] = getMemarg(); + return builder.makeLoad(2, true, offset, align, Type::i64, mem); + } + case BinaryConsts::I64LoadMem16U: { + auto [mem, align, offset] = getMemarg(); + return builder.makeLoad(2, false, offset, align, Type::i64, mem); + } + case BinaryConsts::I64LoadMem32S: { + auto [mem, align, offset] = getMemarg(); + return builder.makeLoad(4, true, offset, align, Type::i64, mem); + } + case BinaryConsts::I64LoadMem32U: { + auto [mem, align, offset] = getMemarg(); + return builder.makeLoad(4, false, offset, align, Type::i64, mem); + } + case BinaryConsts::I64LoadMem: { + auto [mem, align, offset] = getMemarg(); + return builder.makeLoad(8, false, offset, align, Type::i64, mem); + } + case BinaryConsts::F32LoadMem: { + auto [mem, align, offset] = getMemarg(); + return builder.makeLoad(4, false, offset, align, Type::f32, mem); + } + case BinaryConsts::F64LoadMem: { + auto [mem, align, offset] = getMemarg(); + return builder.makeLoad(8, false, offset, align, Type::f64, mem); + } + case BinaryConsts::I32StoreMem8: { + auto [mem, align, offset] = getMemarg(); + return builder.makeStore(1, offset, align, Type::i32, mem); + } + case BinaryConsts::I32StoreMem16: { + auto [mem, align, offset] = getMemarg(); + return builder.makeStore(2, offset, align, Type::i32, mem); + } + case BinaryConsts::I32StoreMem: { + auto [mem, align, offset] = getMemarg(); + return builder.makeStore(4, offset, align, Type::i32, mem); + } + case BinaryConsts::I64StoreMem8: { + auto [mem, align, offset] = getMemarg(); + return builder.makeStore(1, offset, align, Type::i64, mem); + } + case BinaryConsts::I64StoreMem16: { + auto [mem, align, offset] = getMemarg(); + return builder.makeStore(2, offset, align, Type::i64, mem); + } + case BinaryConsts::I64StoreMem32: { + auto [mem, align, offset] = getMemarg(); + return builder.makeStore(4, offset, align, Type::i64, mem); + } + case BinaryConsts::I64StoreMem: { + auto [mem, align, offset] = getMemarg(); + return builder.makeStore(8, offset, align, Type::i64, mem); + } + case BinaryConsts::F32StoreMem: { + auto [mem, align, offset] = getMemarg(); + return builder.makeStore(4, offset, align, Type::f32, mem); + } + case BinaryConsts::F64StoreMem: { + auto [mem, align, offset] = getMemarg(); + return builder.makeStore(8, offset, align, Type::f64, mem); + } + case BinaryConsts::AtomicPrefix: { + auto op = getU32LEB(); + switch (op) { + case BinaryConsts::I32AtomicLoad8U: { + // TODO: pass align through for validation. + auto [mem, align, offset] = getMemarg(); + return builder.makeAtomicLoad(1, offset, Type::i32, mem); + } + case BinaryConsts::I32AtomicLoad16U: { + auto [mem, align, offset] = getMemarg(); + return builder.makeAtomicLoad(2, offset, Type::i32, mem); + } + case BinaryConsts::I32AtomicLoad: { + auto [mem, align, offset] = getMemarg(); + return builder.makeAtomicLoad(4, offset, Type::i32, mem); + } + case BinaryConsts::I64AtomicLoad8U: { + auto [mem, align, offset] = getMemarg(); + return builder.makeAtomicLoad(1, offset, Type::i64, mem); + } + case BinaryConsts::I64AtomicLoad16U: { + auto [mem, align, offset] = getMemarg(); + return builder.makeAtomicLoad(2, offset, Type::i64, mem); + } + case BinaryConsts::I64AtomicLoad32U: { + auto [mem, align, offset] = getMemarg(); + return builder.makeAtomicLoad(4, offset, Type::i64, mem); + } + case BinaryConsts::I64AtomicLoad: { + auto [mem, align, offset] = getMemarg(); + return builder.makeAtomicLoad(8, offset, Type::i64, mem); + } + case BinaryConsts::I32AtomicStore8: { + auto [mem, align, offset] = getMemarg(); + return builder.makeAtomicStore(1, offset, Type::i32, mem); + } + case BinaryConsts::I32AtomicStore16: { + auto [mem, align, offset] = getMemarg(); + return builder.makeAtomicStore(2, offset, Type::i32, mem); + } + case BinaryConsts::I32AtomicStore: { + auto [mem, align, offset] = getMemarg(); + return builder.makeAtomicStore(4, offset, Type::i32, mem); + } + case BinaryConsts::I64AtomicStore8: { + auto [mem, align, offset] = getMemarg(); + return builder.makeAtomicStore(1, offset, Type::i64, mem); + } + case BinaryConsts::I64AtomicStore16: { + auto [mem, align, offset] = getMemarg(); + return builder.makeAtomicStore(2, offset, Type::i64, mem); + } + case BinaryConsts::I64AtomicStore32: { + auto [mem, align, offset] = getMemarg(); + return builder.makeAtomicStore(4, offset, Type::i64, mem); + } + case BinaryConsts::I64AtomicStore: { + auto [mem, align, offset] = getMemarg(); + return builder.makeAtomicStore(8, offset, Type::i64, mem); + } + +#define RMW(op) \ + case BinaryConsts::I32AtomicRMW##op: { \ + auto [mem, align, offset] = getMemarg(); \ + return builder.makeAtomicRMW(RMW##op, 4, offset, Type::i32, mem); \ + } \ + case BinaryConsts::I32AtomicRMW##op##8U: { \ + auto [mem, align, offset] = getMemarg(); \ + return builder.makeAtomicRMW(RMW##op, 1, offset, Type::i32, mem); \ + } \ + case BinaryConsts::I32AtomicRMW##op##16U: { \ + auto [mem, align, offset] = getMemarg(); \ + return builder.makeAtomicRMW(RMW##op, 2, offset, Type::i32, mem); \ + } \ + case BinaryConsts::I64AtomicRMW##op: { \ + auto [mem, align, offset] = getMemarg(); \ + return builder.makeAtomicRMW(RMW##op, 8, offset, Type::i64, mem); \ + } \ + case BinaryConsts::I64AtomicRMW##op##8U: { \ + auto [mem, align, offset] = getMemarg(); \ + return builder.makeAtomicRMW(RMW##op, 1, offset, Type::i64, mem); \ + } \ + case BinaryConsts::I64AtomicRMW##op##16U: { \ + auto [mem, align, offset] = getMemarg(); \ + return builder.makeAtomicRMW(RMW##op, 2, offset, Type::i64, mem); \ + } \ + case BinaryConsts::I64AtomicRMW##op##32U: { \ + auto [mem, align, offset] = getMemarg(); \ + return builder.makeAtomicRMW(RMW##op, 4, offset, Type::i64, mem); \ + } + + RMW(Add); + RMW(Sub); + RMW(And); + RMW(Or); + RMW(Xor); + RMW(Xchg); + + case BinaryConsts::I32AtomicCmpxchg: { + auto [mem, align, offset] = getMemarg(); + return builder.makeAtomicCmpxchg(4, offset, Type::i32, mem); + } + case BinaryConsts::I32AtomicCmpxchg8U: { + auto [mem, align, offset] = getMemarg(); + return builder.makeAtomicCmpxchg(1, offset, Type::i32, mem); + } + case BinaryConsts::I32AtomicCmpxchg16U: { + auto [mem, align, offset] = getMemarg(); + return builder.makeAtomicCmpxchg(2, offset, Type::i32, mem); + } + case BinaryConsts::I64AtomicCmpxchg: { + auto [mem, align, offset] = getMemarg(); + return builder.makeAtomicCmpxchg(8, offset, Type::i64, mem); + } + case BinaryConsts::I64AtomicCmpxchg8U: { + auto [mem, align, offset] = getMemarg(); + return builder.makeAtomicCmpxchg(1, offset, Type::i64, mem); + } + case BinaryConsts::I64AtomicCmpxchg16U: { + auto [mem, align, offset] = getMemarg(); + return builder.makeAtomicCmpxchg(2, offset, Type::i64, mem); + } + case BinaryConsts::I64AtomicCmpxchg32U: { + auto [mem, align, offset] = getMemarg(); + return builder.makeAtomicCmpxchg(4, offset, Type::i64, mem); + } + case BinaryConsts::I32AtomicWait: { + auto [mem, align, offset] = getMemarg(); + return builder.makeAtomicWait(Type::i32, offset, mem); + } + case BinaryConsts::I64AtomicWait: { + auto [mem, align, offset] = getMemarg(); + return builder.makeAtomicWait(Type::i64, offset, mem); + } + case BinaryConsts::AtomicNotify: { + auto [mem, align, offset] = getMemarg(); + return builder.makeAtomicNotify(offset, mem); + } + case BinaryConsts::AtomicFence: + if (getInt8() != 0) { + return Err{"expected 0x00 byte immediate on atomic.fence"}; + } + return builder.makeAtomicFence(); + } + return Err{"unknown atomic operation"}; + } + case BinaryConsts::MiscPrefix: { + auto op = getU32LEB(); + switch (op) { + case BinaryConsts::I32STruncSatF32: + return builder.makeUnary(TruncSatSFloat32ToInt32); + case BinaryConsts::I32UTruncSatF32: + return builder.makeUnary(TruncSatUFloat32ToInt32); + case BinaryConsts::I32STruncSatF64: + return builder.makeUnary(TruncSatSFloat64ToInt32); + case BinaryConsts::I32UTruncSatF64: + return builder.makeUnary(TruncSatUFloat64ToInt32); + case BinaryConsts::I64STruncSatF32: + return builder.makeUnary(TruncSatSFloat32ToInt64); + case BinaryConsts::I64UTruncSatF32: + return builder.makeUnary(TruncSatUFloat32ToInt64); + case BinaryConsts::I64STruncSatF64: + return builder.makeUnary(TruncSatSFloat64ToInt64); + case BinaryConsts::I64UTruncSatF64: + return builder.makeUnary(TruncSatUFloat64ToInt64); + case BinaryConsts::MemoryInit: { + auto data = getDataName(getU32LEB()); + auto mem = getMemoryName(getU32LEB()); + return builder.makeMemoryInit(data, mem); + } + case BinaryConsts::DataDrop: + return builder.makeDataDrop(getDataName(getU32LEB())); + case BinaryConsts::MemoryCopy: { + auto dest = getMemoryName(getU32LEB()); + auto src = getMemoryName(getU32LEB()); + return builder.makeMemoryCopy(dest, src); + } + case BinaryConsts::MemoryFill: + return builder.makeMemoryFill(getMemoryName(getU32LEB())); + case BinaryConsts::TableSize: + return builder.makeTableSize(getTableName(getU32LEB())); + case BinaryConsts::TableGrow: + return builder.makeTableGrow(getTableName(getU32LEB())); + case BinaryConsts::TableFill: + return builder.makeTableFill(getTableName(getU32LEB())); + case BinaryConsts::TableCopy: { + auto dest = getTableName(getU32LEB()); + auto src = getTableName(getU32LEB()); + return builder.makeTableCopy(dest, src); + } + case BinaryConsts::TableInit: { + auto elem = getElemName(getU32LEB()); + auto table = getTableName(getU32LEB()); + return builder.makeTableInit(elem, table); + } + case BinaryConsts::F32_F16LoadMem: { + auto [mem, align, offset] = getMemarg(); + return builder.makeLoad(2, false, offset, align, Type::f32, mem); + } + case BinaryConsts::F32_F16StoreMem: { + auto [mem, align, offset] = getMemarg(); + return builder.makeStore(2, offset, align, Type::f32, mem); + } + } + return Err{"unknown misc operation"}; + } + case BinaryConsts::SIMDPrefix: { + auto op = getU32LEB(); + switch (op) { + case BinaryConsts::I8x16Eq: + return builder.makeBinary(EqVecI8x16); + case BinaryConsts::I8x16Ne: + return builder.makeBinary(NeVecI8x16); + case BinaryConsts::I8x16LtS: + return builder.makeBinary(LtSVecI8x16); + case BinaryConsts::I8x16LtU: + return builder.makeBinary(LtUVecI8x16); + case BinaryConsts::I8x16GtS: + return builder.makeBinary(GtSVecI8x16); + case BinaryConsts::I8x16GtU: + return builder.makeBinary(GtUVecI8x16); + case BinaryConsts::I8x16LeS: + return builder.makeBinary(LeSVecI8x16); + case BinaryConsts::I8x16LeU: + return builder.makeBinary(LeUVecI8x16); + case BinaryConsts::I8x16GeS: + return builder.makeBinary(GeSVecI8x16); + case BinaryConsts::I8x16GeU: + return builder.makeBinary(GeUVecI8x16); + case BinaryConsts::I16x8Eq: + return builder.makeBinary(EqVecI16x8); + case BinaryConsts::I16x8Ne: + return builder.makeBinary(NeVecI16x8); + case BinaryConsts::I16x8LtS: + return builder.makeBinary(LtSVecI16x8); + case BinaryConsts::I16x8LtU: + return builder.makeBinary(LtUVecI16x8); + case BinaryConsts::I16x8GtS: + return builder.makeBinary(GtSVecI16x8); + case BinaryConsts::I16x8GtU: + return builder.makeBinary(GtUVecI16x8); + case BinaryConsts::I16x8LeS: + return builder.makeBinary(LeSVecI16x8); + case BinaryConsts::I16x8LeU: + return builder.makeBinary(LeUVecI16x8); + case BinaryConsts::I16x8GeS: + return builder.makeBinary(GeSVecI16x8); + case BinaryConsts::I16x8GeU: + return builder.makeBinary(GeUVecI16x8); + case BinaryConsts::I32x4Eq: + return builder.makeBinary(EqVecI32x4); + case BinaryConsts::I32x4Ne: + return builder.makeBinary(NeVecI32x4); + case BinaryConsts::I32x4LtS: + return builder.makeBinary(LtSVecI32x4); + case BinaryConsts::I32x4LtU: + return builder.makeBinary(LtUVecI32x4); + case BinaryConsts::I32x4GtS: + return builder.makeBinary(GtSVecI32x4); + case BinaryConsts::I32x4GtU: + return builder.makeBinary(GtUVecI32x4); + case BinaryConsts::I32x4LeS: + return builder.makeBinary(LeSVecI32x4); + case BinaryConsts::I32x4LeU: + return builder.makeBinary(LeUVecI32x4); + case BinaryConsts::I32x4GeS: + return builder.makeBinary(GeSVecI32x4); + case BinaryConsts::I32x4GeU: + return builder.makeBinary(GeUVecI32x4); + case BinaryConsts::I64x2Eq: + return builder.makeBinary(EqVecI64x2); + case BinaryConsts::I64x2Ne: + return builder.makeBinary(NeVecI64x2); + case BinaryConsts::I64x2LtS: + return builder.makeBinary(LtSVecI64x2); + case BinaryConsts::I64x2GtS: + return builder.makeBinary(GtSVecI64x2); + case BinaryConsts::I64x2LeS: + return builder.makeBinary(LeSVecI64x2); + case BinaryConsts::I64x2GeS: + return builder.makeBinary(GeSVecI64x2); + case BinaryConsts::F16x8Eq: + return builder.makeBinary(EqVecF16x8); + case BinaryConsts::F16x8Ne: + return builder.makeBinary(NeVecF16x8); + case BinaryConsts::F16x8Lt: + return builder.makeBinary(LtVecF16x8); + case BinaryConsts::F16x8Gt: + return builder.makeBinary(GtVecF16x8); + case BinaryConsts::F16x8Le: + return builder.makeBinary(LeVecF16x8); + case BinaryConsts::F16x8Ge: + return builder.makeBinary(GeVecF16x8); + case BinaryConsts::F32x4Eq: + return builder.makeBinary(EqVecF32x4); + case BinaryConsts::F32x4Ne: + return builder.makeBinary(NeVecF32x4); + case BinaryConsts::F32x4Lt: + return builder.makeBinary(LtVecF32x4); + case BinaryConsts::F32x4Gt: + return builder.makeBinary(GtVecF32x4); + case BinaryConsts::F32x4Le: + return builder.makeBinary(LeVecF32x4); + case BinaryConsts::F32x4Ge: + return builder.makeBinary(GeVecF32x4); + case BinaryConsts::F64x2Eq: + return builder.makeBinary(EqVecF64x2); + case BinaryConsts::F64x2Ne: + return builder.makeBinary(NeVecF64x2); + case BinaryConsts::F64x2Lt: + return builder.makeBinary(LtVecF64x2); + case BinaryConsts::F64x2Gt: + return builder.makeBinary(GtVecF64x2); + case BinaryConsts::F64x2Le: + return builder.makeBinary(LeVecF64x2); + case BinaryConsts::F64x2Ge: + return builder.makeBinary(GeVecF64x2); + case BinaryConsts::V128And: + return builder.makeBinary(AndVec128); + case BinaryConsts::V128Or: + return builder.makeBinary(OrVec128); + case BinaryConsts::V128Xor: + return builder.makeBinary(XorVec128); + case BinaryConsts::V128Andnot: + return builder.makeBinary(AndNotVec128); + case BinaryConsts::I8x16Add: + return builder.makeBinary(AddVecI8x16); + case BinaryConsts::I8x16AddSatS: + return builder.makeBinary(AddSatSVecI8x16); + case BinaryConsts::I8x16AddSatU: + return builder.makeBinary(AddSatUVecI8x16); + case BinaryConsts::I8x16Sub: + return builder.makeBinary(SubVecI8x16); + case BinaryConsts::I8x16SubSatS: + return builder.makeBinary(SubSatSVecI8x16); + case BinaryConsts::I8x16SubSatU: + return builder.makeBinary(SubSatUVecI8x16); + case BinaryConsts::I8x16MinS: + return builder.makeBinary(MinSVecI8x16); + case BinaryConsts::I8x16MinU: + return builder.makeBinary(MinUVecI8x16); + case BinaryConsts::I8x16MaxS: + return builder.makeBinary(MaxSVecI8x16); + case BinaryConsts::I8x16MaxU: + return builder.makeBinary(MaxUVecI8x16); + case BinaryConsts::I8x16AvgrU: + return builder.makeBinary(AvgrUVecI8x16); + case BinaryConsts::I16x8Add: + return builder.makeBinary(AddVecI16x8); + case BinaryConsts::I16x8AddSatS: + return builder.makeBinary(AddSatSVecI16x8); + case BinaryConsts::I16x8AddSatU: + return builder.makeBinary(AddSatUVecI16x8); + case BinaryConsts::I16x8Sub: + return builder.makeBinary(SubVecI16x8); + case BinaryConsts::I16x8SubSatS: + return builder.makeBinary(SubSatSVecI16x8); + case BinaryConsts::I16x8SubSatU: + return builder.makeBinary(SubSatUVecI16x8); + case BinaryConsts::I16x8Mul: + return builder.makeBinary(MulVecI16x8); + case BinaryConsts::I16x8MinS: + return builder.makeBinary(MinSVecI16x8); + case BinaryConsts::I16x8MinU: + return builder.makeBinary(MinUVecI16x8); + case BinaryConsts::I16x8MaxS: + return builder.makeBinary(MaxSVecI16x8); + case BinaryConsts::I16x8MaxU: + return builder.makeBinary(MaxUVecI16x8); + case BinaryConsts::I16x8AvgrU: + return builder.makeBinary(AvgrUVecI16x8); + case BinaryConsts::I16x8Q15MulrSatS: + return builder.makeBinary(Q15MulrSatSVecI16x8); + case BinaryConsts::I16x8ExtmulLowI8x16S: + return builder.makeBinary(ExtMulLowSVecI16x8); + case BinaryConsts::I16x8ExtmulHighI8x16S: + return builder.makeBinary(ExtMulHighSVecI16x8); + case BinaryConsts::I16x8ExtmulLowI8x16U: + return builder.makeBinary(ExtMulLowUVecI16x8); + case BinaryConsts::I16x8ExtmulHighI8x16U: + return builder.makeBinary(ExtMulHighUVecI16x8); + case BinaryConsts::I32x4Add: + return builder.makeBinary(AddVecI32x4); + case BinaryConsts::I32x4Sub: + return builder.makeBinary(SubVecI32x4); + case BinaryConsts::I32x4Mul: + return builder.makeBinary(MulVecI32x4); + case BinaryConsts::I32x4MinS: + return builder.makeBinary(MinSVecI32x4); + case BinaryConsts::I32x4MinU: + return builder.makeBinary(MinUVecI32x4); + case BinaryConsts::I32x4MaxS: + return builder.makeBinary(MaxSVecI32x4); + case BinaryConsts::I32x4MaxU: + return builder.makeBinary(MaxUVecI32x4); + case BinaryConsts::I32x4DotI16x8S: + return builder.makeBinary(DotSVecI16x8ToVecI32x4); + case BinaryConsts::I32x4ExtmulLowI16x8S: + return builder.makeBinary(ExtMulLowSVecI32x4); + case BinaryConsts::I32x4ExtmulHighI16x8S: + return builder.makeBinary(ExtMulHighSVecI32x4); + case BinaryConsts::I32x4ExtmulLowI16x8U: + return builder.makeBinary(ExtMulLowUVecI32x4); + case BinaryConsts::I32x4ExtmulHighI16x8U: + return builder.makeBinary(ExtMulHighUVecI32x4); + case BinaryConsts::I64x2Add: + return builder.makeBinary(AddVecI64x2); + case BinaryConsts::I64x2Sub: + return builder.makeBinary(SubVecI64x2); + case BinaryConsts::I64x2Mul: + return builder.makeBinary(MulVecI64x2); + case BinaryConsts::I64x2ExtmulLowI32x4S: + return builder.makeBinary(ExtMulLowSVecI64x2); + case BinaryConsts::I64x2ExtmulHighI32x4S: + return builder.makeBinary(ExtMulHighSVecI64x2); + case BinaryConsts::I64x2ExtmulLowI32x4U: + return builder.makeBinary(ExtMulLowUVecI64x2); + case BinaryConsts::I64x2ExtmulHighI32x4U: + return builder.makeBinary(ExtMulHighUVecI64x2); + case BinaryConsts::F16x8Add: + return builder.makeBinary(AddVecF16x8); + case BinaryConsts::F16x8Sub: + return builder.makeBinary(SubVecF16x8); + case BinaryConsts::F16x8Mul: + return builder.makeBinary(MulVecF16x8); + case BinaryConsts::F16x8Div: + return builder.makeBinary(DivVecF16x8); + case BinaryConsts::F16x8Min: + return builder.makeBinary(MinVecF16x8); + case BinaryConsts::F16x8Max: + return builder.makeBinary(MaxVecF16x8); + case BinaryConsts::F16x8Pmin: + return builder.makeBinary(PMinVecF16x8); + case BinaryConsts::F16x8Pmax: + return builder.makeBinary(PMaxVecF16x8); + case BinaryConsts::F32x4Add: + return builder.makeBinary(AddVecF32x4); + case BinaryConsts::F32x4Sub: + return builder.makeBinary(SubVecF32x4); + case BinaryConsts::F32x4Mul: + return builder.makeBinary(MulVecF32x4); + case BinaryConsts::F32x4Div: + return builder.makeBinary(DivVecF32x4); + case BinaryConsts::F32x4Min: + return builder.makeBinary(MinVecF32x4); + case BinaryConsts::F32x4Max: + return builder.makeBinary(MaxVecF32x4); + case BinaryConsts::F32x4Pmin: + return builder.makeBinary(PMinVecF32x4); + case BinaryConsts::F32x4Pmax: + return builder.makeBinary(PMaxVecF32x4); + case BinaryConsts::F64x2Add: + return builder.makeBinary(AddVecF64x2); + case BinaryConsts::F64x2Sub: + return builder.makeBinary(SubVecF64x2); + case BinaryConsts::F64x2Mul: + return builder.makeBinary(MulVecF64x2); + case BinaryConsts::F64x2Div: + return builder.makeBinary(DivVecF64x2); + case BinaryConsts::F64x2Min: + return builder.makeBinary(MinVecF64x2); + case BinaryConsts::F64x2Max: + return builder.makeBinary(MaxVecF64x2); + case BinaryConsts::F64x2Pmin: + return builder.makeBinary(PMinVecF64x2); + case BinaryConsts::F64x2Pmax: + return builder.makeBinary(PMaxVecF64x2); + case BinaryConsts::I8x16NarrowI16x8S: + return builder.makeBinary(NarrowSVecI16x8ToVecI8x16); + case BinaryConsts::I8x16NarrowI16x8U: + return builder.makeBinary(NarrowUVecI16x8ToVecI8x16); + case BinaryConsts::I16x8NarrowI32x4S: + return builder.makeBinary(NarrowSVecI32x4ToVecI16x8); + case BinaryConsts::I16x8NarrowI32x4U: + return builder.makeBinary(NarrowUVecI32x4ToVecI16x8); + case BinaryConsts::I8x16Swizzle: + return builder.makeBinary(SwizzleVecI8x16); + case BinaryConsts::I8x16RelaxedSwizzle: + return builder.makeBinary(RelaxedSwizzleVecI8x16); + case BinaryConsts::F32x4RelaxedMin: + return builder.makeBinary(RelaxedMinVecF32x4); + case BinaryConsts::F32x4RelaxedMax: + return builder.makeBinary(RelaxedMaxVecF32x4); + case BinaryConsts::F64x2RelaxedMin: + return builder.makeBinary(RelaxedMinVecF64x2); + case BinaryConsts::F64x2RelaxedMax: + return builder.makeBinary(RelaxedMaxVecF64x2); + case BinaryConsts::I16x8RelaxedQ15MulrS: + return builder.makeBinary(RelaxedQ15MulrSVecI16x8); + case BinaryConsts::I16x8DotI8x16I7x16S: + return builder.makeBinary(DotI8x16I7x16SToVecI16x8); + case BinaryConsts::I8x16Splat: + return builder.makeUnary(SplatVecI8x16); + case BinaryConsts::I16x8Splat: + return builder.makeUnary(SplatVecI16x8); + case BinaryConsts::I32x4Splat: + return builder.makeUnary(SplatVecI32x4); + case BinaryConsts::I64x2Splat: + return builder.makeUnary(SplatVecI64x2); + case BinaryConsts::F16x8Splat: + return builder.makeUnary(SplatVecF16x8); + case BinaryConsts::F32x4Splat: + return builder.makeUnary(SplatVecF32x4); + case BinaryConsts::F64x2Splat: + return builder.makeUnary(SplatVecF64x2); + case BinaryConsts::V128Not: + return builder.makeUnary(NotVec128); + case BinaryConsts::V128AnyTrue: + return builder.makeUnary(AnyTrueVec128); + case BinaryConsts::I8x16Popcnt: + return builder.makeUnary(PopcntVecI8x16); + case BinaryConsts::I8x16Abs: + return builder.makeUnary(AbsVecI8x16); + case BinaryConsts::I8x16Neg: + return builder.makeUnary(NegVecI8x16); + case BinaryConsts::I8x16AllTrue: + return builder.makeUnary(AllTrueVecI8x16); + case BinaryConsts::I8x16Bitmask: + return builder.makeUnary(BitmaskVecI8x16); + case BinaryConsts::I16x8Abs: + return builder.makeUnary(AbsVecI16x8); + case BinaryConsts::I16x8Neg: + return builder.makeUnary(NegVecI16x8); + case BinaryConsts::I16x8AllTrue: + return builder.makeUnary(AllTrueVecI16x8); + case BinaryConsts::I16x8Bitmask: + return builder.makeUnary(BitmaskVecI16x8); + case BinaryConsts::I32x4Abs: + return builder.makeUnary(AbsVecI32x4); + case BinaryConsts::I32x4Neg: + return builder.makeUnary(NegVecI32x4); + case BinaryConsts::I32x4AllTrue: + return builder.makeUnary(AllTrueVecI32x4); + case BinaryConsts::I32x4Bitmask: + return builder.makeUnary(BitmaskVecI32x4); + case BinaryConsts::I64x2Abs: + return builder.makeUnary(AbsVecI64x2); + case BinaryConsts::I64x2Neg: + return builder.makeUnary(NegVecI64x2); + case BinaryConsts::I64x2AllTrue: + return builder.makeUnary(AllTrueVecI64x2); + case BinaryConsts::I64x2Bitmask: + return builder.makeUnary(BitmaskVecI64x2); + case BinaryConsts::F16x8Abs: + return builder.makeUnary(AbsVecF16x8); + case BinaryConsts::F16x8Neg: + return builder.makeUnary(NegVecF16x8); + case BinaryConsts::F16x8Sqrt: + return builder.makeUnary(SqrtVecF16x8); + case BinaryConsts::F16x8Ceil: + return builder.makeUnary(CeilVecF16x8); + case BinaryConsts::F16x8Floor: + return builder.makeUnary(FloorVecF16x8); + case BinaryConsts::F16x8Trunc: + return builder.makeUnary(TruncVecF16x8); + case BinaryConsts::F16x8Nearest: + return builder.makeUnary(NearestVecF16x8); + case BinaryConsts::F32x4Abs: + return builder.makeUnary(AbsVecF32x4); + case BinaryConsts::F32x4Neg: + return builder.makeUnary(NegVecF32x4); + case BinaryConsts::F32x4Sqrt: + return builder.makeUnary(SqrtVecF32x4); + case BinaryConsts::F32x4Ceil: + return builder.makeUnary(CeilVecF32x4); + case BinaryConsts::F32x4Floor: + return builder.makeUnary(FloorVecF32x4); + case BinaryConsts::F32x4Trunc: + return builder.makeUnary(TruncVecF32x4); + case BinaryConsts::F32x4Nearest: + return builder.makeUnary(NearestVecF32x4); + case BinaryConsts::F64x2Abs: + return builder.makeUnary(AbsVecF64x2); + case BinaryConsts::F64x2Neg: + return builder.makeUnary(NegVecF64x2); + case BinaryConsts::F64x2Sqrt: + return builder.makeUnary(SqrtVecF64x2); + case BinaryConsts::F64x2Ceil: + return builder.makeUnary(CeilVecF64x2); + case BinaryConsts::F64x2Floor: + return builder.makeUnary(FloorVecF64x2); + case BinaryConsts::F64x2Trunc: + return builder.makeUnary(TruncVecF64x2); + case BinaryConsts::F64x2Nearest: + return builder.makeUnary(NearestVecF64x2); + case BinaryConsts::I16x8ExtaddPairwiseI8x16S: + return builder.makeUnary(ExtAddPairwiseSVecI8x16ToI16x8); + case BinaryConsts::I16x8ExtaddPairwiseI8x16U: + return builder.makeUnary(ExtAddPairwiseUVecI8x16ToI16x8); + case BinaryConsts::I32x4ExtaddPairwiseI16x8S: + return builder.makeUnary(ExtAddPairwiseSVecI16x8ToI32x4); + case BinaryConsts::I32x4ExtaddPairwiseI16x8U: + return builder.makeUnary(ExtAddPairwiseUVecI16x8ToI32x4); + case BinaryConsts::I32x4TruncSatF32x4S: + return builder.makeUnary(TruncSatSVecF32x4ToVecI32x4); + case BinaryConsts::I32x4TruncSatF32x4U: + return builder.makeUnary(TruncSatUVecF32x4ToVecI32x4); + case BinaryConsts::F32x4ConvertI32x4S: + return builder.makeUnary(ConvertSVecI32x4ToVecF32x4); + case BinaryConsts::F32x4ConvertI32x4U: + return builder.makeUnary(ConvertUVecI32x4ToVecF32x4); + case BinaryConsts::I16x8ExtendLowI8x16S: + return builder.makeUnary(ExtendLowSVecI8x16ToVecI16x8); + case BinaryConsts::I16x8ExtendHighI8x16S: + return builder.makeUnary(ExtendHighSVecI8x16ToVecI16x8); + case BinaryConsts::I16x8ExtendLowI8x16U: + return builder.makeUnary(ExtendLowUVecI8x16ToVecI16x8); + case BinaryConsts::I16x8ExtendHighI8x16U: + return builder.makeUnary(ExtendHighUVecI8x16ToVecI16x8); + case BinaryConsts::I32x4ExtendLowI16x8S: + return builder.makeUnary(ExtendLowSVecI16x8ToVecI32x4); + case BinaryConsts::I32x4ExtendHighI16x8S: + return builder.makeUnary(ExtendHighSVecI16x8ToVecI32x4); + case BinaryConsts::I32x4ExtendLowI16x8U: + return builder.makeUnary(ExtendLowUVecI16x8ToVecI32x4); + case BinaryConsts::I32x4ExtendHighI16x8U: + return builder.makeUnary(ExtendHighUVecI16x8ToVecI32x4); + case BinaryConsts::I64x2ExtendLowI32x4S: + return builder.makeUnary(ExtendLowSVecI32x4ToVecI64x2); + case BinaryConsts::I64x2ExtendHighI32x4S: + return builder.makeUnary(ExtendHighSVecI32x4ToVecI64x2); + case BinaryConsts::I64x2ExtendLowI32x4U: + return builder.makeUnary(ExtendLowUVecI32x4ToVecI64x2); + case BinaryConsts::I64x2ExtendHighI32x4U: + return builder.makeUnary(ExtendHighUVecI32x4ToVecI64x2); + case BinaryConsts::F64x2ConvertLowI32x4S: + return builder.makeUnary(ConvertLowSVecI32x4ToVecF64x2); + case BinaryConsts::F64x2ConvertLowI32x4U: + return builder.makeUnary(ConvertLowUVecI32x4ToVecF64x2); + case BinaryConsts::I32x4TruncSatF64x2SZero: + return builder.makeUnary(TruncSatZeroSVecF64x2ToVecI32x4); + case BinaryConsts::I32x4TruncSatF64x2UZero: + return builder.makeUnary(TruncSatZeroUVecF64x2ToVecI32x4); + case BinaryConsts::F32x4DemoteF64x2Zero: + return builder.makeUnary(DemoteZeroVecF64x2ToVecF32x4); + case BinaryConsts::F64x2PromoteLowF32x4: + return builder.makeUnary(PromoteLowVecF32x4ToVecF64x2); + case BinaryConsts::I32x4RelaxedTruncF32x4S: + return builder.makeUnary(RelaxedTruncSVecF32x4ToVecI32x4); + case BinaryConsts::I32x4RelaxedTruncF32x4U: + return builder.makeUnary(RelaxedTruncUVecF32x4ToVecI32x4); + case BinaryConsts::I32x4RelaxedTruncF64x2SZero: + return builder.makeUnary(RelaxedTruncZeroSVecF64x2ToVecI32x4); + case BinaryConsts::I32x4RelaxedTruncF64x2UZero: + return builder.makeUnary(RelaxedTruncZeroUVecF64x2ToVecI32x4); + case BinaryConsts::I8x16ExtractLaneS: + return builder.makeSIMDExtract(ExtractLaneSVecI8x16, + getLaneIndex(16)); + case BinaryConsts::I8x16ExtractLaneU: + return builder.makeSIMDExtract(ExtractLaneUVecI8x16, + getLaneIndex(16)); + case BinaryConsts::I16x8ExtractLaneS: + return builder.makeSIMDExtract(ExtractLaneSVecI16x8, getLaneIndex(8)); + case BinaryConsts::I16x8ExtractLaneU: + return builder.makeSIMDExtract(ExtractLaneUVecI16x8, getLaneIndex(8)); + case BinaryConsts::I32x4ExtractLane: + return builder.makeSIMDExtract(ExtractLaneVecI32x4, getLaneIndex(4)); + case BinaryConsts::I64x2ExtractLane: + return builder.makeSIMDExtract(ExtractLaneVecI64x2, getLaneIndex(2)); + case BinaryConsts::F16x8ExtractLane: + return builder.makeSIMDExtract(ExtractLaneVecF16x8, getLaneIndex(8)); + case BinaryConsts::F32x4ExtractLane: + return builder.makeSIMDExtract(ExtractLaneVecF32x4, getLaneIndex(4)); + case BinaryConsts::F64x2ExtractLane: + return builder.makeSIMDExtract(ExtractLaneVecF64x2, getLaneIndex(2)); + case BinaryConsts::I8x16ReplaceLane: + return builder.makeSIMDReplace(ReplaceLaneVecI8x16, getLaneIndex(16)); + case BinaryConsts::I16x8ReplaceLane: + return builder.makeSIMDReplace(ReplaceLaneVecI16x8, getLaneIndex(8)); + case BinaryConsts::I32x4ReplaceLane: + return builder.makeSIMDReplace(ReplaceLaneVecI32x4, getLaneIndex(4)); + case BinaryConsts::I64x2ReplaceLane: + return builder.makeSIMDReplace(ReplaceLaneVecI64x2, getLaneIndex(2)); + case BinaryConsts::F16x8ReplaceLane: + return builder.makeSIMDReplace(ReplaceLaneVecF16x8, getLaneIndex(8)); + case BinaryConsts::F32x4ReplaceLane: + return builder.makeSIMDReplace(ReplaceLaneVecF32x4, getLaneIndex(4)); + case BinaryConsts::F64x2ReplaceLane: + return builder.makeSIMDReplace(ReplaceLaneVecF64x2, getLaneIndex(2)); + case BinaryConsts::I8x16Shuffle: { + std::array lanes; + for (Index i = 0; i < 16; ++i) { + lanes[i] = getLaneIndex(32); + } + return builder.makeSIMDShuffle(lanes); + } + case BinaryConsts::V128Bitselect: + return builder.makeSIMDTernary(Bitselect); + case BinaryConsts::I8x16Laneselect: + return builder.makeSIMDTernary(LaneselectI8x16); + case BinaryConsts::I16x8Laneselect: + return builder.makeSIMDTernary(LaneselectI16x8); + case BinaryConsts::I32x4Laneselect: + return builder.makeSIMDTernary(LaneselectI32x4); + case BinaryConsts::I64x2Laneselect: + return builder.makeSIMDTernary(LaneselectI64x2); + case BinaryConsts::F16x8RelaxedMadd: + return builder.makeSIMDTernary(RelaxedMaddVecF16x8); + case BinaryConsts::F16x8RelaxedNmadd: + return builder.makeSIMDTernary(RelaxedNmaddVecF16x8); + case BinaryConsts::F32x4RelaxedMadd: + return builder.makeSIMDTernary(RelaxedMaddVecF32x4); + case BinaryConsts::F32x4RelaxedNmadd: + return builder.makeSIMDTernary(RelaxedNmaddVecF32x4); + case BinaryConsts::F64x2RelaxedMadd: + return builder.makeSIMDTernary(RelaxedMaddVecF64x2); + case BinaryConsts::F64x2RelaxedNmadd: + return builder.makeSIMDTernary(RelaxedNmaddVecF64x2); + case BinaryConsts::I32x4DotI8x16I7x16AddS: + return builder.makeSIMDTernary(DotI8x16I7x16AddSToVecI32x4); + case BinaryConsts::I8x16Shl: + return builder.makeSIMDShift(ShlVecI8x16); + case BinaryConsts::I8x16ShrS: + return builder.makeSIMDShift(ShrSVecI8x16); + case BinaryConsts::I8x16ShrU: + return builder.makeSIMDShift(ShrUVecI8x16); + case BinaryConsts::I16x8Shl: + return builder.makeSIMDShift(ShlVecI16x8); + case BinaryConsts::I16x8ShrS: + return builder.makeSIMDShift(ShrSVecI16x8); + case BinaryConsts::I16x8ShrU: + return builder.makeSIMDShift(ShrUVecI16x8); + case BinaryConsts::I32x4Shl: + return builder.makeSIMDShift(ShlVecI32x4); + case BinaryConsts::I32x4ShrS: + return builder.makeSIMDShift(ShrSVecI32x4); + case BinaryConsts::I32x4ShrU: + return builder.makeSIMDShift(ShrUVecI32x4); + case BinaryConsts::I64x2Shl: + return builder.makeSIMDShift(ShlVecI64x2); + case BinaryConsts::I64x2ShrS: + return builder.makeSIMDShift(ShrSVecI64x2); + case BinaryConsts::I64x2ShrU: + return builder.makeSIMDShift(ShrUVecI64x2); + case BinaryConsts::V128Const: + return builder.makeConst(getVec128Literal()); + case BinaryConsts::V128Store: { + auto [mem, align, offset] = getMemarg(); + return builder.makeStore(16, offset, align, Type::v128, mem); + } + case BinaryConsts::V128Load: { + auto [mem, align, offset] = getMemarg(); + return builder.makeLoad(16, false, offset, align, Type::v128, mem); + } + case BinaryConsts::V128Load8Splat: { + auto [mem, align, offset] = getMemarg(); + return builder.makeSIMDLoad(Load8SplatVec128, offset, align, mem); + } + case BinaryConsts::V128Load16Splat: { + auto [mem, align, offset] = getMemarg(); + return builder.makeSIMDLoad(Load16SplatVec128, offset, align, mem); + } + case BinaryConsts::V128Load32Splat: { + auto [mem, align, offset] = getMemarg(); + return builder.makeSIMDLoad(Load32SplatVec128, offset, align, mem); + } + case BinaryConsts::V128Load64Splat: { + auto [mem, align, offset] = getMemarg(); + return builder.makeSIMDLoad(Load64SplatVec128, offset, align, mem); + } + case BinaryConsts::V128Load8x8S: { + auto [mem, align, offset] = getMemarg(); + return builder.makeSIMDLoad(Load8x8SVec128, offset, align, mem); + } + case BinaryConsts::V128Load8x8U: { + auto [mem, align, offset] = getMemarg(); + return builder.makeSIMDLoad(Load8x8UVec128, offset, align, mem); + } + case BinaryConsts::V128Load16x4S: { + auto [mem, align, offset] = getMemarg(); + return builder.makeSIMDLoad(Load16x4SVec128, offset, align, mem); + } + case BinaryConsts::V128Load16x4U: { + auto [mem, align, offset] = getMemarg(); + return builder.makeSIMDLoad(Load16x4UVec128, offset, align, mem); + } + case BinaryConsts::V128Load32x2S: { + auto [mem, align, offset] = getMemarg(); + return builder.makeSIMDLoad(Load32x2SVec128, offset, align, mem); + } + case BinaryConsts::V128Load32x2U: { + auto [mem, align, offset] = getMemarg(); + return builder.makeSIMDLoad(Load32x2UVec128, offset, align, mem); + } + case BinaryConsts::V128Load32Zero: { + auto [mem, align, offset] = getMemarg(); + return builder.makeSIMDLoad(Load32ZeroVec128, offset, align, mem); + } + case BinaryConsts::V128Load64Zero: { + auto [mem, align, offset] = getMemarg(); + return builder.makeSIMDLoad(Load64ZeroVec128, offset, align, mem); + } + case BinaryConsts::V128Load8Lane: { + auto [mem, align, offset] = getMemarg(); + return builder.makeSIMDLoadStoreLane( + Load8LaneVec128, offset, align, getLaneIndex(16), mem); + } + case BinaryConsts::V128Load16Lane: { + auto [mem, align, offset] = getMemarg(); + return builder.makeSIMDLoadStoreLane( + Load16LaneVec128, offset, align, getLaneIndex(8), mem); + } + case BinaryConsts::V128Load32Lane: { + auto [mem, align, offset] = getMemarg(); + return builder.makeSIMDLoadStoreLane( + Load32LaneVec128, offset, align, getLaneIndex(4), mem); + } + case BinaryConsts::V128Load64Lane: { + auto [mem, align, offset] = getMemarg(); + return builder.makeSIMDLoadStoreLane( + Load64LaneVec128, offset, align, getLaneIndex(2), mem); + } + case BinaryConsts::V128Store8Lane: { + auto [mem, align, offset] = getMemarg(); + return builder.makeSIMDLoadStoreLane( + Store8LaneVec128, offset, align, getLaneIndex(16), mem); + } + case BinaryConsts::V128Store16Lane: { + auto [mem, align, offset] = getMemarg(); + return builder.makeSIMDLoadStoreLane( + Store16LaneVec128, offset, align, getLaneIndex(8), mem); + } + case BinaryConsts::V128Store32Lane: { + auto [mem, align, offset] = getMemarg(); + return builder.makeSIMDLoadStoreLane( + Store32LaneVec128, offset, align, getLaneIndex(4), mem); + } + case BinaryConsts::V128Store64Lane: { + auto [mem, align, offset] = getMemarg(); + return builder.makeSIMDLoadStoreLane( + Store64LaneVec128, offset, align, getLaneIndex(2), mem); + } + } + return Err{"unknown SIMD operation"}; + } + case BinaryConsts::GCPrefix: { + auto op = getU32LEB(); + switch (op) { + case BinaryConsts::RefI31: + return builder.makeRefI31(Unshared); + case BinaryConsts::RefI31Shared: + return builder.makeRefI31(Shared); + case BinaryConsts::I31GetS: + return builder.makeI31Get(true); + case BinaryConsts::I31GetU: + return builder.makeI31Get(false); + case BinaryConsts::RefTest: + return builder.makeRefTest(Type(getHeapType(), NonNullable)); + case BinaryConsts::RefTestNull: + return builder.makeRefTest(Type(getHeapType(), Nullable)); + case BinaryConsts::RefCast: + return builder.makeRefCast(Type(getHeapType(), NonNullable)); + case BinaryConsts::RefCastNull: + return builder.makeRefCast(Type(getHeapType(), Nullable)); + case BinaryConsts::BrOnCast: + case BinaryConsts::BrOnCastFail: { + auto flags = getInt8(); + auto label = getU32LEB(); + auto in = Type(getHeapType(), (flags & 1) ? Nullable : NonNullable); + auto cast = Type(getHeapType(), (flags & 2) ? Nullable : NonNullable); + auto kind = op == BinaryConsts::BrOnCast ? BrOnCast : BrOnCastFail; + return builder.makeBrOn(label, kind, in, cast); + } + case BinaryConsts::StructNew: + return builder.makeStructNew(getIndexedHeapType()); + case BinaryConsts::StructNewDefault: + return builder.makeStructNewDefault(getIndexedHeapType()); + case BinaryConsts::StructGet: + case BinaryConsts::StructGetS: + case BinaryConsts::StructGetU: { + auto type = getIndexedHeapType(); + auto field = getU32LEB(); + return builder.makeStructGet( + type, field, op == BinaryConsts::StructGetS); + } + case BinaryConsts::StructSet: { + auto type = getIndexedHeapType(); + auto field = getU32LEB(); + return builder.makeStructSet(type, field); + } + case BinaryConsts::ArrayNew: + return builder.makeArrayNew(getIndexedHeapType()); + case BinaryConsts::ArrayNewDefault: + return builder.makeArrayNewDefault(getIndexedHeapType()); + case BinaryConsts::ArrayNewFixed: { + auto type = getIndexedHeapType(); + auto arity = getU32LEB(); + return builder.makeArrayNewFixed(type, arity); + } + case BinaryConsts::ArrayNewData: { + auto type = getIndexedHeapType(); + auto data = getDataName(getU32LEB()); + return builder.makeArrayNewData(type, data); + } + case BinaryConsts::ArrayNewElem: { + auto type = getIndexedHeapType(); + auto elem = getElemName(getU32LEB()); + return builder.makeArrayNewElem(type, elem); + } + case BinaryConsts::ArrayGet: + case BinaryConsts::ArrayGetU: + return builder.makeArrayGet(getIndexedHeapType(), false); + case BinaryConsts::ArrayGetS: + return builder.makeArrayGet(getIndexedHeapType(), true); + case BinaryConsts::ArraySet: + return builder.makeArraySet(getIndexedHeapType()); + case BinaryConsts::ArrayLen: + return builder.makeArrayLen(); + case BinaryConsts::ArrayCopy: { + auto dest = getIndexedHeapType(); + auto src = getIndexedHeapType(); + return builder.makeArrayCopy(dest, src); + } + case BinaryConsts::ArrayFill: + return builder.makeArrayFill(getIndexedHeapType()); + case BinaryConsts::ArrayInitData: { + auto type = getIndexedHeapType(); + auto data = getDataName(getU32LEB()); + return builder.makeArrayInitData(type, data); + } + case BinaryConsts::ArrayInitElem: { + auto type = getIndexedHeapType(); + auto elem = getElemName(getU32LEB()); + return builder.makeArrayInitElem(type, elem); + } + case BinaryConsts::StringNewLossyUTF8Array: + return builder.makeStringNew(StringNewLossyUTF8Array); + case BinaryConsts::StringNewWTF16Array: + return builder.makeStringNew(StringNewWTF16Array); + case BinaryConsts::StringFromCodePoint: + return builder.makeStringNew(StringNewFromCodePoint); + case BinaryConsts::StringAsWTF16: + // This turns into nothing because we do not represent stringviews in + // the IR. + return Ok{}; + case BinaryConsts::StringConst: + return builder.makeStringConst(getIndexedString()); + case BinaryConsts::StringMeasureUTF8: + return builder.makeStringMeasure(StringMeasureUTF8); + case BinaryConsts::StringMeasureWTF16: + return builder.makeStringMeasure(StringMeasureWTF16); + case BinaryConsts::StringEncodeLossyUTF8Array: + return builder.makeStringEncode(StringEncodeLossyUTF8Array); + case BinaryConsts::StringEncodeWTF16Array: + return builder.makeStringEncode(StringEncodeWTF16Array); + case BinaryConsts::StringConcat: + return builder.makeStringConcat(); + case BinaryConsts::StringEq: + return builder.makeStringEq(StringEqEqual); + case BinaryConsts::StringCompare: + return builder.makeStringEq(StringEqCompare); + case BinaryConsts::StringViewWTF16GetCodePoint: + return builder.makeStringWTF16Get(); + case BinaryConsts::StringViewWTF16Slice: + return builder.makeStringSliceWTF(); + case BinaryConsts::AnyConvertExtern: + return builder.makeRefAs(AnyConvertExtern); + case BinaryConsts::ExternConvertAny: + return builder.makeRefAs(ExternConvertAny); + } + return Err{"unknown GC operation"}; + } + } + return Err{"unknown operation"}; +} + void WasmBinaryReader::readExports() { size_t num = getU32LEB(); std::unordered_set names; @@ -2969,14 +4303,19 @@ void WasmBinaryReader::readNextDebugLocation() { } Expression* WasmBinaryReader::readExpression() { - assert(depth == 0); - processExpressions(); - if (expressionStack.size() != 1) { - throwError("expected to read a single expression"); + assert(builder.empty()); + while (input[pos] != BinaryConsts::End) { + auto inst = readInst(); + if (auto* err = inst.getErr()) { + throwError(err->msg); + } } - auto* ret = popExpression(); - assert(depth == 0); - return ret; + ++pos; + auto expr = builder.build(); + if (auto* err = expr.getErr()) { + throwError(err->msg); + } + return *expr; } void WasmBinaryReader::readStrings() { @@ -2997,6 +4336,14 @@ void WasmBinaryReader::readStrings() { } } +Name WasmBinaryReader::getIndexedString() { + auto index = getU32LEB(); + if (index >= strings.size()) { + throwError("bad string index"); + } + return strings[index]; +} + void WasmBinaryReader::readGlobals() { size_t num = getU32LEB(); for (size_t i = 0; i < num; i++) { @@ -3016,209 +4363,31 @@ void WasmBinaryReader::readGlobals() { } } -void WasmBinaryReader::processExpressions() { - unreachableInTheWasmSense = false; - while (1) { - Expression* curr; - auto ret = readExpression(curr); - if (!curr) { - lastSeparator = ret; - return; - } - pushExpression(curr); - if (curr->type == Type::unreachable) { - // Once we see something unreachable, we don't want to add anything else - // to the stack, as it could be stacky code that is non-representable in - // our AST. but we do need to skip it. - // If there is nothing else here, just stop. Otherwise, go into - // unreachable mode. peek to see what to do. - if (pos == endOfFunction) { - throwError("Reached function end without seeing End opcode"); - } - if (!more()) { - throwError("unexpected end of input"); - } - auto peek = input[pos]; - if (peek == BinaryConsts::End || peek == BinaryConsts::Else || - peek == BinaryConsts::Catch_Legacy || - peek == BinaryConsts::CatchAll_Legacy || - peek == BinaryConsts::Delegate) { - lastSeparator = BinaryConsts::ASTNodes(peek); - // Read the byte we peeked at. No new instruction is generated for it. - Expression* dummy = nullptr; - readExpression(dummy); - assert(!dummy); - return; - } else { - skipUnreachableCode(); - return; - } - } +void WasmBinaryReader::validateBinary() { + if (hasDataCount && wasm.dataSegments.size() != dataCount) { + throwError("Number of segments does not agree with DataCount section"); } -} -void WasmBinaryReader::skipUnreachableCode() { - // preserve the stack, and restore it. it contains the instruction that made - // us unreachable, and we can ignore anything after it. things after it may - // pop, we want to undo that - auto savedStack = expressionStack; - // note we are entering unreachable code, and note what the state as before so - // we can restore it - auto before = willBeIgnored; - willBeIgnored = true; - // clear the stack. nothing should be popped from there anyhow, just stuff - // can be pushed and then popped. Popping past the top of the stack will - // result in uneachables being returned - expressionStack.clear(); - while (1) { - // set the unreachableInTheWasmSense flag each time, as sub-blocks may set - // and unset it - unreachableInTheWasmSense = true; - Expression* curr; - auto ret = readExpression(curr); - if (!curr) { - lastSeparator = ret; - unreachableInTheWasmSense = false; - willBeIgnored = before; - expressionStack = savedStack; - return; - } - if (curr->type == Type::unreachable) { - // Nothing before this unreachable should be available to future - // expressions. They will get `(unreachable)`s if they try to pop past - // this point. - expressionStack.clear(); - } else { - pushExpression(curr); - } + if (functionTypes.size() != numFuncImports + numFuncBodies) { + throwError("function and code sections have inconsistent lengths"); } } -void WasmBinaryReader::pushExpression(Expression* curr) { - auto type = curr->type; - if (type.isTuple()) { - // Store tuple to local and push individual extracted values. - Builder builder(wasm); - requireFunctionContext("pushExpression-tuple"); - Index tuple = builder.addVar(currFunction, type); - expressionStack.push_back(builder.makeLocalSet(tuple, curr)); - for (Index i = 0; i < type.size(); ++i) { - expressionStack.push_back( - builder.makeTupleExtract(builder.makeLocalGet(tuple, type), i)); +void WasmBinaryReader::processNames() { + // Now that we have final names for module elements, update the names used in + // expressions and anywhere else. + struct NameUpdater + : WalkerPass< + PostWalker>> { + WasmBinaryReader& parent; + NameUpdater(WasmBinaryReader& parent) : parent(parent) {} + bool isFunctionParallel() override { return true; } + std::unique_ptr create() override { + return std::make_unique(parent); } - } else { - expressionStack.push_back(curr); - } -} -Expression* WasmBinaryReader::popExpression() { - if (expressionStack.empty()) { - if (unreachableInTheWasmSense) { - // in unreachable code, trying to pop past the polymorphic stack - // area results in receiving unreachables - return allocator.alloc(); - } - throwError( - "attempted pop from empty stack / beyond block start boundary at " + - std::to_string(pos)); - } - // the stack is not empty, and we would not be going out of the current block - auto ret = expressionStack.back(); - assert(!ret->type.isTuple()); - expressionStack.pop_back(); - return ret; -} - -Expression* WasmBinaryReader::popNonVoidExpression() { - auto* ret = popExpression(); - if (ret->type != Type::none) { - return ret; - } - // we found a void, so this is stacky code that we must handle carefully - Builder builder(wasm); - // add elements until we find a non-void - std::vector expressions; - expressions.push_back(ret); - while (1) { - auto* curr = popExpression(); - expressions.push_back(curr); - if (curr->type != Type::none) { - break; - } - } - auto* block = builder.makeBlock(); - while (!expressions.empty()) { - block->list.push_back(expressions.back()); - expressions.pop_back(); - } - requireFunctionContext("popping void where we need a new local"); - auto type = block->list[0]->type; - if (type.isConcrete()) { - auto local = builder.addVar(currFunction, type); - block->list[0] = builder.makeLocalSet(local, block->list[0]); - block->list.push_back(builder.makeLocalGet(local, type)); - } else { - assert(type == Type::unreachable); - // nothing to do here - unreachable anyhow - } - block->finalize(); - return block; -} - -Expression* WasmBinaryReader::popTuple(size_t numElems) { - Builder builder(wasm); - std::vector elements; - elements.resize(numElems); - for (size_t i = 0; i < numElems; i++) { - auto* elem = popNonVoidExpression(); - if (elem->type == Type::unreachable) { - // All the previously-popped items cannot be reached, so ignore them. We - // cannot continue popping because there might not be enough items on the - // expression stack after an unreachable expression. Any remaining - // elements can stay unperturbed on the stack and will be explicitly - // dropped by some parent call to pushBlockElements. - return elem; - } - elements[numElems - i - 1] = elem; - } - return Builder(wasm).makeTupleMake(std::move(elements)); -} - -Expression* WasmBinaryReader::popTypedExpression(Type type) { - if (type.isSingle()) { - return popNonVoidExpression(); - } else if (type.isTuple()) { - return popTuple(type.size()); - } else { - WASM_UNREACHABLE("Invalid popped type"); - } -} - -void WasmBinaryReader::validateBinary() { - if (hasDataCount && wasm.dataSegments.size() != dataCount) { - throwError("Number of segments does not agree with DataCount section"); - } - - if (functionTypes.size() != numFuncImports + numFuncBodies) { - throwError("function and code sections have inconsistent lengths"); - } -} - -void WasmBinaryReader::processNames() { - // Now that we have final names for module elements, update the names used in - // expressions and anywhere else. - struct NameUpdater - : WalkerPass< - PostWalker>> { - WasmBinaryReader& parent; - NameUpdater(WasmBinaryReader& parent) : parent(parent) {} - bool isFunctionParallel() override { return true; } - std::unique_ptr create() override { - return std::make_unique(parent); - } - - void visitExpression(Expression* curr) { - auto& wasm = *getModule(); + void visitExpression(Expression* curr) { + auto& wasm = *getModule(); #define DELEGATE_ID curr->_id #define DELEGATE_START(id) [[maybe_unused]] auto* cast = curr->cast(); @@ -3653,12 +4822,13 @@ void WasmBinaryReader::readNames(size_t payloadLen) { continue; // read and discard in case of prior error } auto localName = processor.process(rawLocalName); + localName = Names::getValidLocalName(*func, localName); if (localName.size() == 0) { std::cerr << "warning: empty local name at index " << std::to_string(localIndex) << " in function " << std::string(func->name.str) << std::endl; } else if (localIndex < func->getNumLocals()) { - func->localNames[localIndex] = localName; + func->setLocalName(localIndex, localName); } else { std::cerr << "warning: local index out of bounds in name " "section, local subsection: " @@ -3973,749 +5143,20 @@ void WasmBinaryReader::readDylink0(size_t payloadLen) { } } -BinaryConsts::ASTNodes WasmBinaryReader::readExpression(Expression*& curr) { - if (pos == endOfFunction) { - throwError("Reached function end without seeing End opcode"); +Index WasmBinaryReader::readMemoryAccess(Address& alignment, Address& offset) { + auto rawAlignment = getU32LEB(); + bool hasMemIdx = false; + Index memIdx = 0; + // Check bit 6 in the alignment to know whether a memory index is present per: + // https://github.com/WebAssembly/multi-memory/blob/main/proposals/multi-memory/Overview.md + if (rawAlignment & (1 << (6))) { + hasMemIdx = true; + // Clear the bit before we parse alignment + rawAlignment = rawAlignment & ~(1 << 6); } - readNextDebugLocation(); - std::set currDebugLocation; - if (debugLocation.size()) { - currDebugLocation.insert(*debugLocation.begin()); - } - size_t startPos = pos; - uint8_t code = getInt8(); - switch (code) { - case BinaryConsts::Block: - visitBlock((curr = allocator.alloc())->cast()); - break; - case BinaryConsts::If: - visitIf((curr = allocator.alloc())->cast()); - break; - case BinaryConsts::Loop: - visitLoop((curr = allocator.alloc())->cast()); - break; - case BinaryConsts::Br: - case BinaryConsts::BrIf: - visitBreak((curr = allocator.alloc())->cast(), code); - break; // code distinguishes br from br_if - case BinaryConsts::BrTable: - visitSwitch((curr = allocator.alloc())->cast()); - break; - case BinaryConsts::CallFunction: - visitCall((curr = allocator.alloc())->cast()); - break; - case BinaryConsts::CallIndirect: - visitCallIndirect( - (curr = allocator.alloc())->cast()); - break; - case BinaryConsts::RetCallFunction: { - auto call = allocator.alloc(); - call->isReturn = true; - curr = call; - visitCall(call); - break; - } - case BinaryConsts::RetCallIndirect: { - auto call = allocator.alloc(); - call->isReturn = true; - curr = call; - visitCallIndirect(call); - break; - } - case BinaryConsts::LocalGet: - visitLocalGet((curr = allocator.alloc())->cast()); - break; - case BinaryConsts::LocalTee: - case BinaryConsts::LocalSet: - visitLocalSet((curr = allocator.alloc())->cast(), - code); - break; - case BinaryConsts::GlobalGet: - visitGlobalGet((curr = allocator.alloc())->cast()); - break; - case BinaryConsts::GlobalSet: - visitGlobalSet((curr = allocator.alloc())->cast()); - break; - case BinaryConsts::Select: - case BinaryConsts::SelectWithType: - visitSelect((curr = allocator.alloc(), code); - break; - case BinaryConsts::Return: - visitReturn((curr = allocator.alloc())->cast()); - break; - case BinaryConsts::Nop: - visitNop((curr = allocator.alloc())->cast()); - break; - case BinaryConsts::Unreachable: - visitUnreachable( - (curr = allocator.alloc())->cast()); - break; - case BinaryConsts::Drop: - visitDrop((curr = allocator.alloc())->cast()); - break; - case BinaryConsts::End: - curr = nullptr; - // Pop the current control flow structure off the stack. If there is none - // then this is the "end" of the function itself, which also emits an - // "end" byte. - if (!controlFlowStack.empty()) { - controlFlowStack.pop_back(); - } - break; - case BinaryConsts::Else: - case BinaryConsts::Catch_Legacy: - case BinaryConsts::CatchAll_Legacy: { - curr = nullptr; - if (DWARF && currFunction) { - assert(!controlFlowStack.empty()); - auto currControlFlow = controlFlowStack.back(); - BinaryLocation delimiterId; - if (currControlFlow->is()) { - delimiterId = BinaryLocations::Else; - } else { - // Both Catch and CatchAll can simply append to the list as we go, as - // we visit them in the right order in the binary, and like the binary - // we store the CatchAll at the end. - delimiterId = - currFunction->delimiterLocations[currControlFlow].size(); - } - currFunction->delimiterLocations[currControlFlow][delimiterId] = - startPos - codeSectionLocation; - } - break; - } - case BinaryConsts::Delegate: { - curr = nullptr; - if (DWARF && currFunction) { - assert(!controlFlowStack.empty()); - controlFlowStack.pop_back(); - } - break; - } - case BinaryConsts::RefNull: - visitRefNull((curr = allocator.alloc())->cast()); - break; - case BinaryConsts::RefIsNull: - visitRefIsNull((curr = allocator.alloc())->cast()); - break; - case BinaryConsts::RefFunc: - visitRefFunc((curr = allocator.alloc())->cast()); - break; - case BinaryConsts::RefEq: - visitRefEq((curr = allocator.alloc())->cast()); - break; - case BinaryConsts::RefAsNonNull: - visitRefAs((curr = allocator.alloc())->cast(), code); - break; - case BinaryConsts::BrOnNull: - maybeVisitBrOn(curr, code); - break; - case BinaryConsts::BrOnNonNull: - maybeVisitBrOn(curr, code); - break; - case BinaryConsts::TableGet: - visitTableGet((curr = allocator.alloc())->cast()); - break; - case BinaryConsts::TableSet: - visitTableSet((curr = allocator.alloc())->cast()); - break; - case BinaryConsts::Try: - visitTryOrTryInBlock(curr); - break; - case BinaryConsts::TryTable: - visitTryTable((curr = allocator.alloc())->cast()); - break; - case BinaryConsts::Throw: - visitThrow((curr = allocator.alloc())->cast()); - break; - case BinaryConsts::Rethrow: - visitRethrow((curr = allocator.alloc())->cast()); - break; - case BinaryConsts::ThrowRef: - visitThrowRef((curr = allocator.alloc())->cast()); - break; - case BinaryConsts::MemorySize: { - auto size = allocator.alloc(); - curr = size; - visitMemorySize(size); - break; - } - case BinaryConsts::MemoryGrow: { - auto grow = allocator.alloc(); - curr = grow; - visitMemoryGrow(grow); - break; - } - case BinaryConsts::CallRef: - case BinaryConsts::RetCallRef: { - auto call = allocator.alloc(); - call->isReturn = code == BinaryConsts::RetCallRef; - curr = call; - visitCallRef(call); - break; - } - case BinaryConsts::ContBind: { - visitContBind((curr = allocator.alloc())->cast()); - break; - } - case BinaryConsts::ContNew: { - auto contNew = allocator.alloc(); - curr = contNew; - visitContNew(contNew); - break; - } - case BinaryConsts::Resume: { - visitResume((curr = allocator.alloc())->cast()); - break; - } - case BinaryConsts::Suspend: { - visitSuspend((curr = allocator.alloc())->cast()); - break; - } - case BinaryConsts::AtomicPrefix: { - code = static_cast(getU32LEB()); - if (maybeVisitLoad(curr, code, BinaryConsts::AtomicPrefix)) { - break; - } - if (maybeVisitStore(curr, code, BinaryConsts::AtomicPrefix)) { - break; - } - if (maybeVisitAtomicRMW(curr, code)) { - break; - } - if (maybeVisitAtomicCmpxchg(curr, code)) { - break; - } - if (maybeVisitAtomicWait(curr, code)) { - break; - } - if (maybeVisitAtomicNotify(curr, code)) { - break; - } - if (maybeVisitAtomicFence(curr, code)) { - break; - } - throwError("invalid code after atomic prefix: " + std::to_string(code)); - break; - } - case BinaryConsts::MiscPrefix: { - auto opcode = getU32LEB(); - if (maybeVisitTruncSat(curr, opcode)) { - break; - } - if (maybeVisitMemoryInit(curr, opcode)) { - break; - } - if (maybeVisitDataDrop(curr, opcode)) { - break; - } - if (maybeVisitMemoryCopy(curr, opcode)) { - break; - } - if (maybeVisitMemoryFill(curr, opcode)) { - break; - } - if (maybeVisitTableSize(curr, opcode)) { - break; - } - if (maybeVisitTableGrow(curr, opcode)) { - break; - } - if (maybeVisitTableFill(curr, opcode)) { - break; - } - if (maybeVisitTableCopy(curr, opcode)) { - break; - } - if (maybeVisitTableInit(curr, opcode)) { - break; - } - if (maybeVisitLoad(curr, opcode, BinaryConsts::MiscPrefix)) { - break; - } - if (maybeVisitStore(curr, opcode, BinaryConsts::MiscPrefix)) { - break; - } - throwError("invalid code after misc prefix: " + std::to_string(opcode)); - break; - } - case BinaryConsts::SIMDPrefix: { - auto opcode = getU32LEB(); - if (maybeVisitSIMDBinary(curr, opcode)) { - break; - } - if (maybeVisitSIMDUnary(curr, opcode)) { - break; - } - if (maybeVisitSIMDConst(curr, opcode)) { - break; - } - if (maybeVisitSIMDStore(curr, opcode)) { - break; - } - if (maybeVisitSIMDExtract(curr, opcode)) { - break; - } - if (maybeVisitSIMDReplace(curr, opcode)) { - break; - } - if (maybeVisitSIMDShuffle(curr, opcode)) { - break; - } - if (maybeVisitSIMDTernary(curr, opcode)) { - break; - } - if (maybeVisitSIMDShift(curr, opcode)) { - break; - } - if (maybeVisitSIMDLoad(curr, opcode)) { - break; - } - if (maybeVisitSIMDLoadStoreLane(curr, opcode)) { - break; - } - throwError("invalid code after SIMD prefix: " + std::to_string(opcode)); - break; - } - case BinaryConsts::GCPrefix: { - auto opcode = getU32LEB(); - if (maybeVisitRefI31(curr, opcode)) { - break; - } - if (maybeVisitI31Get(curr, opcode)) { - break; - } - if (maybeVisitRefTest(curr, opcode)) { - break; - } - if (maybeVisitRefCast(curr, opcode)) { - break; - } - if (maybeVisitBrOn(curr, opcode)) { - break; - } - if (maybeVisitStructNew(curr, opcode)) { - break; - } - if (maybeVisitStructGet(curr, opcode)) { - break; - } - if (maybeVisitStructSet(curr, opcode)) { - break; - } - if (maybeVisitArrayNewData(curr, opcode)) { - break; - } - if (maybeVisitArrayNewElem(curr, opcode)) { - break; - } - if (maybeVisitArrayNewFixed(curr, opcode)) { - break; - } - if (maybeVisitArrayGet(curr, opcode)) { - break; - } - if (maybeVisitArraySet(curr, opcode)) { - break; - } - if (maybeVisitArrayLen(curr, opcode)) { - break; - } - if (maybeVisitArrayCopy(curr, opcode)) { - break; - } - if (maybeVisitArrayFill(curr, opcode)) { - break; - } - if (maybeVisitArrayInit(curr, opcode)) { - break; - } - if (maybeVisitStringNew(curr, opcode)) { - break; - } - if (maybeVisitStringAsWTF16(curr, opcode)) { - break; - } - if (maybeVisitStringConst(curr, opcode)) { - break; - } - if (maybeVisitStringMeasure(curr, opcode)) { - break; - } - if (maybeVisitStringEncode(curr, opcode)) { - break; - } - if (maybeVisitStringConcat(curr, opcode)) { - break; - } - if (maybeVisitStringEq(curr, opcode)) { - break; - } - if (maybeVisitStringWTF16Get(curr, opcode)) { - break; - } - if (maybeVisitStringSliceWTF(curr, opcode)) { - break; - } - if (opcode == BinaryConsts::AnyConvertExtern || - opcode == BinaryConsts::ExternConvertAny) { - visitRefAs((curr = allocator.alloc())->cast(), opcode); - break; - } - throwError("invalid code after GC prefix: " + std::to_string(opcode)); - break; - } - default: { - // otherwise, the code is a subcode TODO: optimize - if (maybeVisitBinary(curr, code)) { - break; - } - if (maybeVisitUnary(curr, code)) { - break; - } - if (maybeVisitConst(curr, code)) { - break; - } - if (maybeVisitLoad(curr, code, /*prefix=*/std::nullopt)) { - break; - } - if (maybeVisitStore(curr, code, /*prefix=*/std::nullopt)) { - break; - } - throwError("bad node code " + std::to_string(code)); - break; - } - } - if (curr) { - if (currDebugLocation.size()) { - requireFunctionContext("debugLocation"); - currFunction->debugLocations[curr] = *currDebugLocation.begin(); - } - if (DWARF && currFunction) { - currFunction->expressionLocations[curr] = - BinaryLocations::Span{BinaryLocation(startPos - codeSectionLocation), - BinaryLocation(pos - codeSectionLocation)}; - } - } - return BinaryConsts::ASTNodes(code); -} - -void WasmBinaryReader::startControlFlow(Expression* curr) { - if (DWARF && currFunction) { - controlFlowStack.push_back(curr); - } -} - -void WasmBinaryReader::pushBlockElements(Block* curr, Type type, size_t start) { - assert(start <= expressionStack.size()); - // The results of this block are the last values pushed to the expressionStack - Expression* results = nullptr; - if (type.isConcrete()) { - results = popTypedExpression(type); - } - if (expressionStack.size() < start) { - throwError("Block requires more values than are available"); - } - // Everything else on the stack after `start` is either a none-type expression - // or a concretely-type expression that is implicitly dropped due to - // unreachability at the end of the block, like this: - // - // block i32 - // i32.const 1 - // i32.const 2 - // i32.const 3 - // return - // end - // - // The first two const elements will be emitted as drops in the block (the - // optimizer can remove them, of course, but in general we may need dropped - // items here as they may have side effects). - // - for (size_t i = start; i < expressionStack.size(); ++i) { - auto* item = expressionStack[i]; - if (item->type.isConcrete()) { - item = Builder(wasm).makeDrop(item); - } - curr->list.push_back(item); - } - expressionStack.resize(start); - if (results != nullptr) { - curr->list.push_back(results); - } -} - -void WasmBinaryReader::visitBlock(Block* curr) { - startControlFlow(curr); - // special-case Block and de-recurse nested blocks in their first position, as - // that is a common pattern that can be very highly nested. - std::vector stack; - while (1) { - curr->type = getType(); - curr->name = getNextLabel(); - breakStack.push_back({curr->name, curr->type}); - stack.push_back(curr); - if (more() && input[pos] == BinaryConsts::Block) { - // a recursion - readNextDebugLocation(); - curr = allocator.alloc(); - startControlFlow(curr); - pos++; - if (debugLocation.size()) { - requireFunctionContext("block-debugLocation"); - currFunction->debugLocations[curr] = *debugLocation.begin(); - } - continue; - } else { - // end of recursion - break; - } - } - Block* last = nullptr; - while (stack.size() > 0) { - curr = stack.back(); - stack.pop_back(); - // everything after this, that is left when we see the marker, is ours - size_t start = expressionStack.size(); - if (last) { - // the previous block is our first-position element - pushExpression(last); - } - last = curr; - processExpressions(); - size_t end = expressionStack.size(); - if (end < start) { - throwError("block cannot pop from outside"); - } - pushBlockElements(curr, curr->type, start); - curr->finalize(curr->type, - breakTargetNames.find(curr->name) != breakTargetNames.end() - ? Block::HasBreak - : Block::NoBreak); - breakStack.pop_back(); - breakTargetNames.erase(curr->name); - } -} - -// Gets a block of expressions. If it's just one, return that singleton. -Expression* WasmBinaryReader::getBlockOrSingleton(Type type) { - Name label = getNextLabel(); - breakStack.push_back({label, type}); - auto start = expressionStack.size(); - - processExpressions(); - size_t end = expressionStack.size(); - if (end < start) { - throwError("block cannot pop from outside"); - } - breakStack.pop_back(); - auto* block = allocator.alloc(); - pushBlockElements(block, type, start); - block->name = label; - block->finalize(type); - // maybe we don't need a block here? - if (breakTargetNames.find(block->name) == breakTargetNames.end() && - exceptionTargetNames.find(block->name) == exceptionTargetNames.end()) { - block->name = Name(); - if (block->list.size() == 1) { - return block->list[0]; - } - } - breakTargetNames.erase(block->name); - return block; -} - -void WasmBinaryReader::visitIf(If* curr) { - startControlFlow(curr); - curr->type = getType(); - curr->condition = popNonVoidExpression(); - curr->ifTrue = getBlockOrSingleton(curr->type); - if (lastSeparator == BinaryConsts::Else) { - curr->ifFalse = getBlockOrSingleton(curr->type); - } - curr->finalize(curr->type); - if (lastSeparator != BinaryConsts::End) { - throwError("if should end with End"); - } -} - -void WasmBinaryReader::visitLoop(Loop* curr) { - startControlFlow(curr); - curr->type = getType(); - curr->name = getNextLabel(); - breakStack.push_back({curr->name, Type::none}); - // find the expressions in the block, and create the body - // a loop may have a list of instructions in wasm, much like - // a block, but it only has a label at the top of the loop, - // so even if we need a block (if there is more than 1 - // expression) we never need a label on the block. - auto start = expressionStack.size(); - processExpressions(); - size_t end = expressionStack.size(); - if (start > end) { - throwError("block cannot pop from outside"); - } - if (end - start == 1) { - curr->body = popExpression(); - } else { - auto* block = allocator.alloc(); - pushBlockElements(block, curr->type, start); - block->finalize(curr->type); - curr->body = block; - } - breakStack.pop_back(); - breakTargetNames.erase(curr->name); - curr->finalize(curr->type); -} - -WasmBinaryReader::BreakTarget WasmBinaryReader::getBreakTarget(int32_t offset) { - if (breakStack.size() < 1 + size_t(offset)) { - throwError("bad breakindex (low)"); - } - size_t index = breakStack.size() - 1 - offset; - if (index >= breakStack.size()) { - throwError("bad breakindex (high)"); - } - auto& ret = breakStack[index]; - // if the break is in literally unreachable code, then we will not emit it - // anyhow, so do not note that the target has breaks to it - if (!willBeIgnored) { - breakTargetNames.insert(ret.name); - } - return ret; -} - -Name WasmBinaryReader::getExceptionTargetName(int32_t offset) { - // We always start parsing a function by creating a block label and pushing it - // in breakStack in getBlockOrSingleton, so if a 'delegate''s target is that - // block, it does not mean it targets that block; it throws to the caller. - if (breakStack.size() - 1 == size_t(offset)) { - return DELEGATE_CALLER_TARGET; - } - size_t index = breakStack.size() - 1 - offset; - if (index > breakStack.size()) { - throwError("bad try index (high)"); - } - auto& ret = breakStack[index]; - // if the delegate/rethrow is in literally unreachable code, then we will not - // emit it anyhow, so do not note that the target has a reference to it - if (!willBeIgnored) { - exceptionTargetNames.insert(ret.name); - } - return ret.name; -} - -void WasmBinaryReader::visitBreak(Break* curr, uint8_t code) { - BreakTarget target = getBreakTarget(getU32LEB()); - curr->name = target.name; - if (code == BinaryConsts::BrIf) { - curr->condition = popNonVoidExpression(); - } - if (target.type.isConcrete()) { - curr->value = popTypedExpression(target.type); - } - curr->finalize(); -} - -void WasmBinaryReader::visitSwitch(Switch* curr) { - curr->condition = popNonVoidExpression(); - auto numTargets = getU32LEB(); - for (size_t i = 0; i < numTargets; i++) { - curr->targets.push_back(getBreakTarget(getU32LEB()).name); - } - auto defaultTarget = getBreakTarget(getU32LEB()); - curr->default_ = defaultTarget.name; - if (defaultTarget.type.isConcrete()) { - curr->value = popTypedExpression(defaultTarget.type); - } - curr->finalize(); -} - -void WasmBinaryReader::visitCall(Call* curr) { - auto index = getU32LEB(); - auto sig = getSignatureByFunctionIndex(index); - curr->target = getFunctionName(index); - auto num = sig.params.size(); - curr->operands.resize(num); - for (size_t i = 0; i < num; i++) { - curr->operands[num - i - 1] = popNonVoidExpression(); - } - curr->type = sig.results; - curr->finalize(); -} - -void WasmBinaryReader::visitCallIndirect(CallIndirect* curr) { - auto index = getU32LEB(); - curr->heapType = getTypeByIndex(index); - curr->table = getTableName(getU32LEB()); - // TODO: Handle error cases where `heapType` is not a signature? - auto num = curr->heapType.getSignature().params.size(); - curr->operands.resize(num); - curr->target = popNonVoidExpression(); - for (size_t i = 0; i < num; i++) { - curr->operands[num - i - 1] = popNonVoidExpression(); - } - curr->finalize(); -} - -void WasmBinaryReader::visitLocalGet(LocalGet* curr) { - requireFunctionContext("local.get"); - curr->index = getU32LEB(); - if (curr->index >= currFunction->getNumLocals()) { - throwError("bad local.get index"); - } - curr->type = currFunction->getLocalType(curr->index); - curr->finalize(); -} - -void WasmBinaryReader::visitLocalSet(LocalSet* curr, uint8_t code) { - requireFunctionContext("local.set outside of function"); - curr->index = getU32LEB(); - if (curr->index >= currFunction->getNumLocals()) { - throwError("bad local.set index"); - } - curr->value = popNonVoidExpression(); - if (code == BinaryConsts::LocalTee) { - curr->makeTee(currFunction->getLocalType(curr->index)); - } else { - curr->makeSet(); - } - curr->finalize(); -} - -void WasmBinaryReader::visitGlobalGet(GlobalGet* curr) { - auto index = getU32LEB(); - if (index >= wasm.globals.size()) { - throwError("invalid global index"); - } - auto* global = wasm.globals[index].get(); - curr->name = global->name; - curr->type = global->type; -} - -void WasmBinaryReader::visitGlobalSet(GlobalSet* curr) { - auto index = getU32LEB(); - if (index >= wasm.globals.size()) { - throwError("invalid global index"); - } - curr->name = wasm.globals[index]->name; - curr->value = popNonVoidExpression(); - curr->finalize(); -} - -Index WasmBinaryReader::readMemoryAccess(Address& alignment, Address& offset) { - auto rawAlignment = getU32LEB(); - bool hasMemIdx = false; - Index memIdx = 0; - // Check bit 6 in the alignment to know whether a memory index is present per: - // https://github.com/WebAssembly/multi-memory/blob/main/proposals/multi-memory/Overview.md - if (rawAlignment & (1 << (6))) { - hasMemIdx = true; - // Clear the bit before we parse alignment - rawAlignment = rawAlignment & ~(1 << 6); - } - - if (rawAlignment > 8) { - throwError("Alignment must be of a reasonable size"); + + if (rawAlignment > 8) { + throwError("Alignment must be of a reasonable size"); } alignment = Bits::pow2(rawAlignment); @@ -4731,3175 +5172,11 @@ Index WasmBinaryReader::readMemoryAccess(Address& alignment, Address& offset) { return memIdx; } -bool WasmBinaryReader::maybeVisitLoad( - Expression*& out, - uint8_t code, - std::optional prefix) { - Load* curr; - auto allocate = [&]() { curr = allocator.alloc(); }; - if (!prefix) { - switch (code) { - case BinaryConsts::I32LoadMem8S: - allocate(); - curr->bytes = 1; - curr->type = Type::i32; - curr->signed_ = true; - break; - case BinaryConsts::I32LoadMem8U: - allocate(); - curr->bytes = 1; - curr->type = Type::i32; - break; - case BinaryConsts::I32LoadMem16S: - allocate(); - curr->bytes = 2; - curr->type = Type::i32; - curr->signed_ = true; - break; - case BinaryConsts::I32LoadMem16U: - allocate(); - curr->bytes = 2; - curr->type = Type::i32; - break; - case BinaryConsts::I32LoadMem: - allocate(); - curr->bytes = 4; - curr->type = Type::i32; - break; - case BinaryConsts::I64LoadMem8S: - allocate(); - curr->bytes = 1; - curr->type = Type::i64; - curr->signed_ = true; - break; - case BinaryConsts::I64LoadMem8U: - allocate(); - curr->bytes = 1; - curr->type = Type::i64; - break; - case BinaryConsts::I64LoadMem16S: - allocate(); - curr->bytes = 2; - curr->type = Type::i64; - curr->signed_ = true; - break; - case BinaryConsts::I64LoadMem16U: - allocate(); - curr->bytes = 2; - curr->type = Type::i64; - break; - case BinaryConsts::I64LoadMem32S: - allocate(); - curr->bytes = 4; - curr->type = Type::i64; - curr->signed_ = true; - break; - case BinaryConsts::I64LoadMem32U: - allocate(); - curr->bytes = 4; - curr->type = Type::i64; - break; - case BinaryConsts::I64LoadMem: - allocate(); - curr->bytes = 8; - curr->type = Type::i64; - break; - case BinaryConsts::F32LoadMem: - allocate(); - curr->bytes = 4; - curr->type = Type::f32; - break; - case BinaryConsts::F64LoadMem: - allocate(); - curr->bytes = 8; - curr->type = Type::f64; - break; - default: - return false; - } - } else if (prefix == BinaryConsts::AtomicPrefix) { - switch (code) { - case BinaryConsts::I32AtomicLoad8U: - allocate(); - curr->bytes = 1; - curr->type = Type::i32; - break; - case BinaryConsts::I32AtomicLoad16U: - allocate(); - curr->bytes = 2; - curr->type = Type::i32; - break; - case BinaryConsts::I32AtomicLoad: - allocate(); - curr->bytes = 4; - curr->type = Type::i32; - break; - case BinaryConsts::I64AtomicLoad8U: - allocate(); - curr->bytes = 1; - curr->type = Type::i64; - break; - case BinaryConsts::I64AtomicLoad16U: - allocate(); - curr->bytes = 2; - curr->type = Type::i64; - break; - case BinaryConsts::I64AtomicLoad32U: - allocate(); - curr->bytes = 4; - curr->type = Type::i64; - break; - case BinaryConsts::I64AtomicLoad: - allocate(); - curr->bytes = 8; - curr->type = Type::i64; - break; - default: - return false; - } - } else if (prefix == BinaryConsts::MiscPrefix) { - switch (code) { - case BinaryConsts::F32_F16LoadMem: - allocate(); - curr->bytes = 2; - curr->type = Type::f32; - break; - default: - return false; - } - } else { - return false; - } - - curr->isAtomic = prefix == BinaryConsts::AtomicPrefix; - Index memIdx = readMemoryAccess(curr->align, curr->offset); - curr->memory = getMemoryName(memIdx); - curr->ptr = popNonVoidExpression(); - curr->finalize(); - out = curr; - return true; -} - -bool WasmBinaryReader::maybeVisitStore( - Expression*& out, - uint8_t code, - std::optional prefix) { - Store* curr; - if (!prefix) { - switch (code) { - case BinaryConsts::I32StoreMem8: - curr = allocator.alloc(); - curr->bytes = 1; - curr->valueType = Type::i32; - break; - case BinaryConsts::I32StoreMem16: - curr = allocator.alloc(); - curr->bytes = 2; - curr->valueType = Type::i32; - break; - case BinaryConsts::I32StoreMem: - curr = allocator.alloc(); - curr->bytes = 4; - curr->valueType = Type::i32; - break; - case BinaryConsts::I64StoreMem8: - curr = allocator.alloc(); - curr->bytes = 1; - curr->valueType = Type::i64; - break; - case BinaryConsts::I64StoreMem16: - curr = allocator.alloc(); - curr->bytes = 2; - curr->valueType = Type::i64; - break; - case BinaryConsts::I64StoreMem32: - curr = allocator.alloc(); - curr->bytes = 4; - curr->valueType = Type::i64; - break; - case BinaryConsts::I64StoreMem: - curr = allocator.alloc(); - curr->bytes = 8; - curr->valueType = Type::i64; - break; - case BinaryConsts::F32StoreMem: - curr = allocator.alloc(); - curr->bytes = 4; - curr->valueType = Type::f32; - break; - case BinaryConsts::F64StoreMem: - curr = allocator.alloc(); - curr->bytes = 8; - curr->valueType = Type::f64; - break; - default: - return false; - } - } else if (prefix == BinaryConsts::AtomicPrefix) { - switch (code) { - case BinaryConsts::I32AtomicStore8: - curr = allocator.alloc(); - curr->bytes = 1; - curr->valueType = Type::i32; - break; - case BinaryConsts::I32AtomicStore16: - curr = allocator.alloc(); - curr->bytes = 2; - curr->valueType = Type::i32; - break; - case BinaryConsts::I32AtomicStore: - curr = allocator.alloc(); - curr->bytes = 4; - curr->valueType = Type::i32; - break; - case BinaryConsts::I64AtomicStore8: - curr = allocator.alloc(); - curr->bytes = 1; - curr->valueType = Type::i64; - break; - case BinaryConsts::I64AtomicStore16: - curr = allocator.alloc(); - curr->bytes = 2; - curr->valueType = Type::i64; - break; - case BinaryConsts::I64AtomicStore32: - curr = allocator.alloc(); - curr->bytes = 4; - curr->valueType = Type::i64; - break; - case BinaryConsts::I64AtomicStore: - curr = allocator.alloc(); - curr->bytes = 8; - curr->valueType = Type::i64; - break; - default: - return false; - } - } else if (prefix == BinaryConsts::MiscPrefix) { - switch (code) { - case BinaryConsts::F32_F16StoreMem: - curr = allocator.alloc(); - curr->bytes = 2; - curr->valueType = Type::f32; - break; - default: - return false; - } - } else { - return false; - } - - curr->isAtomic = prefix == BinaryConsts::AtomicPrefix; - Index memIdx = readMemoryAccess(curr->align, curr->offset); - curr->memory = getMemoryName(memIdx); - curr->value = popNonVoidExpression(); - curr->ptr = popNonVoidExpression(); - curr->finalize(); - out = curr; - return true; -} - -bool WasmBinaryReader::maybeVisitAtomicRMW(Expression*& out, uint8_t code) { - if (code < BinaryConsts::AtomicRMWOps_Begin || - code > BinaryConsts::AtomicRMWOps_End) { - return false; - } - auto* curr = allocator.alloc(); - - // Set curr to the given opcode, type and size. -#define SET(opcode, optype, size) \ - curr->op = RMW##opcode; \ - curr->type = optype; \ - curr->bytes = size - - // Handle the cases for all the valid types for a particular opcode -#define SET_FOR_OP(Op) \ - case BinaryConsts::I32AtomicRMW##Op: \ - SET(Op, Type::i32, 4); \ - break; \ - case BinaryConsts::I32AtomicRMW##Op##8U: \ - SET(Op, Type::i32, 1); \ - break; \ - case BinaryConsts::I32AtomicRMW##Op##16U: \ - SET(Op, Type::i32, 2); \ - break; \ - case BinaryConsts::I64AtomicRMW##Op: \ - SET(Op, Type::i64, 8); \ - break; \ - case BinaryConsts::I64AtomicRMW##Op##8U: \ - SET(Op, Type::i64, 1); \ - break; \ - case BinaryConsts::I64AtomicRMW##Op##16U: \ - SET(Op, Type::i64, 2); \ - break; \ - case BinaryConsts::I64AtomicRMW##Op##32U: \ - SET(Op, Type::i64, 4); \ - break; - - switch (code) { - SET_FOR_OP(Add); - SET_FOR_OP(Sub); - SET_FOR_OP(And); - SET_FOR_OP(Or); - SET_FOR_OP(Xor); - SET_FOR_OP(Xchg); - default: - WASM_UNREACHABLE("unexpected opcode"); - } -#undef SET_FOR_OP -#undef SET - - Address readAlign; - Index memIdx = readMemoryAccess(readAlign, curr->offset); - curr->memory = getMemoryName(memIdx); - if (readAlign != curr->bytes) { - throwError("Align of AtomicRMW must match size"); - } - curr->value = popNonVoidExpression(); - curr->ptr = popNonVoidExpression(); - curr->finalize(); - out = curr; - return true; -} - -bool WasmBinaryReader::maybeVisitAtomicCmpxchg(Expression*& out, uint8_t code) { - if (code < BinaryConsts::AtomicCmpxchgOps_Begin || - code > BinaryConsts::AtomicCmpxchgOps_End) { - return false; - } - auto* curr = allocator.alloc(); - - // Set curr to the given type and size. -#define SET(optype, size) \ - curr->type = optype; \ - curr->bytes = size - - switch (code) { - case BinaryConsts::I32AtomicCmpxchg: - SET(Type::i32, 4); - break; - case BinaryConsts::I64AtomicCmpxchg: - SET(Type::i64, 8); - break; - case BinaryConsts::I32AtomicCmpxchg8U: - SET(Type::i32, 1); - break; - case BinaryConsts::I32AtomicCmpxchg16U: - SET(Type::i32, 2); - break; - case BinaryConsts::I64AtomicCmpxchg8U: - SET(Type::i64, 1); - break; - case BinaryConsts::I64AtomicCmpxchg16U: - SET(Type::i64, 2); - break; - case BinaryConsts::I64AtomicCmpxchg32U: - SET(Type::i64, 4); - break; - default: - WASM_UNREACHABLE("unexpected opcode"); - } - - Address readAlign; - Index memIdx = readMemoryAccess(readAlign, curr->offset); - curr->memory = getMemoryName(memIdx); - if (readAlign != curr->bytes) { - throwError("Align of AtomicCpxchg must match size"); - } - curr->replacement = popNonVoidExpression(); - curr->expected = popNonVoidExpression(); - curr->ptr = popNonVoidExpression(); - curr->finalize(); - out = curr; - return true; -} - -bool WasmBinaryReader::maybeVisitAtomicWait(Expression*& out, uint8_t code) { - if (code < BinaryConsts::I32AtomicWait || - code > BinaryConsts::I64AtomicWait) { - return false; - } - auto* curr = allocator.alloc(); - - switch (code) { - case BinaryConsts::I32AtomicWait: - curr->expectedType = Type::i32; - break; - case BinaryConsts::I64AtomicWait: - curr->expectedType = Type::i64; - break; - default: - WASM_UNREACHABLE("unexpected opcode"); - } - curr->type = Type::i32; - curr->timeout = popNonVoidExpression(); - curr->expected = popNonVoidExpression(); - curr->ptr = popNonVoidExpression(); - Address readAlign; - Index memIdx = readMemoryAccess(readAlign, curr->offset); - curr->memory = getMemoryName(memIdx); - if (readAlign != curr->expectedType.getByteSize()) { - throwError("Align of AtomicWait must match size"); - } - curr->finalize(); - out = curr; - return true; -} - -bool WasmBinaryReader::maybeVisitAtomicNotify(Expression*& out, uint8_t code) { - if (code != BinaryConsts::AtomicNotify) { - return false; - } - auto* curr = allocator.alloc(); - - curr->type = Type::i32; - curr->notifyCount = popNonVoidExpression(); - curr->ptr = popNonVoidExpression(); - Address readAlign; - Index memIdx = readMemoryAccess(readAlign, curr->offset); - curr->memory = getMemoryName(memIdx); - if (readAlign != curr->type.getByteSize()) { - throwError("Align of AtomicNotify must match size"); - } - curr->finalize(); - out = curr; - return true; -} - -bool WasmBinaryReader::maybeVisitAtomicFence(Expression*& out, uint8_t code) { - if (code != BinaryConsts::AtomicFence) { - return false; - } - auto* curr = allocator.alloc(); - curr->order = getU32LEB(); - curr->finalize(); - out = curr; - return true; -} - -bool WasmBinaryReader::maybeVisitConst(Expression*& out, uint8_t code) { - Const* curr; - switch (code) { - case BinaryConsts::I32Const: - curr = allocator.alloc(); - curr->value = Literal(getS32LEB()); - break; - case BinaryConsts::I64Const: - curr = allocator.alloc(); - curr->value = Literal(getS64LEB()); - break; - case BinaryConsts::F32Const: - curr = allocator.alloc(); - curr->value = getFloat32Literal(); - break; - case BinaryConsts::F64Const: - curr = allocator.alloc(); - curr->value = getFloat64Literal(); - break; - default: - return false; - } - curr->type = curr->value.type; - out = curr; - - return true; -} - -bool WasmBinaryReader::maybeVisitUnary(Expression*& out, uint8_t code) { - Unary* curr; - switch (code) { - case BinaryConsts::I32Clz: - curr = allocator.alloc(); - curr->op = ClzInt32; - break; - case BinaryConsts::I64Clz: - curr = allocator.alloc(); - curr->op = ClzInt64; - break; - case BinaryConsts::I32Ctz: - curr = allocator.alloc(); - curr->op = CtzInt32; - break; - case BinaryConsts::I64Ctz: - curr = allocator.alloc(); - curr->op = CtzInt64; - break; - case BinaryConsts::I32Popcnt: - curr = allocator.alloc(); - curr->op = PopcntInt32; - break; - case BinaryConsts::I64Popcnt: - curr = allocator.alloc(); - curr->op = PopcntInt64; - break; - case BinaryConsts::I32EqZ: - curr = allocator.alloc(); - curr->op = EqZInt32; - break; - case BinaryConsts::I64EqZ: - curr = allocator.alloc(); - curr->op = EqZInt64; - break; - case BinaryConsts::F32Neg: - curr = allocator.alloc(); - curr->op = NegFloat32; - break; - case BinaryConsts::F64Neg: - curr = allocator.alloc(); - curr->op = NegFloat64; - break; - case BinaryConsts::F32Abs: - curr = allocator.alloc(); - curr->op = AbsFloat32; - break; - case BinaryConsts::F64Abs: - curr = allocator.alloc(); - curr->op = AbsFloat64; - break; - case BinaryConsts::F32Ceil: - curr = allocator.alloc(); - curr->op = CeilFloat32; - break; - case BinaryConsts::F64Ceil: - curr = allocator.alloc(); - curr->op = CeilFloat64; - break; - case BinaryConsts::F32Floor: - curr = allocator.alloc(); - curr->op = FloorFloat32; - break; - case BinaryConsts::F64Floor: - curr = allocator.alloc(); - curr->op = FloorFloat64; - break; - case BinaryConsts::F32NearestInt: - curr = allocator.alloc(); - curr->op = NearestFloat32; - break; - case BinaryConsts::F64NearestInt: - curr = allocator.alloc(); - curr->op = NearestFloat64; - break; - case BinaryConsts::F32Sqrt: - curr = allocator.alloc(); - curr->op = SqrtFloat32; - break; - case BinaryConsts::F64Sqrt: - curr = allocator.alloc(); - curr->op = SqrtFloat64; - break; - case BinaryConsts::F32UConvertI32: - curr = allocator.alloc(); - curr->op = ConvertUInt32ToFloat32; - break; - case BinaryConsts::F64UConvertI32: - curr = allocator.alloc(); - curr->op = ConvertUInt32ToFloat64; - break; - case BinaryConsts::F32SConvertI32: - curr = allocator.alloc(); - curr->op = ConvertSInt32ToFloat32; - break; - case BinaryConsts::F64SConvertI32: - curr = allocator.alloc(); - curr->op = ConvertSInt32ToFloat64; - break; - case BinaryConsts::F32UConvertI64: - curr = allocator.alloc(); - curr->op = ConvertUInt64ToFloat32; - break; - case BinaryConsts::F64UConvertI64: - curr = allocator.alloc(); - curr->op = ConvertUInt64ToFloat64; - break; - case BinaryConsts::F32SConvertI64: - curr = allocator.alloc(); - curr->op = ConvertSInt64ToFloat32; - break; - case BinaryConsts::F64SConvertI64: - curr = allocator.alloc(); - curr->op = ConvertSInt64ToFloat64; - break; - - case BinaryConsts::I64SExtendI32: - curr = allocator.alloc(); - curr->op = ExtendSInt32; - break; - case BinaryConsts::I64UExtendI32: - curr = allocator.alloc(); - curr->op = ExtendUInt32; - break; - case BinaryConsts::I32WrapI64: - curr = allocator.alloc(); - curr->op = WrapInt64; - break; - - case BinaryConsts::I32UTruncF32: - curr = allocator.alloc(); - curr->op = TruncUFloat32ToInt32; - break; - case BinaryConsts::I32UTruncF64: - curr = allocator.alloc(); - curr->op = TruncUFloat64ToInt32; - break; - case BinaryConsts::I32STruncF32: - curr = allocator.alloc(); - curr->op = TruncSFloat32ToInt32; - break; - case BinaryConsts::I32STruncF64: - curr = allocator.alloc(); - curr->op = TruncSFloat64ToInt32; - break; - case BinaryConsts::I64UTruncF32: - curr = allocator.alloc(); - curr->op = TruncUFloat32ToInt64; - break; - case BinaryConsts::I64UTruncF64: - curr = allocator.alloc(); - curr->op = TruncUFloat64ToInt64; - break; - case BinaryConsts::I64STruncF32: - curr = allocator.alloc(); - curr->op = TruncSFloat32ToInt64; - break; - case BinaryConsts::I64STruncF64: - curr = allocator.alloc(); - curr->op = TruncSFloat64ToInt64; - break; - - case BinaryConsts::F32Trunc: - curr = allocator.alloc(); - curr->op = TruncFloat32; - break; - case BinaryConsts::F64Trunc: - curr = allocator.alloc(); - curr->op = TruncFloat64; - break; - - case BinaryConsts::F32DemoteI64: - curr = allocator.alloc(); - curr->op = DemoteFloat64; - break; - case BinaryConsts::F64PromoteF32: - curr = allocator.alloc(); - curr->op = PromoteFloat32; - break; - case BinaryConsts::I32ReinterpretF32: - curr = allocator.alloc(); - curr->op = ReinterpretFloat32; - break; - case BinaryConsts::I64ReinterpretF64: - curr = allocator.alloc(); - curr->op = ReinterpretFloat64; - break; - case BinaryConsts::F32ReinterpretI32: - curr = allocator.alloc(); - curr->op = ReinterpretInt32; - break; - case BinaryConsts::F64ReinterpretI64: - curr = allocator.alloc(); - curr->op = ReinterpretInt64; - break; - - case BinaryConsts::I32ExtendS8: - curr = allocator.alloc(); - curr->op = ExtendS8Int32; - break; - case BinaryConsts::I32ExtendS16: - curr = allocator.alloc(); - curr->op = ExtendS16Int32; - break; - case BinaryConsts::I64ExtendS8: - curr = allocator.alloc(); - curr->op = ExtendS8Int64; - break; - case BinaryConsts::I64ExtendS16: - curr = allocator.alloc(); - curr->op = ExtendS16Int64; - break; - case BinaryConsts::I64ExtendS32: - curr = allocator.alloc(); - curr->op = ExtendS32Int64; - break; - - default: - return false; - } - curr->value = popNonVoidExpression(); - curr->finalize(); - out = curr; - return true; -} - -bool WasmBinaryReader::maybeVisitTruncSat(Expression*& out, uint32_t code) { - Unary* curr; - switch (code) { - case BinaryConsts::I32STruncSatF32: - curr = allocator.alloc(); - curr->op = TruncSatSFloat32ToInt32; - break; - case BinaryConsts::I32UTruncSatF32: - curr = allocator.alloc(); - curr->op = TruncSatUFloat32ToInt32; - break; - case BinaryConsts::I32STruncSatF64: - curr = allocator.alloc(); - curr->op = TruncSatSFloat64ToInt32; - break; - case BinaryConsts::I32UTruncSatF64: - curr = allocator.alloc(); - curr->op = TruncSatUFloat64ToInt32; - break; - case BinaryConsts::I64STruncSatF32: - curr = allocator.alloc(); - curr->op = TruncSatSFloat32ToInt64; - break; - case BinaryConsts::I64UTruncSatF32: - curr = allocator.alloc(); - curr->op = TruncSatUFloat32ToInt64; - break; - case BinaryConsts::I64STruncSatF64: - curr = allocator.alloc(); - curr->op = TruncSatSFloat64ToInt64; - break; - case BinaryConsts::I64UTruncSatF64: - curr = allocator.alloc(); - curr->op = TruncSatUFloat64ToInt64; - break; - default: - return false; - } - curr->value = popNonVoidExpression(); - curr->finalize(); - out = curr; - return true; -} - -bool WasmBinaryReader::maybeVisitMemoryInit(Expression*& out, uint32_t code) { - if (code != BinaryConsts::MemoryInit) { - return false; - } - auto* curr = allocator.alloc(); - curr->size = popNonVoidExpression(); - curr->offset = popNonVoidExpression(); - curr->dest = popNonVoidExpression(); - curr->segment = getDataName(getU32LEB()); - curr->memory = getMemoryName(getU32LEB()); - curr->finalize(); - out = curr; - return true; -} - -bool WasmBinaryReader::maybeVisitDataDrop(Expression*& out, uint32_t code) { - if (code != BinaryConsts::DataDrop) { - return false; - } - auto* curr = allocator.alloc(); - curr->segment = getDataName(getU32LEB()); - curr->finalize(); - out = curr; - return true; -} - -bool WasmBinaryReader::maybeVisitMemoryCopy(Expression*& out, uint32_t code) { - if (code != BinaryConsts::MemoryCopy) { - return false; - } - auto* curr = allocator.alloc(); - curr->size = popNonVoidExpression(); - curr->source = popNonVoidExpression(); - curr->dest = popNonVoidExpression(); - curr->destMemory = getMemoryName(getU32LEB()); - curr->sourceMemory = getMemoryName(getU32LEB()); - curr->finalize(); - out = curr; - return true; -} - -bool WasmBinaryReader::maybeVisitMemoryFill(Expression*& out, uint32_t code) { - if (code != BinaryConsts::MemoryFill) { - return false; - } - auto* curr = allocator.alloc(); - curr->size = popNonVoidExpression(); - curr->value = popNonVoidExpression(); - curr->dest = popNonVoidExpression(); - curr->memory = getMemoryName(getU32LEB()); - curr->finalize(); - out = curr; - return true; -} - -bool WasmBinaryReader::maybeVisitTableSize(Expression*& out, uint32_t code) { - if (code != BinaryConsts::TableSize) { - return false; - } - auto* curr = allocator.alloc(); - Index tableIdx = getU32LEB(); - curr->table = getTableName(tableIdx); - if (getTable(tableIdx)->is64()) { - curr->type = Type::i64; - } - curr->finalize(); - out = curr; - return true; -} - -bool WasmBinaryReader::maybeVisitTableGrow(Expression*& out, uint32_t code) { - if (code != BinaryConsts::TableGrow) { - return false; - } - auto* curr = allocator.alloc(); - Index tableIdx = getU32LEB(); - curr->table = getTableName(tableIdx); - curr->delta = popNonVoidExpression(); - curr->value = popNonVoidExpression(); - if (getTable(tableIdx)->is64()) { - curr->type = Type::i64; - } - curr->finalize(); - out = curr; - return true; -} - -bool WasmBinaryReader::maybeVisitTableFill(Expression*& out, uint32_t code) { - if (code != BinaryConsts::TableFill) { - return false; - } - auto table = getTableName(getU32LEB()); - auto* size = popNonVoidExpression(); - auto* value = popNonVoidExpression(); - auto* dest = popNonVoidExpression(); - out = Builder(wasm).makeTableFill(table, dest, value, size); - return true; -} - -bool WasmBinaryReader::maybeVisitTableCopy(Expression*& out, uint32_t code) { - if (code != BinaryConsts::TableCopy) { - return false; - } - auto destTable = getTableName(getU32LEB()); - auto srcTable = getTableName(getU32LEB()); - auto* size = popNonVoidExpression(); - auto* source = popNonVoidExpression(); - auto* dest = popNonVoidExpression(); - out = Builder(wasm).makeTableCopy(dest, source, size, destTable, srcTable); - return true; -} - -bool WasmBinaryReader::maybeVisitTableInit(Expression*& out, uint32_t code) { - if (code != BinaryConsts::TableInit) { - return false; - } - auto* curr = allocator.alloc(); - curr->size = popNonVoidExpression(); - curr->offset = popNonVoidExpression(); - curr->dest = popNonVoidExpression(); - curr->segment = getElemName(getU32LEB()); - curr->table = getTableName(getU32LEB()); - curr->finalize(); - out = curr; - return true; -} - -bool WasmBinaryReader::maybeVisitBinary(Expression*& out, uint8_t code) { - Binary* curr; -#define INT_TYPED_CODE(code) \ - { \ - case BinaryConsts::I32##code: \ - curr = allocator.alloc(); \ - curr->op = code##Int32; \ - break; \ - case BinaryConsts::I64##code: \ - curr = allocator.alloc(); \ - curr->op = code##Int64; \ - break; \ - } -#define FLOAT_TYPED_CODE(code) \ - { \ - case BinaryConsts::F32##code: \ - curr = allocator.alloc(); \ - curr->op = code##Float32; \ - break; \ - case BinaryConsts::F64##code: \ - curr = allocator.alloc(); \ - curr->op = code##Float64; \ - break; \ - } -#define TYPED_CODE(code) \ - { \ - INT_TYPED_CODE(code) \ - FLOAT_TYPED_CODE(code) \ - } - - switch (code) { - TYPED_CODE(Add); - TYPED_CODE(Sub); - TYPED_CODE(Mul); - INT_TYPED_CODE(DivS); - INT_TYPED_CODE(DivU); - INT_TYPED_CODE(RemS); - INT_TYPED_CODE(RemU); - INT_TYPED_CODE(And); - INT_TYPED_CODE(Or); - INT_TYPED_CODE(Xor); - INT_TYPED_CODE(Shl); - INT_TYPED_CODE(ShrU); - INT_TYPED_CODE(ShrS); - INT_TYPED_CODE(RotL); - INT_TYPED_CODE(RotR); - FLOAT_TYPED_CODE(Div); - FLOAT_TYPED_CODE(CopySign); - FLOAT_TYPED_CODE(Min); - FLOAT_TYPED_CODE(Max); - TYPED_CODE(Eq); - TYPED_CODE(Ne); - INT_TYPED_CODE(LtS); - INT_TYPED_CODE(LtU); - INT_TYPED_CODE(LeS); - INT_TYPED_CODE(LeU); - INT_TYPED_CODE(GtS); - INT_TYPED_CODE(GtU); - INT_TYPED_CODE(GeS); - INT_TYPED_CODE(GeU); - FLOAT_TYPED_CODE(Lt); - FLOAT_TYPED_CODE(Le); - FLOAT_TYPED_CODE(Gt); - FLOAT_TYPED_CODE(Ge); - default: - return false; - } - curr->right = popNonVoidExpression(); - curr->left = popNonVoidExpression(); - curr->finalize(); - out = curr; - return true; -#undef TYPED_CODE -#undef INT_TYPED_CODE -#undef FLOAT_TYPED_CODE -} - -bool WasmBinaryReader::maybeVisitSIMDBinary(Expression*& out, uint32_t code) { - Binary* curr; - switch (code) { - case BinaryConsts::I8x16Eq: - curr = allocator.alloc(); - curr->op = EqVecI8x16; - break; - case BinaryConsts::I8x16Ne: - curr = allocator.alloc(); - curr->op = NeVecI8x16; - break; - case BinaryConsts::I8x16LtS: - curr = allocator.alloc(); - curr->op = LtSVecI8x16; - break; - case BinaryConsts::I8x16LtU: - curr = allocator.alloc(); - curr->op = LtUVecI8x16; - break; - case BinaryConsts::I8x16GtS: - curr = allocator.alloc(); - curr->op = GtSVecI8x16; - break; - case BinaryConsts::I8x16GtU: - curr = allocator.alloc(); - curr->op = GtUVecI8x16; - break; - case BinaryConsts::I8x16LeS: - curr = allocator.alloc(); - curr->op = LeSVecI8x16; - break; - case BinaryConsts::I8x16LeU: - curr = allocator.alloc(); - curr->op = LeUVecI8x16; - break; - case BinaryConsts::I8x16GeS: - curr = allocator.alloc(); - curr->op = GeSVecI8x16; - break; - case BinaryConsts::I8x16GeU: - curr = allocator.alloc(); - curr->op = GeUVecI8x16; - break; - case BinaryConsts::I16x8Eq: - curr = allocator.alloc(); - curr->op = EqVecI16x8; - break; - case BinaryConsts::I16x8Ne: - curr = allocator.alloc(); - curr->op = NeVecI16x8; - break; - case BinaryConsts::I16x8LtS: - curr = allocator.alloc(); - curr->op = LtSVecI16x8; - break; - case BinaryConsts::I16x8LtU: - curr = allocator.alloc(); - curr->op = LtUVecI16x8; - break; - case BinaryConsts::I16x8GtS: - curr = allocator.alloc(); - curr->op = GtSVecI16x8; - break; - case BinaryConsts::I16x8GtU: - curr = allocator.alloc(); - curr->op = GtUVecI16x8; - break; - case BinaryConsts::I16x8LeS: - curr = allocator.alloc(); - curr->op = LeSVecI16x8; - break; - case BinaryConsts::I16x8LeU: - curr = allocator.alloc(); - curr->op = LeUVecI16x8; - break; - case BinaryConsts::I16x8GeS: - curr = allocator.alloc(); - curr->op = GeSVecI16x8; - break; - case BinaryConsts::I16x8GeU: - curr = allocator.alloc(); - curr->op = GeUVecI16x8; - break; - case BinaryConsts::I32x4Eq: - curr = allocator.alloc(); - curr->op = EqVecI32x4; - break; - case BinaryConsts::I32x4Ne: - curr = allocator.alloc(); - curr->op = NeVecI32x4; - break; - case BinaryConsts::I32x4LtS: - curr = allocator.alloc(); - curr->op = LtSVecI32x4; - break; - case BinaryConsts::I32x4LtU: - curr = allocator.alloc(); - curr->op = LtUVecI32x4; - break; - case BinaryConsts::I32x4GtS: - curr = allocator.alloc(); - curr->op = GtSVecI32x4; - break; - case BinaryConsts::I32x4GtU: - curr = allocator.alloc(); - curr->op = GtUVecI32x4; - break; - case BinaryConsts::I32x4LeS: - curr = allocator.alloc(); - curr->op = LeSVecI32x4; - break; - case BinaryConsts::I32x4LeU: - curr = allocator.alloc(); - curr->op = LeUVecI32x4; - break; - case BinaryConsts::I32x4GeS: - curr = allocator.alloc(); - curr->op = GeSVecI32x4; - break; - case BinaryConsts::I32x4GeU: - curr = allocator.alloc(); - curr->op = GeUVecI32x4; - break; - case BinaryConsts::I64x2Eq: - curr = allocator.alloc(); - curr->op = EqVecI64x2; - break; - case BinaryConsts::I64x2Ne: - curr = allocator.alloc(); - curr->op = NeVecI64x2; - break; - case BinaryConsts::I64x2LtS: - curr = allocator.alloc(); - curr->op = LtSVecI64x2; - break; - case BinaryConsts::I64x2GtS: - curr = allocator.alloc(); - curr->op = GtSVecI64x2; - break; - case BinaryConsts::I64x2LeS: - curr = allocator.alloc(); - curr->op = LeSVecI64x2; - break; - case BinaryConsts::I64x2GeS: - curr = allocator.alloc(); - curr->op = GeSVecI64x2; - break; - case BinaryConsts::F16x8Eq: - curr = allocator.alloc(); - curr->op = EqVecF16x8; - break; - case BinaryConsts::F16x8Ne: - curr = allocator.alloc(); - curr->op = NeVecF16x8; - break; - case BinaryConsts::F16x8Lt: - curr = allocator.alloc(); - curr->op = LtVecF16x8; - break; - case BinaryConsts::F16x8Gt: - curr = allocator.alloc(); - curr->op = GtVecF16x8; - break; - case BinaryConsts::F16x8Le: - curr = allocator.alloc(); - curr->op = LeVecF16x8; - break; - case BinaryConsts::F16x8Ge: - curr = allocator.alloc(); - curr->op = GeVecF16x8; - break; - case BinaryConsts::F32x4Eq: - curr = allocator.alloc(); - curr->op = EqVecF32x4; - break; - case BinaryConsts::F32x4Ne: - curr = allocator.alloc(); - curr->op = NeVecF32x4; - break; - case BinaryConsts::F32x4Lt: - curr = allocator.alloc(); - curr->op = LtVecF32x4; - break; - case BinaryConsts::F32x4Gt: - curr = allocator.alloc(); - curr->op = GtVecF32x4; - break; - case BinaryConsts::F32x4Le: - curr = allocator.alloc(); - curr->op = LeVecF32x4; - break; - case BinaryConsts::F32x4Ge: - curr = allocator.alloc(); - curr->op = GeVecF32x4; - break; - case BinaryConsts::F64x2Eq: - curr = allocator.alloc(); - curr->op = EqVecF64x2; - break; - case BinaryConsts::F64x2Ne: - curr = allocator.alloc(); - curr->op = NeVecF64x2; - break; - case BinaryConsts::F64x2Lt: - curr = allocator.alloc(); - curr->op = LtVecF64x2; - break; - case BinaryConsts::F64x2Gt: - curr = allocator.alloc(); - curr->op = GtVecF64x2; - break; - case BinaryConsts::F64x2Le: - curr = allocator.alloc(); - curr->op = LeVecF64x2; - break; - case BinaryConsts::F64x2Ge: - curr = allocator.alloc(); - curr->op = GeVecF64x2; - break; - case BinaryConsts::V128And: - curr = allocator.alloc(); - curr->op = AndVec128; - break; - case BinaryConsts::V128Or: - curr = allocator.alloc(); - curr->op = OrVec128; - break; - case BinaryConsts::V128Xor: - curr = allocator.alloc(); - curr->op = XorVec128; - break; - case BinaryConsts::V128Andnot: - curr = allocator.alloc(); - curr->op = AndNotVec128; - break; - case BinaryConsts::I8x16Add: - curr = allocator.alloc(); - curr->op = AddVecI8x16; - break; - case BinaryConsts::I8x16AddSatS: - curr = allocator.alloc(); - curr->op = AddSatSVecI8x16; - break; - case BinaryConsts::I8x16AddSatU: - curr = allocator.alloc(); - curr->op = AddSatUVecI8x16; - break; - case BinaryConsts::I8x16Sub: - curr = allocator.alloc(); - curr->op = SubVecI8x16; - break; - case BinaryConsts::I8x16SubSatS: - curr = allocator.alloc(); - curr->op = SubSatSVecI8x16; - break; - case BinaryConsts::I8x16SubSatU: - curr = allocator.alloc(); - curr->op = SubSatUVecI8x16; - break; - case BinaryConsts::I8x16MinS: - curr = allocator.alloc(); - curr->op = MinSVecI8x16; - break; - case BinaryConsts::I8x16MinU: - curr = allocator.alloc(); - curr->op = MinUVecI8x16; - break; - case BinaryConsts::I8x16MaxS: - curr = allocator.alloc(); - curr->op = MaxSVecI8x16; - break; - case BinaryConsts::I8x16MaxU: - curr = allocator.alloc(); - curr->op = MaxUVecI8x16; - break; - case BinaryConsts::I8x16AvgrU: - curr = allocator.alloc(); - curr->op = AvgrUVecI8x16; - break; - case BinaryConsts::I16x8Add: - curr = allocator.alloc(); - curr->op = AddVecI16x8; - break; - case BinaryConsts::I16x8AddSatS: - curr = allocator.alloc(); - curr->op = AddSatSVecI16x8; - break; - case BinaryConsts::I16x8AddSatU: - curr = allocator.alloc(); - curr->op = AddSatUVecI16x8; - break; - case BinaryConsts::I16x8Sub: - curr = allocator.alloc(); - curr->op = SubVecI16x8; - break; - case BinaryConsts::I16x8SubSatS: - curr = allocator.alloc(); - curr->op = SubSatSVecI16x8; - break; - case BinaryConsts::I16x8SubSatU: - curr = allocator.alloc(); - curr->op = SubSatUVecI16x8; - break; - case BinaryConsts::I16x8Mul: - curr = allocator.alloc(); - curr->op = MulVecI16x8; - break; - case BinaryConsts::I16x8MinS: - curr = allocator.alloc(); - curr->op = MinSVecI16x8; - break; - case BinaryConsts::I16x8MinU: - curr = allocator.alloc(); - curr->op = MinUVecI16x8; - break; - case BinaryConsts::I16x8MaxS: - curr = allocator.alloc(); - curr->op = MaxSVecI16x8; - break; - case BinaryConsts::I16x8MaxU: - curr = allocator.alloc(); - curr->op = MaxUVecI16x8; - break; - case BinaryConsts::I16x8AvgrU: - curr = allocator.alloc(); - curr->op = AvgrUVecI16x8; - break; - case BinaryConsts::I16x8Q15MulrSatS: - curr = allocator.alloc(); - curr->op = Q15MulrSatSVecI16x8; - break; - case BinaryConsts::I16x8ExtmulLowI8x16S: - curr = allocator.alloc(); - curr->op = ExtMulLowSVecI16x8; - break; - case BinaryConsts::I16x8ExtmulHighI8x16S: - curr = allocator.alloc(); - curr->op = ExtMulHighSVecI16x8; - break; - case BinaryConsts::I16x8ExtmulLowI8x16U: - curr = allocator.alloc(); - curr->op = ExtMulLowUVecI16x8; - break; - case BinaryConsts::I16x8ExtmulHighI8x16U: - curr = allocator.alloc(); - curr->op = ExtMulHighUVecI16x8; - break; - case BinaryConsts::I32x4Add: - curr = allocator.alloc(); - curr->op = AddVecI32x4; - break; - case BinaryConsts::I32x4Sub: - curr = allocator.alloc(); - curr->op = SubVecI32x4; - break; - case BinaryConsts::I32x4Mul: - curr = allocator.alloc(); - curr->op = MulVecI32x4; - break; - case BinaryConsts::I32x4MinS: - curr = allocator.alloc(); - curr->op = MinSVecI32x4; - break; - case BinaryConsts::I32x4MinU: - curr = allocator.alloc(); - curr->op = MinUVecI32x4; - break; - case BinaryConsts::I32x4MaxS: - curr = allocator.alloc(); - curr->op = MaxSVecI32x4; - break; - case BinaryConsts::I32x4MaxU: - curr = allocator.alloc(); - curr->op = MaxUVecI32x4; - break; - case BinaryConsts::I32x4DotI16x8S: - curr = allocator.alloc(); - curr->op = DotSVecI16x8ToVecI32x4; - break; - case BinaryConsts::I32x4ExtmulLowI16x8S: - curr = allocator.alloc(); - curr->op = ExtMulLowSVecI32x4; - break; - case BinaryConsts::I32x4ExtmulHighI16x8S: - curr = allocator.alloc(); - curr->op = ExtMulHighSVecI32x4; - break; - case BinaryConsts::I32x4ExtmulLowI16x8U: - curr = allocator.alloc(); - curr->op = ExtMulLowUVecI32x4; - break; - case BinaryConsts::I32x4ExtmulHighI16x8U: - curr = allocator.alloc(); - curr->op = ExtMulHighUVecI32x4; - break; - case BinaryConsts::I64x2Add: - curr = allocator.alloc(); - curr->op = AddVecI64x2; - break; - case BinaryConsts::I64x2Sub: - curr = allocator.alloc(); - curr->op = SubVecI64x2; - break; - case BinaryConsts::I64x2Mul: - curr = allocator.alloc(); - curr->op = MulVecI64x2; - break; - case BinaryConsts::I64x2ExtmulLowI32x4S: - curr = allocator.alloc(); - curr->op = ExtMulLowSVecI64x2; - break; - case BinaryConsts::I64x2ExtmulHighI32x4S: - curr = allocator.alloc(); - curr->op = ExtMulHighSVecI64x2; - break; - case BinaryConsts::I64x2ExtmulLowI32x4U: - curr = allocator.alloc(); - curr->op = ExtMulLowUVecI64x2; - break; - case BinaryConsts::I64x2ExtmulHighI32x4U: - curr = allocator.alloc(); - curr->op = ExtMulHighUVecI64x2; - break; - case BinaryConsts::F16x8Add: - curr = allocator.alloc(); - curr->op = AddVecF16x8; - break; - case BinaryConsts::F16x8Sub: - curr = allocator.alloc(); - curr->op = SubVecF16x8; - break; - case BinaryConsts::F16x8Mul: - curr = allocator.alloc(); - curr->op = MulVecF16x8; - break; - case BinaryConsts::F16x8Div: - curr = allocator.alloc(); - curr->op = DivVecF16x8; - break; - case BinaryConsts::F16x8Min: - curr = allocator.alloc(); - curr->op = MinVecF16x8; - break; - case BinaryConsts::F16x8Max: - curr = allocator.alloc(); - curr->op = MaxVecF16x8; - break; - case BinaryConsts::F16x8Pmin: - curr = allocator.alloc(); - curr->op = PMinVecF16x8; - break; - case BinaryConsts::F16x8Pmax: - curr = allocator.alloc(); - curr->op = PMaxVecF16x8; - break; - case BinaryConsts::F32x4Add: - curr = allocator.alloc(); - curr->op = AddVecF32x4; - break; - case BinaryConsts::F32x4Sub: - curr = allocator.alloc(); - curr->op = SubVecF32x4; - break; - case BinaryConsts::F32x4Mul: - curr = allocator.alloc(); - curr->op = MulVecF32x4; - break; - case BinaryConsts::F32x4Div: - curr = allocator.alloc(); - curr->op = DivVecF32x4; - break; - case BinaryConsts::F32x4Min: - curr = allocator.alloc(); - curr->op = MinVecF32x4; - break; - case BinaryConsts::F32x4Max: - curr = allocator.alloc(); - curr->op = MaxVecF32x4; - break; - case BinaryConsts::F32x4Pmin: - curr = allocator.alloc(); - curr->op = PMinVecF32x4; - break; - case BinaryConsts::F32x4Pmax: - curr = allocator.alloc(); - curr->op = PMaxVecF32x4; - break; - case BinaryConsts::F64x2Add: - curr = allocator.alloc(); - curr->op = AddVecF64x2; - break; - case BinaryConsts::F64x2Sub: - curr = allocator.alloc(); - curr->op = SubVecF64x2; - break; - case BinaryConsts::F64x2Mul: - curr = allocator.alloc(); - curr->op = MulVecF64x2; - break; - case BinaryConsts::F64x2Div: - curr = allocator.alloc(); - curr->op = DivVecF64x2; - break; - case BinaryConsts::F64x2Min: - curr = allocator.alloc(); - curr->op = MinVecF64x2; - break; - case BinaryConsts::F64x2Max: - curr = allocator.alloc(); - curr->op = MaxVecF64x2; - break; - case BinaryConsts::F64x2Pmin: - curr = allocator.alloc(); - curr->op = PMinVecF64x2; - break; - case BinaryConsts::F64x2Pmax: - curr = allocator.alloc(); - curr->op = PMaxVecF64x2; - break; - case BinaryConsts::I8x16NarrowI16x8S: - curr = allocator.alloc(); - curr->op = NarrowSVecI16x8ToVecI8x16; - break; - case BinaryConsts::I8x16NarrowI16x8U: - curr = allocator.alloc(); - curr->op = NarrowUVecI16x8ToVecI8x16; - break; - case BinaryConsts::I16x8NarrowI32x4S: - curr = allocator.alloc(); - curr->op = NarrowSVecI32x4ToVecI16x8; - break; - case BinaryConsts::I16x8NarrowI32x4U: - curr = allocator.alloc(); - curr->op = NarrowUVecI32x4ToVecI16x8; - break; - case BinaryConsts::I8x16Swizzle: - curr = allocator.alloc(); - curr->op = SwizzleVecI8x16; - break; - case BinaryConsts::I8x16RelaxedSwizzle: - curr = allocator.alloc(); - curr->op = RelaxedSwizzleVecI8x16; - break; - case BinaryConsts::F32x4RelaxedMin: - curr = allocator.alloc(); - curr->op = RelaxedMinVecF32x4; - break; - case BinaryConsts::F32x4RelaxedMax: - curr = allocator.alloc(); - curr->op = RelaxedMaxVecF32x4; - break; - case BinaryConsts::F64x2RelaxedMin: - curr = allocator.alloc(); - curr->op = RelaxedMinVecF64x2; - break; - case BinaryConsts::F64x2RelaxedMax: - curr = allocator.alloc(); - curr->op = RelaxedMaxVecF64x2; - break; - case BinaryConsts::I16x8RelaxedQ15MulrS: - curr = allocator.alloc(); - curr->op = RelaxedQ15MulrSVecI16x8; - break; - case BinaryConsts::I16x8DotI8x16I7x16S: - curr = allocator.alloc(); - curr->op = DotI8x16I7x16SToVecI16x8; - break; - default: - return false; - } - curr->right = popNonVoidExpression(); - curr->left = popNonVoidExpression(); - curr->finalize(); - out = curr; - return true; -} -bool WasmBinaryReader::maybeVisitSIMDUnary(Expression*& out, uint32_t code) { - Unary* curr; - switch (code) { - case BinaryConsts::I8x16Splat: - curr = allocator.alloc(); - curr->op = SplatVecI8x16; - break; - case BinaryConsts::I16x8Splat: - curr = allocator.alloc(); - curr->op = SplatVecI16x8; - break; - case BinaryConsts::I32x4Splat: - curr = allocator.alloc(); - curr->op = SplatVecI32x4; - break; - case BinaryConsts::I64x2Splat: - curr = allocator.alloc(); - curr->op = SplatVecI64x2; - break; - case BinaryConsts::F16x8Splat: - curr = allocator.alloc(); - curr->op = SplatVecF16x8; - break; - case BinaryConsts::F32x4Splat: - curr = allocator.alloc(); - curr->op = SplatVecF32x4; - break; - case BinaryConsts::F64x2Splat: - curr = allocator.alloc(); - curr->op = SplatVecF64x2; - break; - case BinaryConsts::V128Not: - curr = allocator.alloc(); - curr->op = NotVec128; - break; - case BinaryConsts::V128AnyTrue: - curr = allocator.alloc(); - curr->op = AnyTrueVec128; - break; - case BinaryConsts::I8x16Popcnt: - curr = allocator.alloc(); - curr->op = PopcntVecI8x16; - break; - case BinaryConsts::I8x16Abs: - curr = allocator.alloc(); - curr->op = AbsVecI8x16; - break; - case BinaryConsts::I8x16Neg: - curr = allocator.alloc(); - curr->op = NegVecI8x16; - break; - case BinaryConsts::I8x16AllTrue: - curr = allocator.alloc(); - curr->op = AllTrueVecI8x16; - break; - case BinaryConsts::I8x16Bitmask: - curr = allocator.alloc(); - curr->op = BitmaskVecI8x16; - break; - case BinaryConsts::I16x8Abs: - curr = allocator.alloc(); - curr->op = AbsVecI16x8; - break; - case BinaryConsts::I16x8Neg: - curr = allocator.alloc(); - curr->op = NegVecI16x8; - break; - case BinaryConsts::I16x8AllTrue: - curr = allocator.alloc(); - curr->op = AllTrueVecI16x8; - break; - case BinaryConsts::I16x8Bitmask: - curr = allocator.alloc(); - curr->op = BitmaskVecI16x8; - break; - case BinaryConsts::I32x4Abs: - curr = allocator.alloc(); - curr->op = AbsVecI32x4; - break; - case BinaryConsts::I32x4Neg: - curr = allocator.alloc(); - curr->op = NegVecI32x4; - break; - case BinaryConsts::I32x4AllTrue: - curr = allocator.alloc(); - curr->op = AllTrueVecI32x4; - break; - case BinaryConsts::I32x4Bitmask: - curr = allocator.alloc(); - curr->op = BitmaskVecI32x4; - break; - case BinaryConsts::I64x2Abs: - curr = allocator.alloc(); - curr->op = AbsVecI64x2; - break; - case BinaryConsts::I64x2Neg: - curr = allocator.alloc(); - curr->op = NegVecI64x2; - break; - case BinaryConsts::I64x2AllTrue: - curr = allocator.alloc(); - curr->op = AllTrueVecI64x2; - break; - case BinaryConsts::I64x2Bitmask: - curr = allocator.alloc(); - curr->op = BitmaskVecI64x2; - break; - case BinaryConsts::F16x8Abs: - curr = allocator.alloc(); - curr->op = AbsVecF16x8; - break; - case BinaryConsts::F16x8Neg: - curr = allocator.alloc(); - curr->op = NegVecF16x8; - break; - case BinaryConsts::F16x8Sqrt: - curr = allocator.alloc(); - curr->op = SqrtVecF16x8; - break; - case BinaryConsts::F16x8Ceil: - curr = allocator.alloc(); - curr->op = CeilVecF16x8; - break; - case BinaryConsts::F16x8Floor: - curr = allocator.alloc(); - curr->op = FloorVecF16x8; - break; - case BinaryConsts::F16x8Trunc: - curr = allocator.alloc(); - curr->op = TruncVecF16x8; - break; - case BinaryConsts::F16x8Nearest: - curr = allocator.alloc(); - curr->op = NearestVecF16x8; - break; - case BinaryConsts::F32x4Abs: - curr = allocator.alloc(); - curr->op = AbsVecF32x4; - break; - case BinaryConsts::F32x4Neg: - curr = allocator.alloc(); - curr->op = NegVecF32x4; - break; - case BinaryConsts::F32x4Sqrt: - curr = allocator.alloc(); - curr->op = SqrtVecF32x4; - break; - case BinaryConsts::F32x4Ceil: - curr = allocator.alloc(); - curr->op = CeilVecF32x4; - break; - case BinaryConsts::F32x4Floor: - curr = allocator.alloc(); - curr->op = FloorVecF32x4; - break; - case BinaryConsts::F32x4Trunc: - curr = allocator.alloc(); - curr->op = TruncVecF32x4; - break; - case BinaryConsts::F32x4Nearest: - curr = allocator.alloc(); - curr->op = NearestVecF32x4; - break; - case BinaryConsts::F64x2Abs: - curr = allocator.alloc(); - curr->op = AbsVecF64x2; - break; - case BinaryConsts::F64x2Neg: - curr = allocator.alloc(); - curr->op = NegVecF64x2; - break; - case BinaryConsts::F64x2Sqrt: - curr = allocator.alloc(); - curr->op = SqrtVecF64x2; - break; - case BinaryConsts::F64x2Ceil: - curr = allocator.alloc(); - curr->op = CeilVecF64x2; - break; - case BinaryConsts::F64x2Floor: - curr = allocator.alloc(); - curr->op = FloorVecF64x2; - break; - case BinaryConsts::F64x2Trunc: - curr = allocator.alloc(); - curr->op = TruncVecF64x2; - break; - case BinaryConsts::F64x2Nearest: - curr = allocator.alloc(); - curr->op = NearestVecF64x2; - break; - case BinaryConsts::I16x8ExtaddPairwiseI8x16S: - curr = allocator.alloc(); - curr->op = ExtAddPairwiseSVecI8x16ToI16x8; - break; - case BinaryConsts::I16x8ExtaddPairwiseI8x16U: - curr = allocator.alloc(); - curr->op = ExtAddPairwiseUVecI8x16ToI16x8; - break; - case BinaryConsts::I32x4ExtaddPairwiseI16x8S: - curr = allocator.alloc(); - curr->op = ExtAddPairwiseSVecI16x8ToI32x4; - break; - case BinaryConsts::I32x4ExtaddPairwiseI16x8U: - curr = allocator.alloc(); - curr->op = ExtAddPairwiseUVecI16x8ToI32x4; - break; - case BinaryConsts::I32x4TruncSatF32x4S: - curr = allocator.alloc(); - curr->op = TruncSatSVecF32x4ToVecI32x4; - break; - case BinaryConsts::I32x4TruncSatF32x4U: - curr = allocator.alloc(); - curr->op = TruncSatUVecF32x4ToVecI32x4; - break; - case BinaryConsts::F32x4ConvertI32x4S: - curr = allocator.alloc(); - curr->op = ConvertSVecI32x4ToVecF32x4; - break; - case BinaryConsts::F32x4ConvertI32x4U: - curr = allocator.alloc(); - curr->op = ConvertUVecI32x4ToVecF32x4; - break; - case BinaryConsts::I16x8ExtendLowI8x16S: - curr = allocator.alloc(); - curr->op = ExtendLowSVecI8x16ToVecI16x8; - break; - case BinaryConsts::I16x8ExtendHighI8x16S: - curr = allocator.alloc(); - curr->op = ExtendHighSVecI8x16ToVecI16x8; - break; - case BinaryConsts::I16x8ExtendLowI8x16U: - curr = allocator.alloc(); - curr->op = ExtendLowUVecI8x16ToVecI16x8; - break; - case BinaryConsts::I16x8ExtendHighI8x16U: - curr = allocator.alloc(); - curr->op = ExtendHighUVecI8x16ToVecI16x8; - break; - case BinaryConsts::I32x4ExtendLowI16x8S: - curr = allocator.alloc(); - curr->op = ExtendLowSVecI16x8ToVecI32x4; - break; - case BinaryConsts::I32x4ExtendHighI16x8S: - curr = allocator.alloc(); - curr->op = ExtendHighSVecI16x8ToVecI32x4; - break; - case BinaryConsts::I32x4ExtendLowI16x8U: - curr = allocator.alloc(); - curr->op = ExtendLowUVecI16x8ToVecI32x4; - break; - case BinaryConsts::I32x4ExtendHighI16x8U: - curr = allocator.alloc(); - curr->op = ExtendHighUVecI16x8ToVecI32x4; - break; - case BinaryConsts::I64x2ExtendLowI32x4S: - curr = allocator.alloc(); - curr->op = ExtendLowSVecI32x4ToVecI64x2; - break; - case BinaryConsts::I64x2ExtendHighI32x4S: - curr = allocator.alloc(); - curr->op = ExtendHighSVecI32x4ToVecI64x2; - break; - case BinaryConsts::I64x2ExtendLowI32x4U: - curr = allocator.alloc(); - curr->op = ExtendLowUVecI32x4ToVecI64x2; - break; - case BinaryConsts::I64x2ExtendHighI32x4U: - curr = allocator.alloc(); - curr->op = ExtendHighUVecI32x4ToVecI64x2; - break; - case BinaryConsts::F64x2ConvertLowI32x4S: - curr = allocator.alloc(); - curr->op = ConvertLowSVecI32x4ToVecF64x2; - break; - case BinaryConsts::F64x2ConvertLowI32x4U: - curr = allocator.alloc(); - curr->op = ConvertLowUVecI32x4ToVecF64x2; - break; - case BinaryConsts::I32x4TruncSatF64x2SZero: - curr = allocator.alloc(); - curr->op = TruncSatZeroSVecF64x2ToVecI32x4; - break; - case BinaryConsts::I32x4TruncSatF64x2UZero: - curr = allocator.alloc(); - curr->op = TruncSatZeroUVecF64x2ToVecI32x4; - break; - case BinaryConsts::F32x4DemoteF64x2Zero: - curr = allocator.alloc(); - curr->op = DemoteZeroVecF64x2ToVecF32x4; - break; - case BinaryConsts::F64x2PromoteLowF32x4: - curr = allocator.alloc(); - curr->op = PromoteLowVecF32x4ToVecF64x2; - break; - case BinaryConsts::I32x4RelaxedTruncF32x4S: - curr = allocator.alloc(); - curr->op = RelaxedTruncSVecF32x4ToVecI32x4; - break; - case BinaryConsts::I32x4RelaxedTruncF32x4U: - curr = allocator.alloc(); - curr->op = RelaxedTruncUVecF32x4ToVecI32x4; - break; - case BinaryConsts::I32x4RelaxedTruncF64x2SZero: - curr = allocator.alloc(); - curr->op = RelaxedTruncZeroSVecF64x2ToVecI32x4; - break; - case BinaryConsts::I32x4RelaxedTruncF64x2UZero: - curr = allocator.alloc(); - curr->op = RelaxedTruncZeroUVecF64x2ToVecI32x4; - break; - default: - return false; - } - curr->value = popNonVoidExpression(); - curr->finalize(); - out = curr; - return true; -} - -bool WasmBinaryReader::maybeVisitSIMDConst(Expression*& out, uint32_t code) { - if (code != BinaryConsts::V128Const) { - return false; - } - auto* curr = allocator.alloc(); - curr->value = getVec128Literal(); - curr->finalize(); - out = curr; - return true; -} - -bool WasmBinaryReader::maybeVisitSIMDStore(Expression*& out, uint32_t code) { - if (code != BinaryConsts::V128Store) { - return false; - } - auto* curr = allocator.alloc(); - curr->bytes = 16; - curr->valueType = Type::v128; - Index memIdx = readMemoryAccess(curr->align, curr->offset); - curr->memory = getMemoryName(memIdx); - curr->isAtomic = false; - curr->value = popNonVoidExpression(); - curr->ptr = popNonVoidExpression(); - curr->finalize(); - out = curr; - return true; -} - -bool WasmBinaryReader::maybeVisitSIMDExtract(Expression*& out, uint32_t code) { - SIMDExtract* curr; - switch (code) { - case BinaryConsts::I8x16ExtractLaneS: - curr = allocator.alloc(); - curr->op = ExtractLaneSVecI8x16; - curr->index = getLaneIndex(16); - break; - case BinaryConsts::I8x16ExtractLaneU: - curr = allocator.alloc(); - curr->op = ExtractLaneUVecI8x16; - curr->index = getLaneIndex(16); - break; - case BinaryConsts::I16x8ExtractLaneS: - curr = allocator.alloc(); - curr->op = ExtractLaneSVecI16x8; - curr->index = getLaneIndex(8); - break; - case BinaryConsts::I16x8ExtractLaneU: - curr = allocator.alloc(); - curr->op = ExtractLaneUVecI16x8; - curr->index = getLaneIndex(8); - break; - case BinaryConsts::I32x4ExtractLane: - curr = allocator.alloc(); - curr->op = ExtractLaneVecI32x4; - curr->index = getLaneIndex(4); - break; - case BinaryConsts::I64x2ExtractLane: - curr = allocator.alloc(); - curr->op = ExtractLaneVecI64x2; - curr->index = getLaneIndex(2); - break; - case BinaryConsts::F16x8ExtractLane: - curr = allocator.alloc(); - curr->op = ExtractLaneVecF16x8; - curr->index = getLaneIndex(8); - break; - case BinaryConsts::F32x4ExtractLane: - curr = allocator.alloc(); - curr->op = ExtractLaneVecF32x4; - curr->index = getLaneIndex(4); - break; - case BinaryConsts::F64x2ExtractLane: - curr = allocator.alloc(); - curr->op = ExtractLaneVecF64x2; - curr->index = getLaneIndex(2); - break; - default: - return false; - } - curr->vec = popNonVoidExpression(); - curr->finalize(); - out = curr; - return true; -} - -bool WasmBinaryReader::maybeVisitSIMDReplace(Expression*& out, uint32_t code) { - SIMDReplace* curr; - switch (code) { - case BinaryConsts::I8x16ReplaceLane: - curr = allocator.alloc(); - curr->op = ReplaceLaneVecI8x16; - curr->index = getLaneIndex(16); - break; - case BinaryConsts::I16x8ReplaceLane: - curr = allocator.alloc(); - curr->op = ReplaceLaneVecI16x8; - curr->index = getLaneIndex(8); - break; - case BinaryConsts::I32x4ReplaceLane: - curr = allocator.alloc(); - curr->op = ReplaceLaneVecI32x4; - curr->index = getLaneIndex(4); - break; - case BinaryConsts::I64x2ReplaceLane: - curr = allocator.alloc(); - curr->op = ReplaceLaneVecI64x2; - curr->index = getLaneIndex(2); - break; - case BinaryConsts::F16x8ReplaceLane: - curr = allocator.alloc(); - curr->op = ReplaceLaneVecF16x8; - curr->index = getLaneIndex(8); - break; - case BinaryConsts::F32x4ReplaceLane: - curr = allocator.alloc(); - curr->op = ReplaceLaneVecF32x4; - curr->index = getLaneIndex(4); - break; - case BinaryConsts::F64x2ReplaceLane: - curr = allocator.alloc(); - curr->op = ReplaceLaneVecF64x2; - curr->index = getLaneIndex(2); - break; - default: - return false; - } - curr->value = popNonVoidExpression(); - curr->vec = popNonVoidExpression(); - curr->finalize(); - out = curr; - return true; -} - -bool WasmBinaryReader::maybeVisitSIMDShuffle(Expression*& out, uint32_t code) { - if (code != BinaryConsts::I8x16Shuffle) { - return false; - } - auto* curr = allocator.alloc(); - for (auto i = 0; i < 16; ++i) { - curr->mask[i] = getLaneIndex(32); - } - curr->right = popNonVoidExpression(); - curr->left = popNonVoidExpression(); - curr->finalize(); - out = curr; - return true; -} - -bool WasmBinaryReader::maybeVisitSIMDTernary(Expression*& out, uint32_t code) { - SIMDTernary* curr; - switch (code) { - case BinaryConsts::V128Bitselect: - curr = allocator.alloc(); - curr->op = Bitselect; - break; - case BinaryConsts::I8x16Laneselect: - curr = allocator.alloc(); - curr->op = LaneselectI8x16; - break; - case BinaryConsts::I16x8Laneselect: - curr = allocator.alloc(); - curr->op = LaneselectI16x8; - break; - case BinaryConsts::I32x4Laneselect: - curr = allocator.alloc(); - curr->op = LaneselectI32x4; - break; - case BinaryConsts::I64x2Laneselect: - curr = allocator.alloc(); - curr->op = LaneselectI64x2; - break; - case BinaryConsts::F16x8RelaxedMadd: - curr = allocator.alloc(); - curr->op = RelaxedMaddVecF16x8; - break; - case BinaryConsts::F16x8RelaxedNmadd: - curr = allocator.alloc(); - curr->op = RelaxedNmaddVecF16x8; - break; - case BinaryConsts::F32x4RelaxedMadd: - curr = allocator.alloc(); - curr->op = RelaxedMaddVecF32x4; - break; - case BinaryConsts::F32x4RelaxedNmadd: - curr = allocator.alloc(); - curr->op = RelaxedNmaddVecF32x4; - break; - case BinaryConsts::F64x2RelaxedMadd: - curr = allocator.alloc(); - curr->op = RelaxedMaddVecF64x2; - break; - case BinaryConsts::F64x2RelaxedNmadd: - curr = allocator.alloc(); - curr->op = RelaxedNmaddVecF64x2; - break; - case BinaryConsts::I32x4DotI8x16I7x16AddS: - curr = allocator.alloc(); - curr->op = DotI8x16I7x16AddSToVecI32x4; - break; - default: - return false; - } - curr->c = popNonVoidExpression(); - curr->b = popNonVoidExpression(); - curr->a = popNonVoidExpression(); - curr->finalize(); - out = curr; - return true; -} - -bool WasmBinaryReader::maybeVisitSIMDShift(Expression*& out, uint32_t code) { - SIMDShift* curr; - switch (code) { - case BinaryConsts::I8x16Shl: - curr = allocator.alloc(); - curr->op = ShlVecI8x16; - break; - case BinaryConsts::I8x16ShrS: - curr = allocator.alloc(); - curr->op = ShrSVecI8x16; - break; - case BinaryConsts::I8x16ShrU: - curr = allocator.alloc(); - curr->op = ShrUVecI8x16; - break; - case BinaryConsts::I16x8Shl: - curr = allocator.alloc(); - curr->op = ShlVecI16x8; - break; - case BinaryConsts::I16x8ShrS: - curr = allocator.alloc(); - curr->op = ShrSVecI16x8; - break; - case BinaryConsts::I16x8ShrU: - curr = allocator.alloc(); - curr->op = ShrUVecI16x8; - break; - case BinaryConsts::I32x4Shl: - curr = allocator.alloc(); - curr->op = ShlVecI32x4; - break; - case BinaryConsts::I32x4ShrS: - curr = allocator.alloc(); - curr->op = ShrSVecI32x4; - break; - case BinaryConsts::I32x4ShrU: - curr = allocator.alloc(); - curr->op = ShrUVecI32x4; - break; - case BinaryConsts::I64x2Shl: - curr = allocator.alloc(); - curr->op = ShlVecI64x2; - break; - case BinaryConsts::I64x2ShrS: - curr = allocator.alloc(); - curr->op = ShrSVecI64x2; - break; - case BinaryConsts::I64x2ShrU: - curr = allocator.alloc(); - curr->op = ShrUVecI64x2; - break; - default: - return false; - } - curr->shift = popNonVoidExpression(); - curr->vec = popNonVoidExpression(); - curr->finalize(); - out = curr; - return true; -} - -bool WasmBinaryReader::maybeVisitSIMDLoad(Expression*& out, uint32_t code) { - if (code == BinaryConsts::V128Load) { - auto* curr = allocator.alloc(); - curr->type = Type::v128; - curr->bytes = 16; - Index memIdx = readMemoryAccess(curr->align, curr->offset); - curr->memory = getMemoryName(memIdx); - curr->isAtomic = false; - curr->ptr = popNonVoidExpression(); - curr->finalize(); - out = curr; - return true; - } - SIMDLoad* curr; - switch (code) { - case BinaryConsts::V128Load8Splat: - curr = allocator.alloc(); - curr->op = Load8SplatVec128; - break; - case BinaryConsts::V128Load16Splat: - curr = allocator.alloc(); - curr->op = Load16SplatVec128; - break; - case BinaryConsts::V128Load32Splat: - curr = allocator.alloc(); - curr->op = Load32SplatVec128; - break; - case BinaryConsts::V128Load64Splat: - curr = allocator.alloc(); - curr->op = Load64SplatVec128; - break; - case BinaryConsts::V128Load8x8S: - curr = allocator.alloc(); - curr->op = Load8x8SVec128; - break; - case BinaryConsts::V128Load8x8U: - curr = allocator.alloc(); - curr->op = Load8x8UVec128; - break; - case BinaryConsts::V128Load16x4S: - curr = allocator.alloc(); - curr->op = Load16x4SVec128; - break; - case BinaryConsts::V128Load16x4U: - curr = allocator.alloc(); - curr->op = Load16x4UVec128; - break; - case BinaryConsts::V128Load32x2S: - curr = allocator.alloc(); - curr->op = Load32x2SVec128; - break; - case BinaryConsts::V128Load32x2U: - curr = allocator.alloc(); - curr->op = Load32x2UVec128; - break; - case BinaryConsts::V128Load32Zero: - curr = allocator.alloc(); - curr->op = Load32ZeroVec128; - break; - case BinaryConsts::V128Load64Zero: - curr = allocator.alloc(); - curr->op = Load64ZeroVec128; - break; - default: - return false; - } - Index memIdx = readMemoryAccess(curr->align, curr->offset); - curr->memory = getMemoryName(memIdx); - curr->ptr = popNonVoidExpression(); - curr->finalize(); - out = curr; - return true; -} - -bool WasmBinaryReader::maybeVisitSIMDLoadStoreLane(Expression*& out, - uint32_t code) { - SIMDLoadStoreLaneOp op; - size_t lanes; - switch (code) { - case BinaryConsts::V128Load8Lane: - op = Load8LaneVec128; - lanes = 16; - break; - case BinaryConsts::V128Load16Lane: - op = Load16LaneVec128; - lanes = 8; - break; - case BinaryConsts::V128Load32Lane: - op = Load32LaneVec128; - lanes = 4; - break; - case BinaryConsts::V128Load64Lane: - op = Load64LaneVec128; - lanes = 2; - break; - case BinaryConsts::V128Store8Lane: - op = Store8LaneVec128; - lanes = 16; - break; - case BinaryConsts::V128Store16Lane: - op = Store16LaneVec128; - lanes = 8; - break; - case BinaryConsts::V128Store32Lane: - op = Store32LaneVec128; - lanes = 4; - break; - case BinaryConsts::V128Store64Lane: - op = Store64LaneVec128; - lanes = 2; - break; - default: - return false; - } - auto* curr = allocator.alloc(); - curr->op = op; - Index memIdx = readMemoryAccess(curr->align, curr->offset); - curr->memory = getMemoryName(memIdx); - curr->index = getLaneIndex(lanes); - curr->vec = popNonVoidExpression(); - curr->ptr = popNonVoidExpression(); - curr->finalize(); - out = curr; - return true; -} - -void WasmBinaryReader::visitSelect(Select* curr, uint8_t code) { - if (code == BinaryConsts::SelectWithType) { - size_t numTypes = getU32LEB(); - std::vector types; - for (size_t i = 0; i < numTypes; i++) { - auto t = getType(); - if (!t.isConcrete()) { - throwError("bad select type"); - } - types.push_back(t); - } - curr->type = Type(types); - } - curr->condition = popNonVoidExpression(); - curr->ifFalse = popNonVoidExpression(); - curr->ifTrue = popNonVoidExpression(); - if (code == BinaryConsts::SelectWithType) { - curr->finalize(curr->type); - } else { - curr->finalize(); - } -} - -void WasmBinaryReader::visitReturn(Return* curr) { - requireFunctionContext("return"); - Type type = currFunction->getResults(); - if (type.isConcrete()) { - curr->value = popTypedExpression(type); - } - curr->finalize(); -} - -void WasmBinaryReader::visitMemorySize(MemorySize* curr) { - Index index = getU32LEB(); - curr->memory = getMemoryName(index); - if (getMemory(index)->is64()) { - curr->type = Type::i64; - } - curr->finalize(); -} - -void WasmBinaryReader::visitMemoryGrow(MemoryGrow* curr) { - Index index = getU32LEB(); - curr->memory = getMemoryName(index); - if (getMemory(index)->is64()) { - curr->type = Type::i64; - } - curr->delta = popNonVoidExpression(); - curr->finalize(); -} - -void WasmBinaryReader::visitNop(Nop* curr) {} - -void WasmBinaryReader::visitUnreachable(Unreachable* curr) {} - -void WasmBinaryReader::visitDrop(Drop* curr) { - curr->value = popNonVoidExpression(); - curr->finalize(); -} - -void WasmBinaryReader::visitRefNull(RefNull* curr) { - curr->finalize(getHeapType().getBottom()); -} - -void WasmBinaryReader::visitRefIsNull(RefIsNull* curr) { - curr->value = popNonVoidExpression(); - curr->finalize(); -} - -void WasmBinaryReader::visitRefFunc(RefFunc* curr) { - Index index = getU32LEB(); - // To support typed function refs, we give the reference not just a general - // funcref, but a specific subtype with the actual signature. - curr->func = getFunctionName(index); - curr->finalize(Type(getTypeByFunctionIndex(index), NonNullable)); -} - -void WasmBinaryReader::visitRefEq(RefEq* curr) { - curr->right = popNonVoidExpression(); - curr->left = popNonVoidExpression(); - curr->finalize(); -} - -void WasmBinaryReader::visitTableGet(TableGet* curr) { - Index tableIdx = getU32LEB(); - curr->table = getTableName(tableIdx); - curr->index = popNonVoidExpression(); - curr->type = wasm.tables[tableIdx]->type; - curr->finalize(); -} - -void WasmBinaryReader::visitTableSet(TableSet* curr) { - Index tableIdx = getU32LEB(); - curr->table = getTableName(tableIdx); - curr->value = popNonVoidExpression(); - curr->index = popNonVoidExpression(); - curr->finalize(); -} - -void WasmBinaryReader::visitTryOrTryInBlock(Expression*& out) { - auto* curr = allocator.alloc(); - startControlFlow(curr); - // For simplicity of implementation, like if scopes, we create a hidden block - // within each try-body and catch-body, and let branches target those inner - // blocks instead. - curr->type = getType(); - curr->body = getBlockOrSingleton(curr->type); - - Builder builder(wasm); - // A nameless label shared by all catch body blocks - Name catchLabel = getNextLabel(); - breakStack.push_back({catchLabel, curr->type}); - - auto readCatchBody = [&](Type tagType) { - auto start = expressionStack.size(); - if (tagType != Type::none) { - pushExpression(builder.makePop(tagType)); - } - processExpressions(); - size_t end = expressionStack.size(); - if (start > end) { - throwError("block cannot pop from outside"); - } - if (end - start == 1) { - curr->catchBodies.push_back(popExpression()); - } else { - auto* block = allocator.alloc(); - pushBlockElements(block, curr->type, start); - block->finalize(curr->type); - curr->catchBodies.push_back(block); - } - }; - - while (lastSeparator == BinaryConsts::Catch_Legacy || - lastSeparator == BinaryConsts::CatchAll_Legacy) { - if (lastSeparator == BinaryConsts::Catch_Legacy) { - auto index = getU32LEB(); - if (index >= wasm.tags.size()) { - throwError("bad tag index"); - } - auto* tag = wasm.tags[index].get(); - curr->catchTags.push_back(tag->name); - readCatchBody(tag->sig.params); - } else { // catch_all - if (curr->hasCatchAll()) { - throwError("there should be at most one 'catch_all' clause per try"); - } - readCatchBody(Type::none); - } - } - breakStack.pop_back(); - - if (lastSeparator == BinaryConsts::Delegate) { - curr->delegateTarget = getExceptionTargetName(getU32LEB()); - } - - // For simplicity, we ensure that try's labels can only be targeted by - // delegates and rethrows, and delegates/rethrows can only target try's - // labels. (If they target blocks or loops, it is a validation failure.) - // Because we create an inner block within each try and catch body, if any - // delegate/rethrow targets those inner blocks, we should make them target the - // try's label instead. - curr->name = getNextLabel(); - if (auto* block = curr->body->dynCast()) { - if (block->name.is()) { - if (exceptionTargetNames.find(block->name) != - exceptionTargetNames.end()) { - BranchUtils::replaceExceptionTargets(block, block->name, curr->name); - exceptionTargetNames.erase(block->name); - } - } - } - if (exceptionTargetNames.find(catchLabel) != exceptionTargetNames.end()) { - for (auto* catchBody : curr->catchBodies) { - BranchUtils::replaceExceptionTargets(catchBody, catchLabel, curr->name); - } - exceptionTargetNames.erase(catchLabel); - } - - // If catch bodies contained stacky code, 'pop's can be nested within a block. - // Fix that up. - EHUtils::handleBlockNestedPop(curr, currFunction, wasm); - curr->finalize(curr->type); - - // For simplicity, we create an inner block within the catch body too, but the - // one within the 'catch' *must* be omitted when we write out the binary back - // later, because the 'catch' instruction pushes a value onto the stack and - // the inner block does not support block input parameters without multivalue - // support. - // try - // ... - // catch $e ;; Pushes value(s) onto the stack - // block ;; Inner block. Should be deleted when writing binary! - // use the pushed value - // end - // end - // - // But when input binary code is like - // try - // ... - // catch $e - // br 0 - // end - // - // 'br 0' accidentally happens to target the inner block, creating code like - // this in Binaryen IR, making the inner block not deletable, resulting in a - // validation error: - // (try - // ... - // (catch $e - // (block $label0 ;; Cannot be deleted, because there's a branch to this - // ... - // (br $label0) - // ) - // ) - // ) - // - // When this happens, we fix this by creating a block that wraps the whole - // try-catch, and making the branches target that block instead, like this: - // (block $label ;; New enclosing block, new target for the branch - // (try - // ... - // (catch $e - // (block ;; Now this can be deleted when writing binary - // ... - // (br $label) - // ) - // ) - // ) - // ) - if (breakTargetNames.find(catchLabel) == breakTargetNames.end()) { - out = curr; - } else { - // Create a new block that encloses the whole try-catch - auto* block = builder.makeBlock(catchLabel, curr); - out = block; - } - breakTargetNames.erase(catchLabel); -} - -void WasmBinaryReader::visitTryTable(TryTable* curr) { - - // For simplicity of implementation, like if scopes, we create a hidden block - // within each try-body, and let branches target those inner blocks instead. - curr->type = getType(); - auto numCatches = getU32LEB(); - - for (size_t i = 0; i < numCatches; i++) { - uint8_t code = getInt8(); - if (code == BinaryConsts::Catch || code == BinaryConsts::CatchRef) { - auto index = getU32LEB(); - if (index >= wasm.tags.size()) { - throwError("bad tag index"); - } - auto* tag = wasm.tags[index].get(); - curr->catchTags.push_back(tag->name); - } else { - curr->catchTags.push_back(Name()); - } - curr->catchDests.push_back(getBreakTarget(getU32LEB()).name); - curr->catchRefs.push_back(code == BinaryConsts::CatchRef || - code == BinaryConsts::CatchAllRef); - } - - // catch_*** clauses should refer to block labels without entering the try - // scope. So we do this after reading catch clauses. - startControlFlow(curr); - curr->body = getBlockOrSingleton(curr->type); - curr->finalize(curr->type, &wasm); -} - -void WasmBinaryReader::visitThrow(Throw* curr) { - auto index = getU32LEB(); - if (index >= wasm.tags.size()) { - throwError("bad tag index"); - } - auto* tag = wasm.tags[index].get(); - curr->tag = tag->name; - size_t num = tag->sig.params.size(); - curr->operands.resize(num); - for (size_t i = 0; i < num; i++) { - curr->operands[num - i - 1] = popNonVoidExpression(); - } - curr->finalize(); -} - -void WasmBinaryReader::visitRethrow(Rethrow* curr) { - curr->target = getExceptionTargetName(getU32LEB()); - // This special target is valid only for delegates - if (curr->target == DELEGATE_CALLER_TARGET) { - throwError(std::string("rethrow target cannot use internal name ") + - DELEGATE_CALLER_TARGET.toString()); - } - curr->finalize(); -} - -void WasmBinaryReader::visitThrowRef(ThrowRef* curr) { - curr->exnref = popNonVoidExpression(); - curr->finalize(); -} - -void WasmBinaryReader::visitCallRef(CallRef* curr) { - curr->target = popNonVoidExpression(); - HeapType heapType = getTypeByIndex(getU32LEB()); - if (!Type::isSubType(curr->target->type, Type(heapType, Nullable))) { - throwError("Call target has invalid type: " + - curr->target->type.toString()); - } - if (!heapType.isSignature()) { - throwError("Invalid reference type for a call_ref: " + heapType.toString()); - } - auto sig = heapType.getSignature(); - auto num = sig.params.size(); - curr->operands.resize(num); - for (size_t i = 0; i < num; i++) { - curr->operands[num - i - 1] = popNonVoidExpression(); - } - // If the target has bottom type, we won't be able to infer the correct type - // from it, so set the type manually to be safe. - curr->type = sig.results; - curr->finalize(); -} - -bool WasmBinaryReader::maybeVisitRefI31(Expression*& out, uint32_t code) { - Shareability share; - switch (code) { - case BinaryConsts::RefI31: - share = Unshared; - break; - case BinaryConsts::RefI31Shared: - share = Shared; - break; - default: - return false; - } - auto* value = popNonVoidExpression(); - out = Builder(wasm).makeRefI31(value, share); - return true; -} - -bool WasmBinaryReader::maybeVisitI31Get(Expression*& out, uint32_t code) { - I31Get* curr; - switch (code) { - case BinaryConsts::I31GetS: - curr = allocator.alloc(); - curr->signed_ = true; - break; - case BinaryConsts::I31GetU: - curr = allocator.alloc(); - curr->signed_ = false; - break; - default: - return false; - } - curr->i31 = popNonVoidExpression(); - curr->finalize(); - out = curr; - return true; -} - -bool WasmBinaryReader::maybeVisitRefTest(Expression*& out, uint32_t code) { - if (code == BinaryConsts::RefTest || code == BinaryConsts::RefTestNull) { - auto castType = getHeapType(); - auto nullability = - (code == BinaryConsts::RefTestNull) ? Nullable : NonNullable; - auto* ref = popNonVoidExpression(); - out = Builder(wasm).makeRefTest(ref, Type(castType, nullability)); - return true; - } - return false; -} - -bool WasmBinaryReader::maybeVisitRefCast(Expression*& out, uint32_t code) { - if (code == BinaryConsts::RefCast || code == BinaryConsts::RefCastNull) { - auto heapType = getHeapType(); - auto nullability = code == BinaryConsts::RefCast ? NonNullable : Nullable; - auto type = Type(heapType, nullability); - auto* ref = popNonVoidExpression(); - out = Builder(wasm).makeRefCast(ref, type); - return true; - } - return false; -} - -bool WasmBinaryReader::maybeVisitBrOn(Expression*& out, uint32_t code) { - Type castType = Type::none; - BrOnOp op; - switch (code) { - case BinaryConsts::BrOnNull: - op = BrOnNull; - break; - case BinaryConsts::BrOnNonNull: - op = BrOnNonNull; - break; - case BinaryConsts::BrOnCast: - op = BrOnCast; - break; - case BinaryConsts::BrOnCastFail: - op = BrOnCastFail; - break; - default: - return false; - } - bool isCast = - code == BinaryConsts::BrOnCast || code == BinaryConsts::BrOnCastFail; - uint8_t flags = 0; - if (isCast) { - flags = getInt8(); - } - auto name = getBreakTarget(getU32LEB()).name; - auto* ref = popNonVoidExpression(); - if (!ref->type.isRef() && ref->type != Type::unreachable) { - throwError("bad input type for br_on*"); - } - if (isCast) { - auto inputNullability = (flags & 1) ? Nullable : NonNullable; - auto castNullability = (flags & 2) ? Nullable : NonNullable; - auto inputHeapType = getHeapType(); - auto castHeapType = getHeapType(); - castType = Type(castHeapType, castNullability); - auto inputType = Type(inputHeapType, inputNullability); - if (!Type::isSubType(castType, inputType)) { - throwError("br_on_cast* cast type must be subtype of input type"); - } - if (!Type::isSubType(ref->type, inputType)) { - throwError(std::string("Invalid reference type for ") + - ((op == BrOnCast) ? "br_on_cast" : "br_on_cast_fail")); - } - } - out = Builder(wasm).makeBrOn(op, name, ref, castType); - return true; -} - -bool WasmBinaryReader::maybeVisitStructNew(Expression*& out, uint32_t code) { - if (code == BinaryConsts::StructNew || - code == BinaryConsts::StructNewDefault) { - auto heapType = getIndexedHeapType(); - if (!heapType.isStruct()) { - throwError("Expected struct heaptype"); - } - std::vector operands; - if (code == BinaryConsts::StructNew) { - auto numOperands = heapType.getStruct().fields.size(); - operands.resize(numOperands); - for (Index i = 0; i < numOperands; i++) { - operands[numOperands - i - 1] = popNonVoidExpression(); - } - } - out = Builder(wasm).makeStructNew(heapType, operands); - return true; - } - return false; -} - -bool WasmBinaryReader::maybeVisitStructGet(Expression*& out, uint32_t code) { - bool signed_ = false; - switch (code) { - case BinaryConsts::StructGet: - case BinaryConsts::StructGetU: - break; - case BinaryConsts::StructGetS: - signed_ = true; - break; - default: - return false; - } - auto heapType = getIndexedHeapType(); - if (!heapType.isStruct()) { - throwError("Expected struct heaptype"); - } - auto index = getU32LEB(); - if (index >= heapType.getStruct().fields.size()) { - throwError("Struct field index out of bounds"); - } - auto type = heapType.getStruct().fields[index].type; - auto ref = popNonVoidExpression(); - validateHeapTypeUsingChild(ref, heapType); - out = Builder(wasm).makeStructGet(index, ref, type, signed_); - return true; -} - -bool WasmBinaryReader::maybeVisitStructSet(Expression*& out, uint32_t code) { - if (code != BinaryConsts::StructSet) { - return false; - } - auto* curr = allocator.alloc(); - auto heapType = getIndexedHeapType(); - if (!heapType.isStruct()) { - throwError("Expected struct heaptype"); - } - curr->index = getU32LEB(); - curr->value = popNonVoidExpression(); - curr->ref = popNonVoidExpression(); - validateHeapTypeUsingChild(curr->ref, heapType); - curr->finalize(); - out = curr; - return true; -} - -bool WasmBinaryReader::maybeVisitArrayNewData(Expression*& out, uint32_t code) { - if (code == BinaryConsts::ArrayNew || code == BinaryConsts::ArrayNewDefault) { - auto heapType = getIndexedHeapType(); - if (!heapType.isArray()) { - throwError("Expected array heaptype"); - } - auto* size = popNonVoidExpression(); - Expression* init = nullptr; - if (code == BinaryConsts::ArrayNew) { - init = popNonVoidExpression(); - } - out = Builder(wasm).makeArrayNew(heapType, size, init); - return true; - } - return false; -} - -bool WasmBinaryReader::maybeVisitArrayNewElem(Expression*& out, uint32_t code) { - if (code == BinaryConsts::ArrayNewData || - code == BinaryConsts::ArrayNewElem) { - auto isData = code == BinaryConsts::ArrayNewData; - auto heapType = getIndexedHeapType(); - if (!heapType.isArray()) { - throwError("Expected array heaptype"); - } - auto segIdx = getU32LEB(); - auto segment = isData ? getDataName(segIdx) : getElemName(segIdx); - auto* size = popNonVoidExpression(); - auto* offset = popNonVoidExpression(); - if (isData) { - out = Builder(wasm).makeArrayNewData(heapType, segment, offset, size); - } else { - out = Builder(wasm).makeArrayNewElem(heapType, segment, offset, size); - } - return true; - } - return false; -} - -bool WasmBinaryReader::maybeVisitArrayNewFixed(Expression*& out, - uint32_t code) { - if (code == BinaryConsts::ArrayNewFixed) { - auto heapType = getIndexedHeapType(); - if (!heapType.isArray()) { - throwError("Expected array heaptype"); - } - auto size = getU32LEB(); - std::vector values(size); - for (size_t i = 0; i < size; i++) { - values[size - i - 1] = popNonVoidExpression(); - } - out = Builder(wasm).makeArrayNewFixed(heapType, values); - return true; - } - return false; -} - -bool WasmBinaryReader::maybeVisitArrayGet(Expression*& out, uint32_t code) { - bool signed_ = false; - switch (code) { - case BinaryConsts::ArrayGet: - case BinaryConsts::ArrayGetU: - break; - case BinaryConsts::ArrayGetS: - signed_ = true; - break; - default: - return false; - } - auto heapType = getIndexedHeapType(); - if (!heapType.isArray()) { - throwError("Expected array heaptype"); - } - auto type = heapType.getArray().element.type; - auto* index = popNonVoidExpression(); - auto* ref = popNonVoidExpression(); - validateHeapTypeUsingChild(ref, heapType); - out = Builder(wasm).makeArrayGet(ref, index, type, signed_); - return true; -} - -bool WasmBinaryReader::maybeVisitArraySet(Expression*& out, uint32_t code) { - if (code != BinaryConsts::ArraySet) { - return false; - } - auto heapType = getIndexedHeapType(); - if (!heapType.isArray()) { - throwError("Expected array heaptype"); - } - auto* value = popNonVoidExpression(); - auto* index = popNonVoidExpression(); - auto* ref = popNonVoidExpression(); - validateHeapTypeUsingChild(ref, heapType); - out = Builder(wasm).makeArraySet(ref, index, value); - return true; -} - -bool WasmBinaryReader::maybeVisitArrayLen(Expression*& out, uint32_t code) { - if (code != BinaryConsts::ArrayLen) { - return false; - } - auto* ref = popNonVoidExpression(); - out = Builder(wasm).makeArrayLen(ref); - return true; -} - -bool WasmBinaryReader::maybeVisitArrayCopy(Expression*& out, uint32_t code) { - if (code != BinaryConsts::ArrayCopy) { - return false; - } - auto destHeapType = getIndexedHeapType(); - if (!destHeapType.isArray()) { - throwError("Expected array heaptype"); - } - auto srcHeapType = getIndexedHeapType(); - if (!srcHeapType.isArray()) { - throwError("Expected array heaptype"); - } - auto* length = popNonVoidExpression(); - auto* srcIndex = popNonVoidExpression(); - auto* srcRef = popNonVoidExpression(); - auto* destIndex = popNonVoidExpression(); - auto* destRef = popNonVoidExpression(); - validateHeapTypeUsingChild(destRef, destHeapType); - validateHeapTypeUsingChild(srcRef, srcHeapType); - out = - Builder(wasm).makeArrayCopy(destRef, destIndex, srcRef, srcIndex, length); - return true; -} - -bool WasmBinaryReader::maybeVisitArrayFill(Expression*& out, uint32_t code) { - if (code != BinaryConsts::ArrayFill) { - return false; - } - auto heapType = getIndexedHeapType(); - if (!heapType.isArray()) { - throwError("Expected array heaptype"); - } - auto* size = popNonVoidExpression(); - auto* value = popNonVoidExpression(); - auto* index = popNonVoidExpression(); - auto* ref = popNonVoidExpression(); - validateHeapTypeUsingChild(ref, heapType); - out = Builder(wasm).makeArrayFill(ref, index, value, size); - return true; -} - -bool WasmBinaryReader::maybeVisitArrayInit(Expression*& out, uint32_t code) { - bool isData = true; - switch (code) { - case BinaryConsts::ArrayInitData: - break; - case BinaryConsts::ArrayInitElem: - isData = false; - break; - default: - return false; - } - auto heapType = getIndexedHeapType(); - if (!heapType.isArray()) { - throwError("Expected array heaptype"); - } - Index segIdx = getU32LEB(); - auto segment = isData ? getDataName(segIdx) : getElemName(segIdx); - auto* size = popNonVoidExpression(); - auto* offset = popNonVoidExpression(); - auto* index = popNonVoidExpression(); - auto* ref = popNonVoidExpression(); - validateHeapTypeUsingChild(ref, heapType); - if (isData) { - out = Builder(wasm).makeArrayInitData(segment, ref, index, offset, size); - } else { - out = Builder(wasm).makeArrayInitElem(segment, ref, index, offset, size); - } - return true; -} - -bool WasmBinaryReader::maybeVisitStringNew(Expression*& out, uint32_t code) { - StringNewOp op; - if (code == BinaryConsts::StringNewLossyUTF8Array) { - op = StringNewLossyUTF8Array; - } else if (code == BinaryConsts::StringNewWTF16Array) { - op = StringNewWTF16Array; - } else if (code == BinaryConsts::StringFromCodePoint) { - out = Builder(wasm).makeStringNew(StringNewFromCodePoint, - popNonVoidExpression()); - return true; - } else { - return false; - } - Expression* end = popNonVoidExpression(); - Expression* start = popNonVoidExpression(); - auto* ref = popNonVoidExpression(); - out = Builder(wasm).makeStringNew(op, ref, start, end); - return true; -} - -bool WasmBinaryReader::maybeVisitStringAsWTF16(Expression*& out, - uint32_t code) { - if (code != BinaryConsts::StringAsWTF16) { - return false; - } - // Accept but ignore `string.as_wtf16`, parsing the next expression in its - // place. We do not support this instruction in the IR, but we need to accept - // it in the parser because it is emitted as part of the instruction sequence - // for `stringview_wtf16.get_codeunit` and `stringview_wtf16.slice`. - readExpression(out); - return true; -} - -bool WasmBinaryReader::maybeVisitStringConst(Expression*& out, uint32_t code) { - if (code != BinaryConsts::StringConst) { - return false; - } - auto index = getU32LEB(); - if (index >= strings.size()) { - throwError("bad string index"); - } - out = Builder(wasm).makeStringConst(strings[index]); - return true; -} - -bool WasmBinaryReader::maybeVisitStringMeasure(Expression*& out, - uint32_t code) { - StringMeasureOp op; - if (code == BinaryConsts::StringMeasureUTF8) { - op = StringMeasureUTF8; - } else if (code == BinaryConsts::StringMeasureWTF16) { - op = StringMeasureWTF16; - } else { - return false; - } - auto* ref = popNonVoidExpression(); - out = Builder(wasm).makeStringMeasure(op, ref); - return true; -} - -bool WasmBinaryReader::maybeVisitStringEncode(Expression*& out, uint32_t code) { - StringEncodeOp op; - if (code == BinaryConsts::StringEncodeLossyUTF8Array) { - op = StringEncodeLossyUTF8Array; - } else if (code == BinaryConsts::StringEncodeWTF16Array) { - op = StringEncodeWTF16Array; - } else { - return false; - } - auto* start = popNonVoidExpression(); - auto* ptr = popNonVoidExpression(); - auto* ref = popNonVoidExpression(); - out = Builder(wasm).makeStringEncode(op, ref, ptr, start); - return true; -} - -bool WasmBinaryReader::maybeVisitStringConcat(Expression*& out, uint32_t code) { - if (code != BinaryConsts::StringConcat) { - return false; - } - auto* right = popNonVoidExpression(); - auto* left = popNonVoidExpression(); - out = Builder(wasm).makeStringConcat(left, right); - return true; -} - -bool WasmBinaryReader::maybeVisitStringEq(Expression*& out, uint32_t code) { - StringEqOp op; - if (code == BinaryConsts::StringEq) { - op = StringEqEqual; - } else if (code == BinaryConsts::StringCompare) { - op = StringEqCompare; - } else { - return false; - } - auto* right = popNonVoidExpression(); - auto* left = popNonVoidExpression(); - out = Builder(wasm).makeStringEq(op, left, right); - return true; -} - -bool WasmBinaryReader::maybeVisitStringWTF16Get(Expression*& out, - uint32_t code) { - if (code != BinaryConsts::StringViewWTF16GetCodePoint) { - return false; - } - auto* pos = popNonVoidExpression(); - auto* ref = popNonVoidExpression(); - out = Builder(wasm).makeStringWTF16Get(ref, pos); - return true; -} - -bool WasmBinaryReader::maybeVisitStringSliceWTF(Expression*& out, - uint32_t code) { - if (code != BinaryConsts::StringViewWTF16Slice) { - return false; - } - auto* end = popNonVoidExpression(); - auto* start = popNonVoidExpression(); - auto* ref = popNonVoidExpression(); - out = Builder(wasm).makeStringSliceWTF(ref, start, end); - return true; -} - -void WasmBinaryReader::visitRefAs(RefAs* curr, uint8_t code) { - switch (code) { - case BinaryConsts::RefAsNonNull: - curr->op = RefAsNonNull; - break; - case BinaryConsts::AnyConvertExtern: - curr->op = AnyConvertExtern; - break; - case BinaryConsts::ExternConvertAny: - curr->op = ExternConvertAny; - break; - default: - WASM_UNREACHABLE("invalid code for ref.as_*"); - } - curr->value = popNonVoidExpression(); - if (!curr->value->type.isRef() && curr->value->type != Type::unreachable) { - throwError("bad input type for ref.as: " + curr->value->type.toString()); - } - curr->finalize(); -} - -void WasmBinaryReader::visitContBind(ContBind* curr) { - - auto contTypeBeforeIndex = getU32LEB(); - curr->contTypeBefore = getTypeByIndex(contTypeBeforeIndex); - - auto contTypeAfterIndex = getU32LEB(); - curr->contTypeAfter = getTypeByIndex(contTypeAfterIndex); - - for (auto& ct : {curr->contTypeBefore, curr->contTypeAfter}) { - if (!ct.isContinuation()) { - throwError("non-continuation type in cont.bind instruction " + - ct.toString()); - } - } - - curr->cont = popNonVoidExpression(); - - size_t paramsBefore = - curr->contTypeBefore.getContinuation().type.getSignature().params.size(); - size_t paramsAfter = - curr->contTypeAfter.getContinuation().type.getSignature().params.size(); - if (paramsBefore < paramsAfter) { - throwError("incompatible continuation types in cont.bind: source type " + - curr->contTypeBefore.toString() + - " has fewer parameters than destination " + - curr->contTypeAfter.toString()); - } - size_t numArgs = paramsBefore - paramsAfter; - curr->operands.resize(numArgs); - for (size_t i = 0; i < numArgs; i++) { - curr->operands[numArgs - i - 1] = popNonVoidExpression(); - } - - curr->finalize(); -} - -void WasmBinaryReader::visitContNew(ContNew* curr) { - - auto contTypeIndex = getU32LEB(); - curr->contType = getTypeByIndex(contTypeIndex); - if (!curr->contType.isContinuation()) { - throwError("non-continuation type in cont.new instruction " + - curr->contType.toString()); - } - - curr->func = popNonVoidExpression(); - curr->finalize(); -} - -void WasmBinaryReader::visitResume(Resume* curr) { - - auto contTypeIndex = getU32LEB(); - curr->contType = getTypeByIndex(contTypeIndex); - if (!curr->contType.isContinuation()) { - throwError("non-continuation type in resume instruction " + - curr->contType.toString()); - } - - auto numHandlers = getU32LEB(); - curr->handlerTags.resize(numHandlers); - curr->handlerBlocks.resize(numHandlers); - - for (size_t i = 0; i < numHandlers; i++) { - curr->handlerTags[i] = getTagName(getU32LEB()); - curr->handlerBlocks[i] = getBreakTarget(getU32LEB()).name; - } - - curr->cont = popNonVoidExpression(); - - auto numArgs = - curr->contType.getContinuation().type.getSignature().params.size(); - curr->operands.resize(numArgs); - for (size_t i = 0; i < numArgs; i++) { - curr->operands[numArgs - i - 1] = popNonVoidExpression(); - } - - curr->finalize(&wasm); -} - -void WasmBinaryReader::visitSuspend(Suspend* curr) { - auto tagIndex = getU32LEB(); - curr->tag = getTagName(tagIndex); - auto* tag = wasm.tags[tagIndex].get(); - - auto numArgs = tag->sig.params.size(); - curr->operands.resize(numArgs); - for (size_t i = 0; i < numArgs; i++) { - curr->operands[numArgs - i - 1] = popNonVoidExpression(); - } - - curr->finalize(&wasm); -} - -void WasmBinaryReader::throwError(std::string text) { - throw ParseException(text, 0, pos); -} - -void WasmBinaryReader::validateHeapTypeUsingChild(Expression* child, - HeapType heapType) { - if (child->type == Type::unreachable) { - return; - } - if (!child->type.isRef() || - !HeapType::isSubType(child->type.getHeapType(), heapType)) { - throwError("bad heap type: expected " + heapType.toString() + - " but found " + child->type.toString()); - } +// TODO: make this the only version +std::tuple WasmBinaryReader::getMemarg() { + Address alignment, offset; + auto memIdx = readMemoryAccess(alignment, offset); + return {getMemoryName(memIdx), alignment, offset}; } } // namespace wasm diff --git a/test/br_to_exit.wasm.fromBinary b/test/br_to_exit.wasm.fromBinary index faee4e21b23..a25acc93761 100644 --- a/test/br_to_exit.wasm.fromBinary +++ b/test/br_to_exit.wasm.fromBinary @@ -1,8 +1,8 @@ (module (type $0 (func)) (func $0 - (block $label$0 - (br $label$0) + (block $label + (br $label) ) ) ) diff --git a/test/br_to_try.wasm.fromBinary b/test/br_to_try.wasm.fromBinary index 4a1f7be3772..a3bed8ee0fa 100644 --- a/test/br_to_try.wasm.fromBinary +++ b/test/br_to_try.wasm.fromBinary @@ -3,15 +3,15 @@ (type $1 (func)) (tag $tag$0 (param i32)) (func $0 - (try $label$3 - (do - (block $label$1 - (br $label$1) + (block $label + (try + (do + (br $label) ) - ) - (catch $tag$0 - (drop - (pop i32) + (catch $tag$0 + (drop + (pop i32) + ) ) ) ) diff --git a/test/break-to-return.wasm.fromBinary b/test/break-to-return.wasm.fromBinary index d9c1f4fddef..8492cb0077d 100644 --- a/test/break-to-return.wasm.fromBinary +++ b/test/break-to-return.wasm.fromBinary @@ -3,8 +3,8 @@ (memory $0 256 256) (export "add" (func $0)) (func $0 (param $0 i32) (param $1 i32) (result i32) - (block $label$0 (result i32) - (br $label$0 + (block $label (result i32) + (br $label (i32.add (local.get $0) (local.get $1) diff --git a/test/break-within-catch.wasm.fromBinary b/test/break-within-catch.wasm.fromBinary index 3fe738104b6..7d151f48c48 100644 --- a/test/break-within-catch.wasm.fromBinary +++ b/test/break-within-catch.wasm.fromBinary @@ -3,8 +3,8 @@ (type $1 (func)) (tag $tag$0 (param i32)) (func $0 - (block $label$2 - (try $label$3 + (block $label + (try (do (nop) ) @@ -12,7 +12,7 @@ (drop (pop i32) ) - (br $label$2) + (br $label) ) ) ) diff --git a/test/consume-stacky.wasm.fromBinary b/test/consume-stacky.wasm.fromBinary index 25cc9a54130..76ec73d7b89 100644 --- a/test/consume-stacky.wasm.fromBinary +++ b/test/consume-stacky.wasm.fromBinary @@ -2,15 +2,15 @@ (type $0 (func (result i32))) (memory $0 1 1) (func $0 (result i32) - (local $0 i32) - (local.set $0 + (local $scratch i32) + (local.set $scratch (i32.const 1) ) (i32.store (i32.const 2) (i32.const 3) ) - (local.get $0) + (local.get $scratch) ) ) diff --git a/test/elided-br.wasm.fromBinary b/test/elided-br.wasm.fromBinary index 04ec30dfb6e..24331dbb5f9 100644 --- a/test/elided-br.wasm.fromBinary +++ b/test/elided-br.wasm.fromBinary @@ -1,8 +1,11 @@ (module (type $0 (func)) (func $0 - (block $label$1 + (block $block (unreachable) + (block + (br $block) + ) ) ) ) diff --git a/test/example/c-api-unused-mem.txt b/test/example/c-api-unused-mem.txt index 36d0a9a6b34..48ea5982f47 100644 --- a/test/example/c-api-unused-mem.txt +++ b/test/example/c-api-unused-mem.txt @@ -47,13 +47,13 @@ (local $0 i32) (local $1 i32) (local $2 i64) - (block $label$1 + (block $block (local.set $0 (i32.load (i32.const 0) ) ) - (br $label$1) + (br $block) ) (i32.store (i32.const 0) diff --git a/test/fib-dbg.wasm.fromBinary b/test/fib-dbg.wasm.fromBinary index f1b263234d0..58c86ec7119 100644 --- a/test/fib-dbg.wasm.fromBinary +++ b/test/fib-dbg.wasm.fromBinary @@ -50,7 +50,7 @@ (export "stackAlloc" (func $stackAlloc)) (func $stackAlloc (param $0 i32) (result i32) (local $1 i32) - (block $label$1 + (block (local.set $1 (global.get $global$3) ) @@ -72,7 +72,9 @@ (return (local.get $1) ) + (unreachable) ) + (unreachable) ) (func $stackSave (result i32) (return @@ -85,13 +87,11 @@ ) ) (func $establishStackSpace (param $0 i32) (param $1 i32) - (block $label$1 - (global.set $global$3 - (local.get $0) - ) - (global.set $global$4 - (local.get $1) - ) + (global.set $global$3 + (local.get $0) + ) + (global.set $global$4 + (local.get $1) ) ) (func $setThrew (param $0 i32) (param $1 i32) @@ -122,7 +122,7 @@ (local $9 i32) (local $10 i32) (local $11 i32) - (block $label$1 + (block (local.set $11 (global.get $global$3) ) @@ -158,8 +158,8 @@ ) ) ;;@ fib.c:8:0 - (loop $label$4 - (block $label$5 + (loop $label + (block $block ;;@ fib.c:4:0 (local.set $3 (i32.add @@ -188,7 +188,7 @@ (local.set $4 (local.get $3) ) - (br $label$5) + (br $block) ) (else (local.set $2 @@ -206,15 +206,21 @@ ) ) ;;@ fib.c:3:0 - (br $label$4) + (br $label) ) ) ;;@ fib.c:8:0 (return (local.get $4) ) + ;;@ fib.c:8:0 + (unreachable) + ;;@ fib.c:8:0 + (unreachable) ) ;;@ fib.c:8:0 + (unreachable) + ;;@ fib.c:8:0 ) (func $runPostSets (local $0 i32) diff --git a/test/fn_prolog_epilog.debugInfo.wasm.fromBinary b/test/fn_prolog_epilog.debugInfo.wasm.fromBinary index ff96a6a4717..73b8d1d4235 100644 --- a/test/fn_prolog_epilog.debugInfo.wasm.fromBinary +++ b/test/fn_prolog_epilog.debugInfo.wasm.fromBinary @@ -4,10 +4,10 @@ (func $0 (nop) ;;@ src.cpp:2:1 - (block $label$1 + (block ;;@ src.cpp:2:2 - (block $label$2 - (br $label$2) + (block $block + (br $block) ) ) ;;@ src.cpp:3:1 diff --git a/test/lit/basic/exception-handling-legacy.wast b/test/lit/basic/exception-handling-legacy.wast index 6d6c82e83eb..ba3e6d6d2de 100644 --- a/test/lit/basic/exception-handling-legacy.wast +++ b/test/lit/basic/exception-handling-legacy.wast @@ -80,7 +80,7 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $simple-try-catch (type $0) - ;; CHECK-BIN-NEXT: (try $label$3 + ;; CHECK-BIN-NEXT: (try ;; CHECK-BIN-NEXT: (do ;; CHECK-BIN-NEXT: (throw $e-i32 ;; CHECK-BIN-NEXT: (i32.const 0) @@ -128,9 +128,9 @@ ;; CHECK-BIN: (func $try-catch-multivalue-tag (type $0) ;; CHECK-BIN-NEXT: (local $x i32) ;; CHECK-BIN-NEXT: (local $1 i64) - ;; CHECK-BIN-NEXT: (local $2 (tuple i32 i64)) - ;; CHECK-BIN-NEXT: (local $3 i32) - ;; CHECK-BIN-NEXT: (try $label$3 + ;; CHECK-BIN-NEXT: (local $scratch (tuple i32 i64)) + ;; CHECK-BIN-NEXT: (local $scratch_3 i32) + ;; CHECK-BIN-NEXT: (try ;; CHECK-BIN-NEXT: (do ;; CHECK-BIN-NEXT: (throw $e-i32-i64 ;; CHECK-BIN-NEXT: (i32.const 0) @@ -138,22 +138,21 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (catch $e-i32-i64 - ;; CHECK-BIN-NEXT: (local.set $2 - ;; CHECK-BIN-NEXT: (pop (tuple i32 i64)) - ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (local.set $x ;; CHECK-BIN-NEXT: (block (result i32) - ;; CHECK-BIN-NEXT: (local.set $3 + ;; CHECK-BIN-NEXT: (local.set $scratch_3 ;; CHECK-BIN-NEXT: (tuple.extract 2 0 - ;; CHECK-BIN-NEXT: (local.get $2) + ;; CHECK-BIN-NEXT: (local.tee $scratch + ;; CHECK-BIN-NEXT: (pop (tuple i32 i64)) + ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (local.set $1 ;; CHECK-BIN-NEXT: (tuple.extract 2 1 - ;; CHECK-BIN-NEXT: (local.get $2) + ;; CHECK-BIN-NEXT: (local.get $scratch) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (local.get $3) + ;; CHECK-BIN-NEXT: (local.get $scratch_3) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop @@ -194,18 +193,19 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $try-with-block-label (type $0) - ;; CHECK-BIN-NEXT: (block $label$1 - ;; CHECK-BIN-NEXT: (try $label$4 + ;; CHECK-BIN-NEXT: (block $block + ;; CHECK-BIN-NEXT: (try ;; CHECK-BIN-NEXT: (do - ;; CHECK-BIN-NEXT: (br $label$1) + ;; CHECK-BIN-NEXT: (br $block) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (catch $e-i32 ;; CHECK-BIN-NEXT: (drop ;; CHECK-BIN-NEXT: (pop i32) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (br $label$1) + ;; CHECK-BIN-NEXT: (br $block) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (unreachable) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) (func $try-with-block-label @@ -233,7 +233,7 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $empty-try-body (type $0) - ;; CHECK-BIN-NEXT: (try $label$3 + ;; CHECK-BIN-NEXT: (try ;; CHECK-BIN-NEXT: (do ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) @@ -269,7 +269,7 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $multiple-insts-within-try-and-catch-bodies (type $0) - ;; CHECK-BIN-NEXT: (try $label$3 + ;; CHECK-BIN-NEXT: (try ;; CHECK-BIN-NEXT: (do ;; CHECK-BIN-NEXT: (call $foo) ;; CHECK-BIN-NEXT: (call $bar) @@ -317,7 +317,7 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $multiple-catches (type $0) - ;; CHECK-BIN-NEXT: (try $label$3 + ;; CHECK-BIN-NEXT: (try ;; CHECK-BIN-NEXT: (do ;; CHECK-BIN-NEXT: (throw $e-i32 ;; CHECK-BIN-NEXT: (i32.const 0) @@ -362,7 +362,7 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $catch-all (type $0) - ;; CHECK-BIN-NEXT: (try $label$3 + ;; CHECK-BIN-NEXT: (try ;; CHECK-BIN-NEXT: (do ;; CHECK-BIN-NEXT: (throw $e-i32 ;; CHECK-BIN-NEXT: (i32.const 0) @@ -406,7 +406,7 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $catch-and-catch-all-together (type $0) - ;; CHECK-BIN-NEXT: (try $label$3 + ;; CHECK-BIN-NEXT: (try ;; CHECK-BIN-NEXT: (do ;; CHECK-BIN-NEXT: (throw $e-i32 ;; CHECK-BIN-NEXT: (i32.const 0) @@ -490,9 +490,9 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $nested-try-catch (type $0) - ;; CHECK-BIN-NEXT: (try $label$9 + ;; CHECK-BIN-NEXT: (try ;; CHECK-BIN-NEXT: (do - ;; CHECK-BIN-NEXT: (try $label$4 + ;; CHECK-BIN-NEXT: (try ;; CHECK-BIN-NEXT: (do ;; CHECK-BIN-NEXT: (throw $e-i32 ;; CHECK-BIN-NEXT: (i32.const 0) @@ -514,7 +514,7 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (catch_all - ;; CHECK-BIN-NEXT: (try $label$8 + ;; CHECK-BIN-NEXT: (try ;; CHECK-BIN-NEXT: (do ;; CHECK-BIN-NEXT: (throw $e-i32 ;; CHECK-BIN-NEXT: (i32.const 0) @@ -572,13 +572,14 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $catchless-delegateless-try (type $0) - ;; CHECK-BIN-NEXT: (try $label$3 + ;; CHECK-BIN-NEXT: (try ;; CHECK-BIN-NEXT: (do ;; CHECK-BIN-NEXT: (throw $e-i32 ;; CHECK-BIN-NEXT: (i32.const 0) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (unreachable) ;; CHECK-BIN-NEXT: ) (func $catchless-delegateless-try (try @@ -610,21 +611,19 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $inner-delegate-target-outer-catch (type $0) - ;; CHECK-BIN-NEXT: (try $label$9 + ;; CHECK-BIN-NEXT: (try $label ;; CHECK-BIN-NEXT: (do - ;; CHECK-BIN-NEXT: (block $label$1 - ;; CHECK-BIN-NEXT: (try $label$4 - ;; CHECK-BIN-NEXT: (do - ;; CHECK-BIN-NEXT: (call $foo) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (delegate $label$9) + ;; CHECK-BIN-NEXT: (try + ;; CHECK-BIN-NEXT: (do + ;; CHECK-BIN-NEXT: (call $foo) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (try $label$7 - ;; CHECK-BIN-NEXT: (do - ;; CHECK-BIN-NEXT: (call $foo) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (delegate $label$9) + ;; CHECK-BIN-NEXT: (delegate $label) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (try + ;; CHECK-BIN-NEXT: (do + ;; CHECK-BIN-NEXT: (call $foo) ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (delegate $label) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (catch_all @@ -680,26 +679,24 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $branch-and-delegate-target-same-try-label (type $0) - ;; CHECK-BIN-NEXT: (block $label$1 - ;; CHECK-BIN-NEXT: (try $label$10 + ;; CHECK-BIN-NEXT: (block $block + ;; CHECK-BIN-NEXT: (try $label ;; CHECK-BIN-NEXT: (do - ;; CHECK-BIN-NEXT: (block $label$2 - ;; CHECK-BIN-NEXT: (try $label$5 - ;; CHECK-BIN-NEXT: (do - ;; CHECK-BIN-NEXT: (br_if $label$1 - ;; CHECK-BIN-NEXT: (i32.const 1) - ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (try + ;; CHECK-BIN-NEXT: (do + ;; CHECK-BIN-NEXT: (br_if $block + ;; CHECK-BIN-NEXT: (i32.const 1) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (delegate $label$10) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (try $label$8 - ;; CHECK-BIN-NEXT: (do - ;; CHECK-BIN-NEXT: (br_if $label$1 - ;; CHECK-BIN-NEXT: (i32.const 1) - ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (delegate $label) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (try + ;; CHECK-BIN-NEXT: (do + ;; CHECK-BIN-NEXT: (br_if $block + ;; CHECK-BIN-NEXT: (i32.const 1) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (delegate $label$10) ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (delegate $label) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (catch_all @@ -747,15 +744,13 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $inner-delegate-target-outer-delegate (type $0) - ;; CHECK-BIN-NEXT: (try $label$6 + ;; CHECK-BIN-NEXT: (try $label ;; CHECK-BIN-NEXT: (do - ;; CHECK-BIN-NEXT: (block $label$1 - ;; CHECK-BIN-NEXT: (try $label$4 - ;; CHECK-BIN-NEXT: (do - ;; CHECK-BIN-NEXT: (call $foo) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (delegate $label$6) + ;; CHECK-BIN-NEXT: (try + ;; CHECK-BIN-NEXT: (do + ;; CHECK-BIN-NEXT: (call $foo) ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (delegate $label) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (delegate 0) @@ -788,7 +783,7 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $empty-catch-body (type $0) - ;; CHECK-BIN-NEXT: (try $label$3 + ;; CHECK-BIN-NEXT: (try ;; CHECK-BIN-NEXT: (do ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) @@ -822,7 +817,7 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $try-catch-rethrow (type $0) - ;; CHECK-BIN-NEXT: (try $label$3 + ;; CHECK-BIN-NEXT: (try $label ;; CHECK-BIN-NEXT: (do ;; CHECK-BIN-NEXT: (call $foo) ;; CHECK-BIN-NEXT: ) @@ -830,10 +825,10 @@ ;; CHECK-BIN-NEXT: (drop ;; CHECK-BIN-NEXT: (pop i32) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (rethrow $label$3) + ;; CHECK-BIN-NEXT: (rethrow $label) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (catch_all - ;; CHECK-BIN-NEXT: (rethrow $label$3) + ;; CHECK-BIN-NEXT: (rethrow $label) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -872,8 +867,8 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $branch-and-rethrow-target-same-try-label (type $0) - ;; CHECK-BIN-NEXT: (block $label$1 - ;; CHECK-BIN-NEXT: (try $label$4 + ;; CHECK-BIN-NEXT: (block $block + ;; CHECK-BIN-NEXT: (try $label ;; CHECK-BIN-NEXT: (do ;; CHECK-BIN-NEXT: (call $foo) ;; CHECK-BIN-NEXT: ) @@ -881,10 +876,10 @@ ;; CHECK-BIN-NEXT: (drop ;; CHECK-BIN-NEXT: (pop i32) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (rethrow $label$4) + ;; CHECK-BIN-NEXT: (rethrow $label) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (catch_all - ;; CHECK-BIN-NEXT: (br $label$1) + ;; CHECK-BIN-NEXT: (br $block) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -933,12 +928,12 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $nested-rethrow (type $0) - ;; CHECK-BIN-NEXT: (try $label$6 + ;; CHECK-BIN-NEXT: (try $label ;; CHECK-BIN-NEXT: (do ;; CHECK-BIN-NEXT: (call $foo) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (catch_all - ;; CHECK-BIN-NEXT: (try $label$5 + ;; CHECK-BIN-NEXT: (try ;; CHECK-BIN-NEXT: (do ;; CHECK-BIN-NEXT: (call $foo) ;; CHECK-BIN-NEXT: ) @@ -946,10 +941,10 @@ ;; CHECK-BIN-NEXT: (drop ;; CHECK-BIN-NEXT: (pop i32) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (rethrow $label$6) + ;; CHECK-BIN-NEXT: (rethrow $label) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (catch_all - ;; CHECK-BIN-NEXT: (rethrow $label$6) + ;; CHECK-BIN-NEXT: (rethrow $label) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -1006,12 +1001,12 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $rnested-rethrow-with-interleaving-block (type $0) - ;; CHECK-BIN-NEXT: (try $label$7 + ;; CHECK-BIN-NEXT: (try $label ;; CHECK-BIN-NEXT: (do ;; CHECK-BIN-NEXT: (call $foo) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (catch_all - ;; CHECK-BIN-NEXT: (try $label$6 + ;; CHECK-BIN-NEXT: (try ;; CHECK-BIN-NEXT: (do ;; CHECK-BIN-NEXT: (call $foo) ;; CHECK-BIN-NEXT: ) @@ -1019,12 +1014,13 @@ ;; CHECK-BIN-NEXT: (drop ;; CHECK-BIN-NEXT: (pop i32) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (block $label$5 - ;; CHECK-BIN-NEXT: (rethrow $label$7) + ;; CHECK-BIN-NEXT: (block + ;; CHECK-BIN-NEXT: (rethrow $label) ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (unreachable) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (catch_all - ;; CHECK-BIN-NEXT: (rethrow $label$7) + ;; CHECK-BIN-NEXT: (rethrow $label) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -1090,14 +1086,14 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $rethrow-within-nested-try-part (type $0) - ;; CHECK-BIN-NEXT: (try $label$6 + ;; CHECK-BIN-NEXT: (try $label ;; CHECK-BIN-NEXT: (do ;; CHECK-BIN-NEXT: (call $foo) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (catch_all - ;; CHECK-BIN-NEXT: (try $label$5 + ;; CHECK-BIN-NEXT: (try ;; CHECK-BIN-NEXT: (do - ;; CHECK-BIN-NEXT: (rethrow $label$6) + ;; CHECK-BIN-NEXT: (rethrow $label) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (catch_all ;; CHECK-BIN-NEXT: (nop) @@ -1105,14 +1101,14 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (try $label$12 + ;; CHECK-BIN-NEXT: (try $label0 ;; CHECK-BIN-NEXT: (do ;; CHECK-BIN-NEXT: (call $foo) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (catch_all - ;; CHECK-BIN-NEXT: (try $label$11 + ;; CHECK-BIN-NEXT: (try ;; CHECK-BIN-NEXT: (do - ;; CHECK-BIN-NEXT: (rethrow $label$12) + ;; CHECK-BIN-NEXT: (rethrow $label0) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (catch_all ;; CHECK-BIN-NEXT: (nop) @@ -1172,7 +1168,7 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $pop-within-if-condition (type $0) - ;; CHECK-BIN-NEXT: (try $label$5 + ;; CHECK-BIN-NEXT: (try ;; CHECK-BIN-NEXT: (do ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) @@ -1224,7 +1220,7 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $pop-can-be-supertype (type $0) - ;; CHECK-BIN-NEXT: (try $label$3 + ;; CHECK-BIN-NEXT: (try ;; CHECK-BIN-NEXT: (do ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) @@ -1261,20 +1257,20 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $catchless-try-with-inner-delegate (type $0) - ;; CHECK-BIN-NEXT: (try $label$6 + ;; CHECK-BIN-NEXT: (try $label ;; CHECK-BIN-NEXT: (do - ;; CHECK-BIN-NEXT: (block $label$1 - ;; CHECK-BIN-NEXT: (try $label$4 - ;; CHECK-BIN-NEXT: (do - ;; CHECK-BIN-NEXT: (throw $e-i32 - ;; CHECK-BIN-NEXT: (i32.const 0) - ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (try + ;; CHECK-BIN-NEXT: (do + ;; CHECK-BIN-NEXT: (throw $e-i32 + ;; CHECK-BIN-NEXT: (i32.const 0) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (delegate $label$6) ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (delegate $label) ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (unreachable) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (unreachable) ;; CHECK-BIN-NEXT: ) (func $catchless-try-with-inner-delegate (try $label$0 @@ -1305,10 +1301,10 @@ ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $nested-delegate-within-block (type $0) - ;; CHECK-BIN-NEXT: (block $label$1 - ;; CHECK-BIN-NEXT: (block $label$2 + ;; CHECK-BIN-NEXT: (block + ;; CHECK-BIN-NEXT: (block ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (try $label$5 + ;; CHECK-BIN-NEXT: (try ;; CHECK-BIN-NEXT: (do ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) @@ -1359,7 +1355,7 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $2 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (try $label$3 +;; CHECK-BIN-NODEBUG-NEXT: (try ;; CHECK-BIN-NODEBUG-NEXT: (do ;; CHECK-BIN-NODEBUG-NEXT: (throw $tag$0 ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0) @@ -1376,9 +1372,9 @@ ;; CHECK-BIN-NODEBUG: (func $3 (type $0) ;; CHECK-BIN-NODEBUG-NEXT: (local $0 i32) ;; CHECK-BIN-NODEBUG-NEXT: (local $1 i64) -;; CHECK-BIN-NODEBUG-NEXT: (local $2 (tuple i32 i64)) -;; CHECK-BIN-NODEBUG-NEXT: (local $3 i32) -;; CHECK-BIN-NODEBUG-NEXT: (try $label$3 +;; CHECK-BIN-NODEBUG-NEXT: (local $scratch (tuple i32 i64)) +;; CHECK-BIN-NODEBUG-NEXT: (local $scratch_3 i32) +;; CHECK-BIN-NODEBUG-NEXT: (try ;; CHECK-BIN-NODEBUG-NEXT: (do ;; CHECK-BIN-NODEBUG-NEXT: (throw $tag$2 ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0) @@ -1386,22 +1382,21 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (catch $tag$2 -;; CHECK-BIN-NODEBUG-NEXT: (local.set $2 -;; CHECK-BIN-NODEBUG-NEXT: (pop (tuple i32 i64)) -;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (local.set $0 ;; CHECK-BIN-NODEBUG-NEXT: (block (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (local.set $3 +;; CHECK-BIN-NODEBUG-NEXT: (local.set $scratch_3 ;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 2 0 -;; CHECK-BIN-NODEBUG-NEXT: (local.get $2) +;; CHECK-BIN-NODEBUG-NEXT: (local.tee $scratch +;; CHECK-BIN-NODEBUG-NEXT: (pop (tuple i32 i64)) +;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (local.set $1 ;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 2 1 -;; CHECK-BIN-NODEBUG-NEXT: (local.get $2) +;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (local.get $3) +;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch_3) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop @@ -1412,23 +1407,24 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $4 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 -;; CHECK-BIN-NODEBUG-NEXT: (try $label$4 +;; CHECK-BIN-NODEBUG-NEXT: (block $block +;; CHECK-BIN-NODEBUG-NEXT: (try ;; CHECK-BIN-NODEBUG-NEXT: (do -;; CHECK-BIN-NODEBUG-NEXT: (br $label$1) +;; CHECK-BIN-NODEBUG-NEXT: (br $block) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (catch $tag$0 ;; CHECK-BIN-NODEBUG-NEXT: (drop ;; CHECK-BIN-NODEBUG-NEXT: (pop i32) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (br $label$1) +;; CHECK-BIN-NODEBUG-NEXT: (br $block) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (unreachable) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $5 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (try $label$3 +;; CHECK-BIN-NODEBUG-NEXT: (try ;; CHECK-BIN-NODEBUG-NEXT: (do ;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -1441,7 +1437,7 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $6 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (try $label$3 +;; CHECK-BIN-NODEBUG-NEXT: (try ;; CHECK-BIN-NODEBUG-NEXT: (do ;; CHECK-BIN-NODEBUG-NEXT: (call $0) ;; CHECK-BIN-NODEBUG-NEXT: (call $1) @@ -1457,7 +1453,7 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $7 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (try $label$3 +;; CHECK-BIN-NODEBUG-NEXT: (try ;; CHECK-BIN-NODEBUG-NEXT: (do ;; CHECK-BIN-NODEBUG-NEXT: (throw $tag$0 ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0) @@ -1477,7 +1473,7 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $8 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (try $label$3 +;; CHECK-BIN-NODEBUG-NEXT: (try ;; CHECK-BIN-NODEBUG-NEXT: (do ;; CHECK-BIN-NODEBUG-NEXT: (throw $tag$0 ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0) @@ -1490,7 +1486,7 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $9 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (try $label$3 +;; CHECK-BIN-NODEBUG-NEXT: (try ;; CHECK-BIN-NODEBUG-NEXT: (do ;; CHECK-BIN-NODEBUG-NEXT: (throw $tag$0 ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0) @@ -1514,9 +1510,9 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $10 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (try $label$9 +;; CHECK-BIN-NODEBUG-NEXT: (try ;; CHECK-BIN-NODEBUG-NEXT: (do -;; CHECK-BIN-NODEBUG-NEXT: (try $label$4 +;; CHECK-BIN-NODEBUG-NEXT: (try ;; CHECK-BIN-NODEBUG-NEXT: (do ;; CHECK-BIN-NODEBUG-NEXT: (throw $tag$0 ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0) @@ -1538,7 +1534,7 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (catch_all -;; CHECK-BIN-NODEBUG-NEXT: (try $label$8 +;; CHECK-BIN-NODEBUG-NEXT: (try ;; CHECK-BIN-NODEBUG-NEXT: (do ;; CHECK-BIN-NODEBUG-NEXT: (throw $tag$0 ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0) @@ -1558,31 +1554,30 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $11 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (try $label$3 +;; CHECK-BIN-NODEBUG-NEXT: (try ;; CHECK-BIN-NODEBUG-NEXT: (do ;; CHECK-BIN-NODEBUG-NEXT: (throw $tag$0 ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (unreachable) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $12 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (try $label$9 +;; CHECK-BIN-NODEBUG-NEXT: (try $label ;; CHECK-BIN-NODEBUG-NEXT: (do -;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 -;; CHECK-BIN-NODEBUG-NEXT: (try $label$4 -;; CHECK-BIN-NODEBUG-NEXT: (do -;; CHECK-BIN-NODEBUG-NEXT: (call $0) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (delegate $label$9) +;; CHECK-BIN-NODEBUG-NEXT: (try +;; CHECK-BIN-NODEBUG-NEXT: (do +;; CHECK-BIN-NODEBUG-NEXT: (call $0) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (try $label$7 -;; CHECK-BIN-NODEBUG-NEXT: (do -;; CHECK-BIN-NODEBUG-NEXT: (call $0) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (delegate $label$9) +;; CHECK-BIN-NODEBUG-NEXT: (delegate $label) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (try +;; CHECK-BIN-NODEBUG-NEXT: (do +;; CHECK-BIN-NODEBUG-NEXT: (call $0) ;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (delegate $label) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (catch_all @@ -1592,26 +1587,24 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $13 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 -;; CHECK-BIN-NODEBUG-NEXT: (try $label$10 +;; CHECK-BIN-NODEBUG-NEXT: (block $block +;; CHECK-BIN-NODEBUG-NEXT: (try $label ;; CHECK-BIN-NODEBUG-NEXT: (do -;; CHECK-BIN-NODEBUG-NEXT: (block $label$2 -;; CHECK-BIN-NODEBUG-NEXT: (try $label$5 -;; CHECK-BIN-NODEBUG-NEXT: (do -;; CHECK-BIN-NODEBUG-NEXT: (br_if $label$1 -;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1) -;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (try +;; CHECK-BIN-NODEBUG-NEXT: (do +;; CHECK-BIN-NODEBUG-NEXT: (br_if $block +;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (delegate $label$10) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (try $label$8 -;; CHECK-BIN-NODEBUG-NEXT: (do -;; CHECK-BIN-NODEBUG-NEXT: (br_if $label$1 -;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1) -;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (delegate $label) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (try +;; CHECK-BIN-NODEBUG-NEXT: (do +;; CHECK-BIN-NODEBUG-NEXT: (br_if $block +;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (delegate $label$10) ;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (delegate $label) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (catch_all @@ -1622,15 +1615,13 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $14 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (try $label$6 +;; CHECK-BIN-NODEBUG-NEXT: (try $label ;; CHECK-BIN-NODEBUG-NEXT: (do -;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 -;; CHECK-BIN-NODEBUG-NEXT: (try $label$4 -;; CHECK-BIN-NODEBUG-NEXT: (do -;; CHECK-BIN-NODEBUG-NEXT: (call $0) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (delegate $label$6) +;; CHECK-BIN-NODEBUG-NEXT: (try +;; CHECK-BIN-NODEBUG-NEXT: (do +;; CHECK-BIN-NODEBUG-NEXT: (call $0) ;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (delegate $label) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (delegate 0) @@ -1638,7 +1629,7 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $15 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (try $label$3 +;; CHECK-BIN-NODEBUG-NEXT: (try ;; CHECK-BIN-NODEBUG-NEXT: (do ;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -1649,7 +1640,7 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $16 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (try $label$3 +;; CHECK-BIN-NODEBUG-NEXT: (try $label ;; CHECK-BIN-NODEBUG-NEXT: (do ;; CHECK-BIN-NODEBUG-NEXT: (call $0) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -1657,17 +1648,17 @@ ;; CHECK-BIN-NODEBUG-NEXT: (drop ;; CHECK-BIN-NODEBUG-NEXT: (pop i32) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (rethrow $label$3) +;; CHECK-BIN-NODEBUG-NEXT: (rethrow $label) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (catch_all -;; CHECK-BIN-NODEBUG-NEXT: (rethrow $label$3) +;; CHECK-BIN-NODEBUG-NEXT: (rethrow $label) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $17 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 -;; CHECK-BIN-NODEBUG-NEXT: (try $label$4 +;; CHECK-BIN-NODEBUG-NEXT: (block $block +;; CHECK-BIN-NODEBUG-NEXT: (try $label ;; CHECK-BIN-NODEBUG-NEXT: (do ;; CHECK-BIN-NODEBUG-NEXT: (call $0) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -1675,22 +1666,22 @@ ;; CHECK-BIN-NODEBUG-NEXT: (drop ;; CHECK-BIN-NODEBUG-NEXT: (pop i32) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (rethrow $label$4) +;; CHECK-BIN-NODEBUG-NEXT: (rethrow $label) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (catch_all -;; CHECK-BIN-NODEBUG-NEXT: (br $label$1) +;; CHECK-BIN-NODEBUG-NEXT: (br $block) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $18 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (try $label$6 +;; CHECK-BIN-NODEBUG-NEXT: (try $label ;; CHECK-BIN-NODEBUG-NEXT: (do ;; CHECK-BIN-NODEBUG-NEXT: (call $0) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (catch_all -;; CHECK-BIN-NODEBUG-NEXT: (try $label$5 +;; CHECK-BIN-NODEBUG-NEXT: (try ;; CHECK-BIN-NODEBUG-NEXT: (do ;; CHECK-BIN-NODEBUG-NEXT: (call $0) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -1698,10 +1689,10 @@ ;; CHECK-BIN-NODEBUG-NEXT: (drop ;; CHECK-BIN-NODEBUG-NEXT: (pop i32) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (rethrow $label$6) +;; CHECK-BIN-NODEBUG-NEXT: (rethrow $label) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (catch_all -;; CHECK-BIN-NODEBUG-NEXT: (rethrow $label$6) +;; CHECK-BIN-NODEBUG-NEXT: (rethrow $label) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -1709,12 +1700,12 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $19 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (try $label$7 +;; CHECK-BIN-NODEBUG-NEXT: (try $label ;; CHECK-BIN-NODEBUG-NEXT: (do ;; CHECK-BIN-NODEBUG-NEXT: (call $0) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (catch_all -;; CHECK-BIN-NODEBUG-NEXT: (try $label$6 +;; CHECK-BIN-NODEBUG-NEXT: (try ;; CHECK-BIN-NODEBUG-NEXT: (do ;; CHECK-BIN-NODEBUG-NEXT: (call $0) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -1722,12 +1713,13 @@ ;; CHECK-BIN-NODEBUG-NEXT: (drop ;; CHECK-BIN-NODEBUG-NEXT: (pop i32) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (block $label$5 -;; CHECK-BIN-NODEBUG-NEXT: (rethrow $label$7) +;; CHECK-BIN-NODEBUG-NEXT: (block +;; CHECK-BIN-NODEBUG-NEXT: (rethrow $label) ;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (unreachable) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (catch_all -;; CHECK-BIN-NODEBUG-NEXT: (rethrow $label$7) +;; CHECK-BIN-NODEBUG-NEXT: (rethrow $label) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -1735,14 +1727,14 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $20 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (try $label$6 +;; CHECK-BIN-NODEBUG-NEXT: (try $label ;; CHECK-BIN-NODEBUG-NEXT: (do ;; CHECK-BIN-NODEBUG-NEXT: (call $0) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (catch_all -;; CHECK-BIN-NODEBUG-NEXT: (try $label$5 +;; CHECK-BIN-NODEBUG-NEXT: (try ;; CHECK-BIN-NODEBUG-NEXT: (do -;; CHECK-BIN-NODEBUG-NEXT: (rethrow $label$6) +;; CHECK-BIN-NODEBUG-NEXT: (rethrow $label) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (catch_all ;; CHECK-BIN-NODEBUG-NEXT: (nop) @@ -1750,14 +1742,14 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (try $label$12 +;; CHECK-BIN-NODEBUG-NEXT: (try $label0 ;; CHECK-BIN-NODEBUG-NEXT: (do ;; CHECK-BIN-NODEBUG-NEXT: (call $0) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (catch_all -;; CHECK-BIN-NODEBUG-NEXT: (try $label$11 +;; CHECK-BIN-NODEBUG-NEXT: (try ;; CHECK-BIN-NODEBUG-NEXT: (do -;; CHECK-BIN-NODEBUG-NEXT: (rethrow $label$12) +;; CHECK-BIN-NODEBUG-NEXT: (rethrow $label0) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (catch_all ;; CHECK-BIN-NODEBUG-NEXT: (nop) @@ -1768,7 +1760,7 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $21 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (try $label$5 +;; CHECK-BIN-NODEBUG-NEXT: (try ;; CHECK-BIN-NODEBUG-NEXT: (do ;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -1789,7 +1781,7 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $22 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (try $label$3 +;; CHECK-BIN-NODEBUG-NEXT: (try ;; CHECK-BIN-NODEBUG-NEXT: (do ;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -1802,27 +1794,27 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $23 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (try $label$6 +;; CHECK-BIN-NODEBUG-NEXT: (try $label ;; CHECK-BIN-NODEBUG-NEXT: (do -;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 -;; CHECK-BIN-NODEBUG-NEXT: (try $label$4 -;; CHECK-BIN-NODEBUG-NEXT: (do -;; CHECK-BIN-NODEBUG-NEXT: (throw $tag$0 -;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0) -;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (try +;; CHECK-BIN-NODEBUG-NEXT: (do +;; CHECK-BIN-NODEBUG-NEXT: (throw $tag$0 +;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (delegate $label$6) ;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (delegate $label) ;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (unreachable) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (unreachable) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $24 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 -;; CHECK-BIN-NODEBUG-NEXT: (block $label$2 +;; CHECK-BIN-NODEBUG-NEXT: (block +;; CHECK-BIN-NODEBUG-NEXT: (block ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (try $label$5 +;; CHECK-BIN-NODEBUG-NEXT: (try ;; CHECK-BIN-NODEBUG-NEXT: (do ;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) diff --git a/test/lit/basic/exception-handling.wast b/test/lit/basic/exception-handling.wast index 05e7c0e31f3..1aa95c98bfb 100644 --- a/test/lit/basic/exception-handling.wast +++ b/test/lit/basic/exception-handling.wast @@ -151,6 +151,7 @@ ;; CHECK-BIN-NEXT: (try_table ;; CHECK-BIN-NEXT: (throw $e-empty) ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (unreachable) ;; CHECK-BIN-NEXT: ) (func $catchless-try-table (try_table) @@ -169,12 +170,13 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $simple-try-table-and-throw (type $4) (result i32) - ;; CHECK-BIN-NEXT: (block $label$1 (result i32) - ;; CHECK-BIN-NEXT: (try_table (catch $e-i32 $label$1) + ;; CHECK-BIN-NEXT: (block $block (result i32) + ;; CHECK-BIN-NEXT: (try_table (catch $e-i32 $block) ;; CHECK-BIN-NEXT: (throw $e-i32 ;; CHECK-BIN-NEXT: (i32.const 0) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (unreachable) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) (func $simple-try-table-and-throw (result i32) @@ -198,12 +200,13 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $try-table-and-throw-ref (type $0) ;; CHECK-BIN-NEXT: (throw_ref - ;; CHECK-BIN-NEXT: (block $label$1 (result exnref) - ;; CHECK-BIN-NEXT: (try_table (catch_all_ref $label$1) + ;; CHECK-BIN-NEXT: (block $block (result exnref) + ;; CHECK-BIN-NEXT: (try_table (catch_all_ref $block) ;; CHECK-BIN-NEXT: (throw $e-i64 ;; CHECK-BIN-NEXT: (i64.const 0) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (unreachable) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -237,65 +240,64 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $try-table-multivalue-tag (type $0) - ;; CHECK-BIN-NEXT: (local $0 (tuple i32 i64)) - ;; CHECK-BIN-NEXT: (local $1 i32) - ;; CHECK-BIN-NEXT: (local $2 (tuple i32 i64 exnref)) - ;; CHECK-BIN-NEXT: (local $3 i64) - ;; CHECK-BIN-NEXT: (local $4 i32) - ;; CHECK-BIN-NEXT: (block $label$1 - ;; CHECK-BIN-NEXT: (local.set $2 - ;; CHECK-BIN-NEXT: (block $label$2 (type $2) (result i32 i64 exnref) - ;; CHECK-BIN-NEXT: (local.set $0 - ;; CHECK-BIN-NEXT: (block $label$3 (type $1) (result i32 i64) - ;; CHECK-BIN-NEXT: (try_table (catch $e-i32-i64 $label$3) (catch_ref $e-i32-i64 $label$2) - ;; CHECK-BIN-NEXT: (throw $e-i32-i64 - ;; CHECK-BIN-NEXT: (i32.const 0) - ;; CHECK-BIN-NEXT: (i64.const 0) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block (result i32) - ;; CHECK-BIN-NEXT: (local.set $1 - ;; CHECK-BIN-NEXT: (tuple.extract 2 0 - ;; CHECK-BIN-NEXT: (local.get $0) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (tuple.extract 2 1 - ;; CHECK-BIN-NEXT: (local.get $0) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (local.get $1) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (br $label$1) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (local $scratch (tuple i32 i64)) + ;; CHECK-BIN-NEXT: (local $scratch_1 i32) + ;; CHECK-BIN-NEXT: (local $scratch_2 (tuple i32 i64 exnref)) + ;; CHECK-BIN-NEXT: (local $scratch_3 i64) + ;; CHECK-BIN-NEXT: (local $scratch_4 i32) + ;; CHECK-BIN-NEXT: (block $block1 ;; CHECK-BIN-NEXT: (drop ;; CHECK-BIN-NEXT: (block (result i32) - ;; CHECK-BIN-NEXT: (local.set $4 + ;; CHECK-BIN-NEXT: (local.set $scratch_4 ;; CHECK-BIN-NEXT: (tuple.extract 3 0 - ;; CHECK-BIN-NEXT: (local.get $2) + ;; CHECK-BIN-NEXT: (local.tee $scratch_2 + ;; CHECK-BIN-NEXT: (block $block0 (type $2) (result i32 i64 exnref) + ;; CHECK-BIN-NEXT: (drop + ;; CHECK-BIN-NEXT: (block (result i32) + ;; CHECK-BIN-NEXT: (local.set $scratch_1 + ;; CHECK-BIN-NEXT: (tuple.extract 2 0 + ;; CHECK-BIN-NEXT: (local.tee $scratch + ;; CHECK-BIN-NEXT: (block $block (type $1) (result i32 i64) + ;; CHECK-BIN-NEXT: (try_table (catch $e-i32-i64 $block) (catch_ref $e-i32-i64 $block0) + ;; CHECK-BIN-NEXT: (throw $e-i32-i64 + ;; CHECK-BIN-NEXT: (i32.const 0) + ;; CHECK-BIN-NEXT: (i64.const 0) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (unreachable) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (drop + ;; CHECK-BIN-NEXT: (tuple.extract 2 1 + ;; CHECK-BIN-NEXT: (local.get $scratch) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (local.get $scratch_1) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (br $block1) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop ;; CHECK-BIN-NEXT: (block (result i64) - ;; CHECK-BIN-NEXT: (local.set $3 + ;; CHECK-BIN-NEXT: (local.set $scratch_3 ;; CHECK-BIN-NEXT: (tuple.extract 3 1 - ;; CHECK-BIN-NEXT: (local.get $2) + ;; CHECK-BIN-NEXT: (local.get $scratch_2) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop ;; CHECK-BIN-NEXT: (tuple.extract 3 2 - ;; CHECK-BIN-NEXT: (local.get $2) + ;; CHECK-BIN-NEXT: (local.get $scratch_2) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (local.get $3) + ;; CHECK-BIN-NEXT: (local.get $scratch_3) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (local.get $4) + ;; CHECK-BIN-NEXT: (local.get $scratch_4) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -342,25 +344,25 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $try-table-all-catch-clauses-empty-tag (type $0) - ;; CHECK-BIN-NEXT: (block $label$1 - ;; CHECK-BIN-NEXT: (block $label$2 + ;; CHECK-BIN-NEXT: (block $block3 + ;; CHECK-BIN-NEXT: (block $block ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $label$3 (result exnref) - ;; CHECK-BIN-NEXT: (block $label$4 + ;; CHECK-BIN-NEXT: (block $block0 (result exnref) + ;; CHECK-BIN-NEXT: (block $block1 ;; CHECK-BIN-NEXT: (throw_ref - ;; CHECK-BIN-NEXT: (block $label$5 (result exnref) - ;; CHECK-BIN-NEXT: (try_table (catch $e-empty $label$2) (catch_ref $e-empty $label$3) (catch_all $label$4) (catch_all_ref $label$5) + ;; CHECK-BIN-NEXT: (block $block2 (result exnref) + ;; CHECK-BIN-NEXT: (try_table (catch $e-empty $block) (catch_ref $e-empty $block0) (catch_all $block1) (catch_all_ref $block2) ;; CHECK-BIN-NEXT: (call $foo) ;; CHECK-BIN-NEXT: (call $foo) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (br $label$1) + ;; CHECK-BIN-NEXT: (br $block3) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (br $label$1) + ;; CHECK-BIN-NEXT: (br $block3) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (br $label$1) + ;; CHECK-BIN-NEXT: (br $block3) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -419,43 +421,42 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $try-table-all-catch-clauses-i32-tag (type $0) - ;; CHECK-BIN-NEXT: (local $0 (tuple i32 exnref)) - ;; CHECK-BIN-NEXT: (local $1 i32) - ;; CHECK-BIN-NEXT: (block $label$1 + ;; CHECK-BIN-NEXT: (local $scratch (tuple i32 exnref)) + ;; CHECK-BIN-NEXT: (local $scratch_1 i32) + ;; CHECK-BIN-NEXT: (block $block3 ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $label$2 (result i32) - ;; CHECK-BIN-NEXT: (local.set $0 - ;; CHECK-BIN-NEXT: (block $label$3 (type $5) (result i32 exnref) - ;; CHECK-BIN-NEXT: (block $label$4 - ;; CHECK-BIN-NEXT: (throw_ref - ;; CHECK-BIN-NEXT: (block $label$5 (result exnref) - ;; CHECK-BIN-NEXT: (try_table (catch $e-i32 $label$2) (catch_ref $e-i32 $label$3) (catch_all $label$4) (catch_all_ref $label$5) - ;; CHECK-BIN-NEXT: (call $foo) - ;; CHECK-BIN-NEXT: (call $foo) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (br $label$1) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (br $label$1) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (block $block (result i32) ;; CHECK-BIN-NEXT: (drop ;; CHECK-BIN-NEXT: (block (result i32) - ;; CHECK-BIN-NEXT: (local.set $1 + ;; CHECK-BIN-NEXT: (local.set $scratch_1 ;; CHECK-BIN-NEXT: (tuple.extract 2 0 - ;; CHECK-BIN-NEXT: (local.get $0) + ;; CHECK-BIN-NEXT: (local.tee $scratch + ;; CHECK-BIN-NEXT: (block $block0 (type $5) (result i32 exnref) + ;; CHECK-BIN-NEXT: (block $block1 + ;; CHECK-BIN-NEXT: (throw_ref + ;; CHECK-BIN-NEXT: (block $block2 (result exnref) + ;; CHECK-BIN-NEXT: (try_table (catch $e-i32 $block) (catch_ref $e-i32 $block0) (catch_all $block1) (catch_all_ref $block2) + ;; CHECK-BIN-NEXT: (call $foo) + ;; CHECK-BIN-NEXT: (call $foo) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (br $block3) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (br $block3) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop ;; CHECK-BIN-NEXT: (tuple.extract 2 1 - ;; CHECK-BIN-NEXT: (local.get $0) + ;; CHECK-BIN-NEXT: (local.get $scratch) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (local.get $1) + ;; CHECK-BIN-NEXT: (local.get $scratch_1) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (br $label$1) + ;; CHECK-BIN-NEXT: (br $block3) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -517,71 +518,69 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $try-table-all-catch-clauses-multivalue-tag (type $0) - ;; CHECK-BIN-NEXT: (local $0 (tuple i32 i64 exnref)) - ;; CHECK-BIN-NEXT: (local $1 i64) - ;; CHECK-BIN-NEXT: (local $2 i32) - ;; CHECK-BIN-NEXT: (local $3 (tuple i32 i64)) - ;; CHECK-BIN-NEXT: (local $4 i32) - ;; CHECK-BIN-NEXT: (block $label$1 - ;; CHECK-BIN-NEXT: (local.set $3 - ;; CHECK-BIN-NEXT: (block $label$2 (type $1) (result i32 i64) - ;; CHECK-BIN-NEXT: (local.set $0 - ;; CHECK-BIN-NEXT: (block $label$3 (type $2) (result i32 i64 exnref) - ;; CHECK-BIN-NEXT: (block $label$4 - ;; CHECK-BIN-NEXT: (throw_ref - ;; CHECK-BIN-NEXT: (block $label$5 (result exnref) - ;; CHECK-BIN-NEXT: (try_table (catch $e-i32-i64 $label$2) (catch_ref $e-i32-i64 $label$3) (catch_all $label$4) (catch_all_ref $label$5) - ;; CHECK-BIN-NEXT: (call $foo) - ;; CHECK-BIN-NEXT: (call $foo) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (br $label$1) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (br $label$1) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block (result i32) - ;; CHECK-BIN-NEXT: (local.set $2 - ;; CHECK-BIN-NEXT: (tuple.extract 3 0 - ;; CHECK-BIN-NEXT: (local.get $0) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block (result i64) - ;; CHECK-BIN-NEXT: (local.set $1 - ;; CHECK-BIN-NEXT: (tuple.extract 3 1 - ;; CHECK-BIN-NEXT: (local.get $0) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (local $scratch (tuple i32 i64 exnref)) + ;; CHECK-BIN-NEXT: (local $scratch_1 i64) + ;; CHECK-BIN-NEXT: (local $scratch_2 i32) + ;; CHECK-BIN-NEXT: (local $scratch_3 (tuple i32 i64)) + ;; CHECK-BIN-NEXT: (local $scratch_4 i32) + ;; CHECK-BIN-NEXT: (block $block3 + ;; CHECK-BIN-NEXT: (drop + ;; CHECK-BIN-NEXT: (block (result i32) + ;; CHECK-BIN-NEXT: (local.set $scratch_4 + ;; CHECK-BIN-NEXT: (tuple.extract 2 0 + ;; CHECK-BIN-NEXT: (local.tee $scratch_3 + ;; CHECK-BIN-NEXT: (block $block (type $1) (result i32 i64) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (tuple.extract 3 2 - ;; CHECK-BIN-NEXT: (local.get $0) + ;; CHECK-BIN-NEXT: (block (result i32) + ;; CHECK-BIN-NEXT: (local.set $scratch_2 + ;; CHECK-BIN-NEXT: (tuple.extract 3 0 + ;; CHECK-BIN-NEXT: (local.tee $scratch + ;; CHECK-BIN-NEXT: (block $block0 (type $2) (result i32 i64 exnref) + ;; CHECK-BIN-NEXT: (block $block1 + ;; CHECK-BIN-NEXT: (throw_ref + ;; CHECK-BIN-NEXT: (block $block2 (result exnref) + ;; CHECK-BIN-NEXT: (try_table (catch $e-i32-i64 $block) (catch_ref $e-i32-i64 $block0) (catch_all $block1) (catch_all_ref $block2) + ;; CHECK-BIN-NEXT: (call $foo) + ;; CHECK-BIN-NEXT: (call $foo) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (br $block3) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (br $block3) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (drop + ;; CHECK-BIN-NEXT: (block (result i64) + ;; CHECK-BIN-NEXT: (local.set $scratch_1 + ;; CHECK-BIN-NEXT: (tuple.extract 3 1 + ;; CHECK-BIN-NEXT: (local.get $scratch) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (drop + ;; CHECK-BIN-NEXT: (tuple.extract 3 2 + ;; CHECK-BIN-NEXT: (local.get $scratch) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (local.get $scratch_1) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (local.get $scratch_2) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (local.get $1) + ;; CHECK-BIN-NEXT: (br $block3) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (local.get $2) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (br $label$1) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block (result i32) - ;; CHECK-BIN-NEXT: (local.set $4 - ;; CHECK-BIN-NEXT: (tuple.extract 2 0 - ;; CHECK-BIN-NEXT: (local.get $3) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop ;; CHECK-BIN-NEXT: (tuple.extract 2 1 - ;; CHECK-BIN-NEXT: (local.get $3) + ;; CHECK-BIN-NEXT: (local.get $scratch_3) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (local.get $4) + ;; CHECK-BIN-NEXT: (local.get $scratch_4) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -629,10 +628,10 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $try-table-with-label-and-br (type $4) (result i32) - ;; CHECK-BIN-NEXT: (block $label$1 (result i32) - ;; CHECK-BIN-NEXT: (block $label$2 (result i32) - ;; CHECK-BIN-NEXT: (try_table (result i32) (catch $e-i32 $label$1) - ;; CHECK-BIN-NEXT: (br $label$2 + ;; CHECK-BIN-NEXT: (block $block (result i32) + ;; CHECK-BIN-NEXT: (block $block0 (result i32) + ;; CHECK-BIN-NEXT: (try_table (result i32) (catch $e-i32 $block) + ;; CHECK-BIN-NEXT: (br $block0 ;; CHECK-BIN-NEXT: (i32.const 0) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -674,11 +673,11 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $nested-try-table (type $3) (result exnref) - ;; CHECK-BIN-NEXT: (block $label$1 (result exnref) + ;; CHECK-BIN-NEXT: (block $block (result exnref) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $label$2 (result i32) - ;; CHECK-BIN-NEXT: (try_table (catch_all_ref $label$1) - ;; CHECK-BIN-NEXT: (try_table (catch $e-i32 $label$2) + ;; CHECK-BIN-NEXT: (block $block0 (result i32) + ;; CHECK-BIN-NEXT: (try_table (catch_all_ref $block) + ;; CHECK-BIN-NEXT: (try_table (catch $e-i32 $block0) ;; CHECK-BIN-NEXT: (if ;; CHECK-BIN-NEXT: (i32.const 0) ;; CHECK-BIN-NEXT: (then @@ -692,8 +691,11 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (unreachable) ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (unreachable) ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (unreachable) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (ref.null noexn) @@ -785,238 +787,237 @@ ;; CHECK-BIN-NODEBUG-NEXT: (try_table ;; CHECK-BIN-NODEBUG-NEXT: (throw $tag$4) ;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (unreachable) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $3 (type $4) (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch $tag$0 $label$1) +;; CHECK-BIN-NODEBUG-NEXT: (block $block (result i32) +;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch $tag$0 $block) ;; CHECK-BIN-NODEBUG-NEXT: (throw $tag$0 ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (unreachable) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $4 (type $0) ;; CHECK-BIN-NODEBUG-NEXT: (throw_ref -;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 (result exnref) -;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch_all_ref $label$1) +;; CHECK-BIN-NODEBUG-NEXT: (block $block (result exnref) +;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch_all_ref $block) ;; CHECK-BIN-NODEBUG-NEXT: (throw $tag$1 ;; CHECK-BIN-NODEBUG-NEXT: (i64.const 0) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (unreachable) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $5 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (local $0 (tuple i32 i64)) -;; CHECK-BIN-NODEBUG-NEXT: (local $1 i32) -;; CHECK-BIN-NODEBUG-NEXT: (local $2 (tuple i32 i64 exnref)) -;; CHECK-BIN-NODEBUG-NEXT: (local $3 i64) -;; CHECK-BIN-NODEBUG-NEXT: (local $4 i32) -;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 -;; CHECK-BIN-NODEBUG-NEXT: (local.set $2 -;; CHECK-BIN-NODEBUG-NEXT: (block $label$2 (type $2) (result i32 i64 exnref) -;; CHECK-BIN-NODEBUG-NEXT: (local.set $0 -;; CHECK-BIN-NODEBUG-NEXT: (block $label$3 (type $1) (result i32 i64) -;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch $tag$2 $label$3) (catch_ref $tag$2 $label$2) -;; CHECK-BIN-NODEBUG-NEXT: (throw $tag$2 -;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0) -;; CHECK-BIN-NODEBUG-NEXT: (i64.const 0) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (local.set $1 -;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 2 0 -;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 2 1 -;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (local.get $1) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (br $label$1) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (local $scratch (tuple i32 i64)) +;; CHECK-BIN-NODEBUG-NEXT: (local $scratch_1 i32) +;; CHECK-BIN-NODEBUG-NEXT: (local $scratch_2 (tuple i32 i64 exnref)) +;; CHECK-BIN-NODEBUG-NEXT: (local $scratch_3 i64) +;; CHECK-BIN-NODEBUG-NEXT: (local $scratch_4 i32) +;; CHECK-BIN-NODEBUG-NEXT: (block $block1 ;; CHECK-BIN-NODEBUG-NEXT: (drop ;; CHECK-BIN-NODEBUG-NEXT: (block (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (local.set $4 +;; CHECK-BIN-NODEBUG-NEXT: (local.set $scratch_4 ;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 3 0 -;; CHECK-BIN-NODEBUG-NEXT: (local.get $2) +;; CHECK-BIN-NODEBUG-NEXT: (local.tee $scratch_2 +;; CHECK-BIN-NODEBUG-NEXT: (block $block0 (type $2) (result i32 i64 exnref) +;; CHECK-BIN-NODEBUG-NEXT: (drop +;; CHECK-BIN-NODEBUG-NEXT: (block (result i32) +;; CHECK-BIN-NODEBUG-NEXT: (local.set $scratch_1 +;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 2 0 +;; CHECK-BIN-NODEBUG-NEXT: (local.tee $scratch +;; CHECK-BIN-NODEBUG-NEXT: (block $block (type $1) (result i32 i64) +;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch $tag$2 $block) (catch_ref $tag$2 $block0) +;; CHECK-BIN-NODEBUG-NEXT: (throw $tag$2 +;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0) +;; CHECK-BIN-NODEBUG-NEXT: (i64.const 0) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (unreachable) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (drop +;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 2 1 +;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch_1) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (br $block1) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop ;; CHECK-BIN-NODEBUG-NEXT: (block (result i64) -;; CHECK-BIN-NODEBUG-NEXT: (local.set $3 +;; CHECK-BIN-NODEBUG-NEXT: (local.set $scratch_3 ;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 3 1 -;; CHECK-BIN-NODEBUG-NEXT: (local.get $2) +;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch_2) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop ;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 3 2 -;; CHECK-BIN-NODEBUG-NEXT: (local.get $2) +;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch_2) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (local.get $3) +;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch_3) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (local.get $4) +;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch_4) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $6 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 -;; CHECK-BIN-NODEBUG-NEXT: (block $label$2 +;; CHECK-BIN-NODEBUG-NEXT: (block $block3 +;; CHECK-BIN-NODEBUG-NEXT: (block $block ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $label$3 (result exnref) -;; CHECK-BIN-NODEBUG-NEXT: (block $label$4 +;; CHECK-BIN-NODEBUG-NEXT: (block $block0 (result exnref) +;; CHECK-BIN-NODEBUG-NEXT: (block $block1 ;; CHECK-BIN-NODEBUG-NEXT: (throw_ref -;; CHECK-BIN-NODEBUG-NEXT: (block $label$5 (result exnref) -;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch $tag$4 $label$2) (catch_ref $tag$4 $label$3) (catch_all $label$4) (catch_all_ref $label$5) +;; CHECK-BIN-NODEBUG-NEXT: (block $block2 (result exnref) +;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch $tag$4 $block) (catch_ref $tag$4 $block0) (catch_all $block1) (catch_all_ref $block2) ;; CHECK-BIN-NODEBUG-NEXT: (call $0) ;; CHECK-BIN-NODEBUG-NEXT: (call $0) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (br $label$1) +;; CHECK-BIN-NODEBUG-NEXT: (br $block3) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (br $label$1) +;; CHECK-BIN-NODEBUG-NEXT: (br $block3) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (br $label$1) +;; CHECK-BIN-NODEBUG-NEXT: (br $block3) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $7 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (local $0 (tuple i32 exnref)) -;; CHECK-BIN-NODEBUG-NEXT: (local $1 i32) -;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 +;; CHECK-BIN-NODEBUG-NEXT: (local $scratch (tuple i32 exnref)) +;; CHECK-BIN-NODEBUG-NEXT: (local $scratch_1 i32) +;; CHECK-BIN-NODEBUG-NEXT: (block $block3 ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $label$2 (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (local.set $0 -;; CHECK-BIN-NODEBUG-NEXT: (block $label$3 (type $5) (result i32 exnref) -;; CHECK-BIN-NODEBUG-NEXT: (block $label$4 -;; CHECK-BIN-NODEBUG-NEXT: (throw_ref -;; CHECK-BIN-NODEBUG-NEXT: (block $label$5 (result exnref) -;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch $tag$0 $label$2) (catch_ref $tag$0 $label$3) (catch_all $label$4) (catch_all_ref $label$5) -;; CHECK-BIN-NODEBUG-NEXT: (call $0) -;; CHECK-BIN-NODEBUG-NEXT: (call $0) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (br $label$1) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (br $label$1) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (block $block (result i32) ;; CHECK-BIN-NODEBUG-NEXT: (drop ;; CHECK-BIN-NODEBUG-NEXT: (block (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (local.set $1 +;; CHECK-BIN-NODEBUG-NEXT: (local.set $scratch_1 ;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 2 0 -;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) +;; CHECK-BIN-NODEBUG-NEXT: (local.tee $scratch +;; CHECK-BIN-NODEBUG-NEXT: (block $block0 (type $5) (result i32 exnref) +;; CHECK-BIN-NODEBUG-NEXT: (block $block1 +;; CHECK-BIN-NODEBUG-NEXT: (throw_ref +;; CHECK-BIN-NODEBUG-NEXT: (block $block2 (result exnref) +;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch $tag$0 $block) (catch_ref $tag$0 $block0) (catch_all $block1) (catch_all_ref $block2) +;; CHECK-BIN-NODEBUG-NEXT: (call $0) +;; CHECK-BIN-NODEBUG-NEXT: (call $0) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (br $block3) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (br $block3) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop ;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 2 1 -;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) +;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (local.get $1) +;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch_1) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (br $label$1) +;; CHECK-BIN-NODEBUG-NEXT: (br $block3) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $8 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (local $0 (tuple i32 i64 exnref)) -;; CHECK-BIN-NODEBUG-NEXT: (local $1 i64) -;; CHECK-BIN-NODEBUG-NEXT: (local $2 i32) -;; CHECK-BIN-NODEBUG-NEXT: (local $3 (tuple i32 i64)) -;; CHECK-BIN-NODEBUG-NEXT: (local $4 i32) -;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 -;; CHECK-BIN-NODEBUG-NEXT: (local.set $3 -;; CHECK-BIN-NODEBUG-NEXT: (block $label$2 (type $1) (result i32 i64) -;; CHECK-BIN-NODEBUG-NEXT: (local.set $0 -;; CHECK-BIN-NODEBUG-NEXT: (block $label$3 (type $2) (result i32 i64 exnref) -;; CHECK-BIN-NODEBUG-NEXT: (block $label$4 -;; CHECK-BIN-NODEBUG-NEXT: (throw_ref -;; CHECK-BIN-NODEBUG-NEXT: (block $label$5 (result exnref) -;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch $tag$2 $label$2) (catch_ref $tag$2 $label$3) (catch_all $label$4) (catch_all_ref $label$5) -;; CHECK-BIN-NODEBUG-NEXT: (call $0) -;; CHECK-BIN-NODEBUG-NEXT: (call $0) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (br $label$1) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (br $label$1) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (local.set $2 -;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 3 0 -;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block (result i64) -;; CHECK-BIN-NODEBUG-NEXT: (local.set $1 -;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 3 1 -;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (local $scratch (tuple i32 i64 exnref)) +;; CHECK-BIN-NODEBUG-NEXT: (local $scratch_1 i64) +;; CHECK-BIN-NODEBUG-NEXT: (local $scratch_2 i32) +;; CHECK-BIN-NODEBUG-NEXT: (local $scratch_3 (tuple i32 i64)) +;; CHECK-BIN-NODEBUG-NEXT: (local $scratch_4 i32) +;; CHECK-BIN-NODEBUG-NEXT: (block $block3 +;; CHECK-BIN-NODEBUG-NEXT: (drop +;; CHECK-BIN-NODEBUG-NEXT: (block (result i32) +;; CHECK-BIN-NODEBUG-NEXT: (local.set $scratch_4 +;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 2 0 +;; CHECK-BIN-NODEBUG-NEXT: (local.tee $scratch_3 +;; CHECK-BIN-NODEBUG-NEXT: (block $block (type $1) (result i32 i64) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 3 2 -;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) +;; CHECK-BIN-NODEBUG-NEXT: (block (result i32) +;; CHECK-BIN-NODEBUG-NEXT: (local.set $scratch_2 +;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 3 0 +;; CHECK-BIN-NODEBUG-NEXT: (local.tee $scratch +;; CHECK-BIN-NODEBUG-NEXT: (block $block0 (type $2) (result i32 i64 exnref) +;; CHECK-BIN-NODEBUG-NEXT: (block $block1 +;; CHECK-BIN-NODEBUG-NEXT: (throw_ref +;; CHECK-BIN-NODEBUG-NEXT: (block $block2 (result exnref) +;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch $tag$2 $block) (catch_ref $tag$2 $block0) (catch_all $block1) (catch_all_ref $block2) +;; CHECK-BIN-NODEBUG-NEXT: (call $0) +;; CHECK-BIN-NODEBUG-NEXT: (call $0) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (br $block3) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (br $block3) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (drop +;; CHECK-BIN-NODEBUG-NEXT: (block (result i64) +;; CHECK-BIN-NODEBUG-NEXT: (local.set $scratch_1 +;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 3 1 +;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (drop +;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 3 2 +;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch_1) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch_2) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (local.get $1) +;; CHECK-BIN-NODEBUG-NEXT: (br $block3) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (local.get $2) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (br $label$1) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (local.set $4 -;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 2 0 -;; CHECK-BIN-NODEBUG-NEXT: (local.get $3) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop ;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 2 1 -;; CHECK-BIN-NODEBUG-NEXT: (local.get $3) +;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch_3) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (local.get $4) +;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch_4) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $9 (type $4) (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (block $label$2 (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (try_table (result i32) (catch $tag$0 $label$1) -;; CHECK-BIN-NODEBUG-NEXT: (br $label$2 +;; CHECK-BIN-NODEBUG-NEXT: (block $block (result i32) +;; CHECK-BIN-NODEBUG-NEXT: (block $block0 (result i32) +;; CHECK-BIN-NODEBUG-NEXT: (try_table (result i32) (catch $tag$0 $block) +;; CHECK-BIN-NODEBUG-NEXT: (br $block0 ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -1025,11 +1026,11 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $10 (type $3) (result exnref) -;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 (result exnref) +;; CHECK-BIN-NODEBUG-NEXT: (block $block (result exnref) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $label$2 (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch_all_ref $label$1) -;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch $tag$0 $label$2) +;; CHECK-BIN-NODEBUG-NEXT: (block $block0 (result i32) +;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch_all_ref $block) +;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch $tag$0 $block0) ;; CHECK-BIN-NODEBUG-NEXT: (if ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0) ;; CHECK-BIN-NODEBUG-NEXT: (then @@ -1043,8 +1044,11 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (unreachable) ;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (unreachable) ;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (unreachable) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (ref.null noexn) diff --git a/test/lit/basic/fn_prolog_epilog.debugInfo.wast b/test/lit/basic/fn_prolog_epilog.debugInfo.wast index 636c3346e9b..511ea9ce8aa 100644 --- a/test/lit/basic/fn_prolog_epilog.debugInfo.wast +++ b/test/lit/basic/fn_prolog_epilog.debugInfo.wast @@ -45,9 +45,9 @@ ;; CHECK-BIN: (func $0 (type $0) ;; CHECK-BIN-NEXT: (nop) -;; CHECK-BIN-NEXT: (block $label$1 -;; CHECK-BIN-NEXT: (block $label$2 -;; CHECK-BIN-NEXT: (br $label$2) +;; CHECK-BIN-NEXT: (block +;; CHECK-BIN-NEXT: (block $block +;; CHECK-BIN-NEXT: (br $block) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (return) @@ -57,9 +57,9 @@ ;; CHECK-BIN-NODEBUG: (func $0 (type $0) ;; CHECK-BIN-NODEBUG-NEXT: (nop) -;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 -;; CHECK-BIN-NODEBUG-NEXT: (block $label$2 -;; CHECK-BIN-NODEBUG-NEXT: (br $label$2) +;; CHECK-BIN-NODEBUG-NEXT: (block +;; CHECK-BIN-NODEBUG-NEXT: (block $block +;; CHECK-BIN-NODEBUG-NEXT: (br $block) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (return) diff --git a/test/lit/basic/min.wast b/test/lit/basic/min.wast index 44928cd832f..3b26bc98a2a 100644 --- a/test/lit/basic/min.wast +++ b/test/lit/basic/min.wast @@ -76,7 +76,7 @@ ;; CHECK-BIN-NEXT: (local $n f32) ;; CHECK-BIN-NEXT: (local.tee $n ;; CHECK-BIN-NEXT: (f32.neg - ;; CHECK-BIN-NEXT: (block $label$1 (result f32) + ;; CHECK-BIN-NEXT: (block (result f32) ;; CHECK-BIN-NEXT: (i32.store ;; CHECK-BIN-NEXT: (local.get $k) ;; CHECK-BIN-NEXT: (local.get $p) @@ -127,21 +127,21 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $littleswitch (type $2) (param $x i32) (result i32) - ;; CHECK-BIN-NEXT: (block $label$1 (result i32) - ;; CHECK-BIN-NEXT: (block $label$2 - ;; CHECK-BIN-NEXT: (block $label$3 - ;; CHECK-BIN-NEXT: (br_table $label$3 $label$2 $label$3 + ;; CHECK-BIN-NEXT: (block $block1 (result i32) + ;; CHECK-BIN-NEXT: (block $block0 + ;; CHECK-BIN-NEXT: (block $block + ;; CHECK-BIN-NEXT: (br_table $block $block0 $block ;; CHECK-BIN-NEXT: (i32.sub ;; CHECK-BIN-NEXT: (local.get $x) ;; CHECK-BIN-NEXT: (i32.const 1) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (br $label$1 + ;; CHECK-BIN-NEXT: (br $block1 ;; CHECK-BIN-NEXT: (i32.const 1) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (br $label$1 + ;; CHECK-BIN-NEXT: (br $block1 ;; CHECK-BIN-NEXT: (i32.const 2) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -196,7 +196,7 @@ ;; CHECK-BIN-NODEBUG-NEXT: (local $2 f32) ;; CHECK-BIN-NODEBUG-NEXT: (local.tee $2 ;; CHECK-BIN-NODEBUG-NEXT: (f32.neg -;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 (result f32) +;; CHECK-BIN-NODEBUG-NEXT: (block (result f32) ;; CHECK-BIN-NODEBUG-NEXT: (i32.store ;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) ;; CHECK-BIN-NODEBUG-NEXT: (local.get $1) @@ -210,21 +210,21 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $2 (type $2) (param $0 i32) (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (block $label$2 -;; CHECK-BIN-NODEBUG-NEXT: (block $label$3 -;; CHECK-BIN-NODEBUG-NEXT: (br_table $label$3 $label$2 $label$3 +;; CHECK-BIN-NODEBUG-NEXT: (block $block1 (result i32) +;; CHECK-BIN-NODEBUG-NEXT: (block $block0 +;; CHECK-BIN-NODEBUG-NEXT: (block $block +;; CHECK-BIN-NODEBUG-NEXT: (br_table $block $block0 $block ;; CHECK-BIN-NODEBUG-NEXT: (i32.sub ;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (br $label$1 +;; CHECK-BIN-NODEBUG-NEXT: (br $block1 ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (br $label$1 +;; CHECK-BIN-NODEBUG-NEXT: (br $block1 ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 2) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) diff --git a/test/lit/basic/polymorphic_stack.wast b/test/lit/basic/polymorphic_stack.wast index fc743bf2aea..2ccaa51e7db 100644 --- a/test/lit/basic/polymorphic_stack.wast +++ b/test/lit/basic/polymorphic_stack.wast @@ -47,9 +47,7 @@ ;; CHECK-BIN: (import "env" "table" (table $timport$0 9 9 funcref)) ;; CHECK-BIN: (func $break-and-binary (type $0) (result i32) - ;; CHECK-BIN-NEXT: (block $label$1 (result i32) - ;; CHECK-BIN-NEXT: (unreachable) - ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (unreachable) ;; CHECK-BIN-NEXT: ) (func $break-and-binary (result i32) (block $x (result i32) @@ -227,15 +225,13 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $untaken-break-should-have-value (type $0) (result i32) - ;; CHECK-BIN-NEXT: (block $label$1 (result i32) - ;; CHECK-BIN-NEXT: (block $label$2 - ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (i32.const 0) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (unreachable) + ;; CHECK-BIN-NEXT: (block + ;; CHECK-BIN-NEXT: (drop + ;; CHECK-BIN-NEXT: (i32.const 0) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (unreachable) ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (unreachable) ;; CHECK-BIN-NEXT: ) (func $untaken-break-should-have-value (result i32) (block $x (result i32) @@ -275,7 +271,7 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (block $label$2 (result i32) + ;; CHECK-BIN-NEXT: (block (result i32) ;; CHECK-BIN-NEXT: (drop ;; CHECK-BIN-NEXT: (i32.const 0) ;; CHECK-BIN-NEXT: ) @@ -314,10 +310,8 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $br_table_unreachable_to_also_unreachable (type $0) (result i32) - ;; CHECK-BIN-NEXT: (block $label$1 (result i32) - ;; CHECK-BIN-NEXT: (block $label$2 (result i32) - ;; CHECK-BIN-NEXT: (unreachable) - ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (block (result i32) + ;; CHECK-BIN-NEXT: (unreachable) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) (func $br_table_unreachable_to_also_unreachable (result i32) @@ -352,20 +346,19 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $untaken-br_if (type $0) (result i32) - ;; CHECK-BIN-NEXT: (block $label$1 (result i32) - ;; CHECK-BIN-NEXT: (block $label$2 - ;; CHECK-BIN-NEXT: (if - ;; CHECK-BIN-NEXT: (i32.const 0) - ;; CHECK-BIN-NEXT: (then - ;; CHECK-BIN-NEXT: (unreachable) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (else - ;; CHECK-BIN-NEXT: (unreachable) - ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (block + ;; CHECK-BIN-NEXT: (if + ;; CHECK-BIN-NEXT: (i32.const 0) + ;; CHECK-BIN-NEXT: (then + ;; CHECK-BIN-NEXT: (unreachable) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (else + ;; CHECK-BIN-NEXT: (unreachable) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (unreachable) ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (unreachable) ;; CHECK-BIN-NEXT: ) (func $untaken-br_if (result i32) (block $label$8 (result i32) @@ -399,9 +392,7 @@ ;; CHECK-BIN-NODEBUG: (import "env" "table" (table $timport$0 9 9 funcref)) ;; CHECK-BIN-NODEBUG: (func $0 (type $0) (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (unreachable) -;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (unreachable) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $1 (type $1) (param $0 i32) (result i32) @@ -428,15 +419,13 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $5 (type $0) (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (block $label$2 -;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (unreachable) +;; CHECK-BIN-NODEBUG-NEXT: (block +;; CHECK-BIN-NODEBUG-NEXT: (drop +;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (unreachable) ;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (unreachable) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $6 (type $1) (param $0 i32) (result i32) @@ -448,7 +437,7 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (block $label$2 (result i32) +;; CHECK-BIN-NODEBUG-NEXT: (block (result i32) ;; CHECK-BIN-NODEBUG-NEXT: (drop ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -459,26 +448,23 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $7 (type $0) (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (block $label$2 (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (unreachable) -;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (block (result i32) +;; CHECK-BIN-NODEBUG-NEXT: (unreachable) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $8 (type $0) (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (block $label$2 -;; CHECK-BIN-NODEBUG-NEXT: (if -;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0) -;; CHECK-BIN-NODEBUG-NEXT: (then -;; CHECK-BIN-NODEBUG-NEXT: (unreachable) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (else -;; CHECK-BIN-NODEBUG-NEXT: (unreachable) -;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (block +;; CHECK-BIN-NODEBUG-NEXT: (if +;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0) +;; CHECK-BIN-NODEBUG-NEXT: (then +;; CHECK-BIN-NODEBUG-NEXT: (unreachable) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (else +;; CHECK-BIN-NODEBUG-NEXT: (unreachable) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (unreachable) ;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (unreachable) ;; CHECK-BIN-NODEBUG-NEXT: ) diff --git a/test/lit/basic/reference-types.wast b/test/lit/basic/reference-types.wast index 33593957382..00793e32e8e 100644 --- a/test/lit/basic/reference-types.wast +++ b/test/lit/basic/reference-types.wast @@ -952,25 +952,25 @@ ;; CHECK-BIN-NEXT: (i32.const 3) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $label$1 (result eqref) - ;; CHECK-BIN-NEXT: (br_if $label$1 + ;; CHECK-BIN-NEXT: (block $block (result eqref) + ;; CHECK-BIN-NEXT: (br_if $block ;; CHECK-BIN-NEXT: (local.get $local_eqref) ;; CHECK-BIN-NEXT: (i32.const 1) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $label$2 (result eqref) - ;; CHECK-BIN-NEXT: (br_if $label$2 + ;; CHECK-BIN-NEXT: (block $block0 (result eqref) + ;; CHECK-BIN-NEXT: (br_if $block0 ;; CHECK-BIN-NEXT: (global.get $global_eqref) ;; CHECK-BIN-NEXT: (i32.const 1) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $label$3 (result eqref) + ;; CHECK-BIN-NEXT: (block $block1 (result eqref) ;; CHECK-BIN-NEXT: (ref.cast nullref - ;; CHECK-BIN-NEXT: (br_if $label$3 + ;; CHECK-BIN-NEXT: (br_if $block1 ;; CHECK-BIN-NEXT: (ref.null none) ;; CHECK-BIN-NEXT: (i32.const 1) ;; CHECK-BIN-NEXT: ) @@ -978,25 +978,25 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $label$4 (result funcref) - ;; CHECK-BIN-NEXT: (br_if $label$4 + ;; CHECK-BIN-NEXT: (block $block2 (result funcref) + ;; CHECK-BIN-NEXT: (br_if $block2 ;; CHECK-BIN-NEXT: (local.get $local_funcref) ;; CHECK-BIN-NEXT: (i32.const 1) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $label$5 (result funcref) - ;; CHECK-BIN-NEXT: (br_if $label$5 + ;; CHECK-BIN-NEXT: (block $block3 (result funcref) + ;; CHECK-BIN-NEXT: (br_if $block3 ;; CHECK-BIN-NEXT: (global.get $global_funcref) ;; CHECK-BIN-NEXT: (i32.const 1) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $label$6 (result funcref) + ;; CHECK-BIN-NEXT: (block $block4 (result funcref) ;; CHECK-BIN-NEXT: (ref.cast nullfuncref - ;; CHECK-BIN-NEXT: (br_if $label$6 + ;; CHECK-BIN-NEXT: (br_if $block4 ;; CHECK-BIN-NEXT: (ref.null nofunc) ;; CHECK-BIN-NEXT: (i32.const 1) ;; CHECK-BIN-NEXT: ) @@ -1004,9 +1004,9 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $label$7 (result funcref) + ;; CHECK-BIN-NEXT: (block $block5 (result funcref) ;; CHECK-BIN-NEXT: (ref.cast (ref $3) - ;; CHECK-BIN-NEXT: (br_if $label$7 + ;; CHECK-BIN-NEXT: (br_if $block5 ;; CHECK-BIN-NEXT: (ref.func $foo) ;; CHECK-BIN-NEXT: (i32.const 1) ;; CHECK-BIN-NEXT: ) @@ -1014,25 +1014,25 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $label$8 (result anyref) - ;; CHECK-BIN-NEXT: (br_if $label$8 + ;; CHECK-BIN-NEXT: (block $block6 (result anyref) + ;; CHECK-BIN-NEXT: (br_if $block6 ;; CHECK-BIN-NEXT: (local.get $local_anyref) ;; CHECK-BIN-NEXT: (i32.const 1) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $label$9 (result anyref) - ;; CHECK-BIN-NEXT: (br_if $label$9 + ;; CHECK-BIN-NEXT: (block $block7 (result anyref) + ;; CHECK-BIN-NEXT: (br_if $block7 ;; CHECK-BIN-NEXT: (global.get $global_anyref) ;; CHECK-BIN-NEXT: (i32.const 1) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $label$10 (result anyref) + ;; CHECK-BIN-NEXT: (block $block8 (result anyref) ;; CHECK-BIN-NEXT: (ref.cast nullref - ;; CHECK-BIN-NEXT: (br_if $label$10 + ;; CHECK-BIN-NEXT: (br_if $block8 ;; CHECK-BIN-NEXT: (ref.null none) ;; CHECK-BIN-NEXT: (i32.const 1) ;; CHECK-BIN-NEXT: ) @@ -1040,9 +1040,9 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $label$11 (result anyref) + ;; CHECK-BIN-NEXT: (block $block9 (result anyref) ;; CHECK-BIN-NEXT: (ref.cast eqref - ;; CHECK-BIN-NEXT: (br_if $label$11 + ;; CHECK-BIN-NEXT: (br_if $block9 ;; CHECK-BIN-NEXT: (local.get $local_eqref) ;; CHECK-BIN-NEXT: (i32.const 1) ;; CHECK-BIN-NEXT: ) @@ -1050,9 +1050,9 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $label$12 (result anyref) + ;; CHECK-BIN-NEXT: (block $block10 (result anyref) ;; CHECK-BIN-NEXT: (ref.cast nullref - ;; CHECK-BIN-NEXT: (br_if $label$12 + ;; CHECK-BIN-NEXT: (br_if $block10 ;; CHECK-BIN-NEXT: (ref.null none) ;; CHECK-BIN-NEXT: (i32.const 1) ;; CHECK-BIN-NEXT: ) @@ -1060,67 +1060,67 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (loop $label$13 (result eqref) + ;; CHECK-BIN-NEXT: (loop (result eqref) ;; CHECK-BIN-NEXT: (local.get $local_eqref) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (loop $label$14 (result eqref) + ;; CHECK-BIN-NEXT: (loop (result eqref) ;; CHECK-BIN-NEXT: (global.get $global_eqref) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (loop $label$15 (result eqref) + ;; CHECK-BIN-NEXT: (loop (result eqref) ;; CHECK-BIN-NEXT: (ref.null none) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (loop $label$16 (result funcref) + ;; CHECK-BIN-NEXT: (loop (result funcref) ;; CHECK-BIN-NEXT: (local.get $local_funcref) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (loop $label$17 (result funcref) + ;; CHECK-BIN-NEXT: (loop (result funcref) ;; CHECK-BIN-NEXT: (global.get $global_funcref) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (loop $label$18 (result funcref) + ;; CHECK-BIN-NEXT: (loop (result funcref) ;; CHECK-BIN-NEXT: (ref.null nofunc) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (loop $label$19 (result funcref) + ;; CHECK-BIN-NEXT: (loop (result funcref) ;; CHECK-BIN-NEXT: (ref.func $foo) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (loop $label$20 (result anyref) + ;; CHECK-BIN-NEXT: (loop (result anyref) ;; CHECK-BIN-NEXT: (local.get $local_anyref) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (loop $label$21 (result anyref) + ;; CHECK-BIN-NEXT: (loop (result anyref) ;; CHECK-BIN-NEXT: (global.get $global_anyref) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (loop $label$22 (result anyref) + ;; CHECK-BIN-NEXT: (loop (result anyref) ;; CHECK-BIN-NEXT: (ref.null none) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (loop $label$23 (result anyref) + ;; CHECK-BIN-NEXT: (loop (result anyref) ;; CHECK-BIN-NEXT: (local.get $local_eqref) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (loop $label$24 (result anyref) + ;; CHECK-BIN-NEXT: (loop (result anyref) ;; CHECK-BIN-NEXT: (global.get $global_eqref) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (loop $label$25 (result anyref) + ;; CHECK-BIN-NEXT: (loop (result anyref) ;; CHECK-BIN-NEXT: (ref.null none) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -1193,7 +1193,7 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (try $label$40 (result eqref) + ;; CHECK-BIN-NEXT: (try (result eqref) ;; CHECK-BIN-NEXT: (do ;; CHECK-BIN-NEXT: (local.get $local_eqref) ;; CHECK-BIN-NEXT: ) @@ -1206,7 +1206,7 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (try $label$43 (result funcref) + ;; CHECK-BIN-NEXT: (try (result funcref) ;; CHECK-BIN-NEXT: (do ;; CHECK-BIN-NEXT: (ref.func $foo) ;; CHECK-BIN-NEXT: ) @@ -1219,7 +1219,7 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (try $label$46 (result anyref) + ;; CHECK-BIN-NEXT: (try (result anyref) ;; CHECK-BIN-NEXT: (do ;; CHECK-BIN-NEXT: (local.get $local_eqref) ;; CHECK-BIN-NEXT: ) @@ -1232,7 +1232,7 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (try $label$49 (result anyref) + ;; CHECK-BIN-NEXT: (try (result anyref) ;; CHECK-BIN-NEXT: (do ;; CHECK-BIN-NEXT: (ref.null none) ;; CHECK-BIN-NEXT: ) @@ -1245,11 +1245,11 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $label$50 (result eqref) + ;; CHECK-BIN-NEXT: (block $block12 (result eqref) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $label$51 (result i32) - ;; CHECK-BIN-NEXT: (br $label$50 - ;; CHECK-BIN-NEXT: (try_table (result eqref) (catch $e-i32 $label$51) + ;; CHECK-BIN-NEXT: (block $block11 (result i32) + ;; CHECK-BIN-NEXT: (br $block12 + ;; CHECK-BIN-NEXT: (try_table (result eqref) (catch $e-i32 $block11) ;; CHECK-BIN-NEXT: (local.get $local_eqref) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -1259,11 +1259,11 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $label$53 (result funcref) + ;; CHECK-BIN-NEXT: (block $block14 (result funcref) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $label$54 (result i32) - ;; CHECK-BIN-NEXT: (br $label$53 - ;; CHECK-BIN-NEXT: (try_table (result funcref) (catch $e-i32 $label$54) + ;; CHECK-BIN-NEXT: (block $block13 (result i32) + ;; CHECK-BIN-NEXT: (br $block14 + ;; CHECK-BIN-NEXT: (try_table (result funcref) (catch $e-i32 $block13) ;; CHECK-BIN-NEXT: (ref.func $foo) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -1273,11 +1273,11 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $label$56 (result anyref) + ;; CHECK-BIN-NEXT: (block $block16 (result anyref) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $label$57 (result i32) - ;; CHECK-BIN-NEXT: (br $label$56 - ;; CHECK-BIN-NEXT: (try_table (result anyref) (catch $e-i32 $label$57) + ;; CHECK-BIN-NEXT: (block $block15 (result i32) + ;; CHECK-BIN-NEXT: (br $block16 + ;; CHECK-BIN-NEXT: (try_table (result anyref) (catch $e-i32 $block15) ;; CHECK-BIN-NEXT: (local.get $local_eqref) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -1287,11 +1287,11 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $label$59 (result anyref) + ;; CHECK-BIN-NEXT: (block $block18 (result anyref) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $label$60 (result i32) - ;; CHECK-BIN-NEXT: (br $label$59 - ;; CHECK-BIN-NEXT: (try_table (result anyref) (catch $e-i32 $label$60) + ;; CHECK-BIN-NEXT: (block $block17 (result i32) + ;; CHECK-BIN-NEXT: (br $block18 + ;; CHECK-BIN-NEXT: (try_table (result anyref) (catch $e-i32 $block17) ;; CHECK-BIN-NEXT: (ref.null none) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -2295,25 +2295,25 @@ ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 3) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 (result eqref) -;; CHECK-BIN-NODEBUG-NEXT: (br_if $label$1 +;; CHECK-BIN-NODEBUG-NEXT: (block $block (result eqref) +;; CHECK-BIN-NODEBUG-NEXT: (br_if $block ;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $label$2 (result eqref) -;; CHECK-BIN-NODEBUG-NEXT: (br_if $label$2 +;; CHECK-BIN-NODEBUG-NEXT: (block $block0 (result eqref) +;; CHECK-BIN-NODEBUG-NEXT: (br_if $block0 ;; CHECK-BIN-NODEBUG-NEXT: (global.get $global$0) ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $label$3 (result eqref) +;; CHECK-BIN-NODEBUG-NEXT: (block $block1 (result eqref) ;; CHECK-BIN-NODEBUG-NEXT: (ref.cast nullref -;; CHECK-BIN-NODEBUG-NEXT: (br_if $label$3 +;; CHECK-BIN-NODEBUG-NEXT: (br_if $block1 ;; CHECK-BIN-NODEBUG-NEXT: (ref.null none) ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -2321,25 +2321,25 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $label$4 (result funcref) -;; CHECK-BIN-NODEBUG-NEXT: (br_if $label$4 +;; CHECK-BIN-NODEBUG-NEXT: (block $block2 (result funcref) +;; CHECK-BIN-NODEBUG-NEXT: (br_if $block2 ;; CHECK-BIN-NODEBUG-NEXT: (local.get $1) ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $label$5 (result funcref) -;; CHECK-BIN-NODEBUG-NEXT: (br_if $label$5 +;; CHECK-BIN-NODEBUG-NEXT: (block $block3 (result funcref) +;; CHECK-BIN-NODEBUG-NEXT: (br_if $block3 ;; CHECK-BIN-NODEBUG-NEXT: (global.get $global$1) ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $label$6 (result funcref) +;; CHECK-BIN-NODEBUG-NEXT: (block $block4 (result funcref) ;; CHECK-BIN-NODEBUG-NEXT: (ref.cast nullfuncref -;; CHECK-BIN-NODEBUG-NEXT: (br_if $label$6 +;; CHECK-BIN-NODEBUG-NEXT: (br_if $block4 ;; CHECK-BIN-NODEBUG-NEXT: (ref.null nofunc) ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -2347,9 +2347,9 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $label$7 (result funcref) +;; CHECK-BIN-NODEBUG-NEXT: (block $block5 (result funcref) ;; CHECK-BIN-NODEBUG-NEXT: (ref.cast (ref $3) -;; CHECK-BIN-NODEBUG-NEXT: (br_if $label$7 +;; CHECK-BIN-NODEBUG-NEXT: (br_if $block5 ;; CHECK-BIN-NODEBUG-NEXT: (ref.func $3) ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -2357,25 +2357,25 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $label$8 (result anyref) -;; CHECK-BIN-NODEBUG-NEXT: (br_if $label$8 +;; CHECK-BIN-NODEBUG-NEXT: (block $block6 (result anyref) +;; CHECK-BIN-NODEBUG-NEXT: (br_if $block6 ;; CHECK-BIN-NODEBUG-NEXT: (local.get $2) ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $label$9 (result anyref) -;; CHECK-BIN-NODEBUG-NEXT: (br_if $label$9 +;; CHECK-BIN-NODEBUG-NEXT: (block $block7 (result anyref) +;; CHECK-BIN-NODEBUG-NEXT: (br_if $block7 ;; CHECK-BIN-NODEBUG-NEXT: (global.get $global$3) ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $label$10 (result anyref) +;; CHECK-BIN-NODEBUG-NEXT: (block $block8 (result anyref) ;; CHECK-BIN-NODEBUG-NEXT: (ref.cast nullref -;; CHECK-BIN-NODEBUG-NEXT: (br_if $label$10 +;; CHECK-BIN-NODEBUG-NEXT: (br_if $block8 ;; CHECK-BIN-NODEBUG-NEXT: (ref.null none) ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -2383,9 +2383,9 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $label$11 (result anyref) +;; CHECK-BIN-NODEBUG-NEXT: (block $block9 (result anyref) ;; CHECK-BIN-NODEBUG-NEXT: (ref.cast eqref -;; CHECK-BIN-NODEBUG-NEXT: (br_if $label$11 +;; CHECK-BIN-NODEBUG-NEXT: (br_if $block9 ;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -2393,9 +2393,9 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $label$12 (result anyref) +;; CHECK-BIN-NODEBUG-NEXT: (block $block10 (result anyref) ;; CHECK-BIN-NODEBUG-NEXT: (ref.cast nullref -;; CHECK-BIN-NODEBUG-NEXT: (br_if $label$12 +;; CHECK-BIN-NODEBUG-NEXT: (br_if $block10 ;; CHECK-BIN-NODEBUG-NEXT: (ref.null none) ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -2403,67 +2403,67 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (loop $label$13 (result eqref) +;; CHECK-BIN-NODEBUG-NEXT: (loop (result eqref) ;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (loop $label$14 (result eqref) +;; CHECK-BIN-NODEBUG-NEXT: (loop (result eqref) ;; CHECK-BIN-NODEBUG-NEXT: (global.get $global$0) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (loop $label$15 (result eqref) +;; CHECK-BIN-NODEBUG-NEXT: (loop (result eqref) ;; CHECK-BIN-NODEBUG-NEXT: (ref.null none) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (loop $label$16 (result funcref) +;; CHECK-BIN-NODEBUG-NEXT: (loop (result funcref) ;; CHECK-BIN-NODEBUG-NEXT: (local.get $1) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (loop $label$17 (result funcref) +;; CHECK-BIN-NODEBUG-NEXT: (loop (result funcref) ;; CHECK-BIN-NODEBUG-NEXT: (global.get $global$1) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (loop $label$18 (result funcref) +;; CHECK-BIN-NODEBUG-NEXT: (loop (result funcref) ;; CHECK-BIN-NODEBUG-NEXT: (ref.null nofunc) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (loop $label$19 (result funcref) +;; CHECK-BIN-NODEBUG-NEXT: (loop (result funcref) ;; CHECK-BIN-NODEBUG-NEXT: (ref.func $3) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (loop $label$20 (result anyref) +;; CHECK-BIN-NODEBUG-NEXT: (loop (result anyref) ;; CHECK-BIN-NODEBUG-NEXT: (local.get $2) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (loop $label$21 (result anyref) +;; CHECK-BIN-NODEBUG-NEXT: (loop (result anyref) ;; CHECK-BIN-NODEBUG-NEXT: (global.get $global$3) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (loop $label$22 (result anyref) +;; CHECK-BIN-NODEBUG-NEXT: (loop (result anyref) ;; CHECK-BIN-NODEBUG-NEXT: (ref.null none) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (loop $label$23 (result anyref) +;; CHECK-BIN-NODEBUG-NEXT: (loop (result anyref) ;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (loop $label$24 (result anyref) +;; CHECK-BIN-NODEBUG-NEXT: (loop (result anyref) ;; CHECK-BIN-NODEBUG-NEXT: (global.get $global$0) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (loop $label$25 (result anyref) +;; CHECK-BIN-NODEBUG-NEXT: (loop (result anyref) ;; CHECK-BIN-NODEBUG-NEXT: (ref.null none) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -2536,7 +2536,7 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (try $label$40 (result eqref) +;; CHECK-BIN-NODEBUG-NEXT: (try (result eqref) ;; CHECK-BIN-NODEBUG-NEXT: (do ;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -2549,7 +2549,7 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (try $label$43 (result funcref) +;; CHECK-BIN-NODEBUG-NEXT: (try (result funcref) ;; CHECK-BIN-NODEBUG-NEXT: (do ;; CHECK-BIN-NODEBUG-NEXT: (ref.func $3) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -2562,7 +2562,7 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (try $label$46 (result anyref) +;; CHECK-BIN-NODEBUG-NEXT: (try (result anyref) ;; CHECK-BIN-NODEBUG-NEXT: (do ;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -2575,7 +2575,7 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (try $label$49 (result anyref) +;; CHECK-BIN-NODEBUG-NEXT: (try (result anyref) ;; CHECK-BIN-NODEBUG-NEXT: (do ;; CHECK-BIN-NODEBUG-NEXT: (ref.null none) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -2588,11 +2588,11 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $label$50 (result eqref) +;; CHECK-BIN-NODEBUG-NEXT: (block $block12 (result eqref) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $label$51 (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (br $label$50 -;; CHECK-BIN-NODEBUG-NEXT: (try_table (result eqref) (catch $tag$0 $label$51) +;; CHECK-BIN-NODEBUG-NEXT: (block $block11 (result i32) +;; CHECK-BIN-NODEBUG-NEXT: (br $block12 +;; CHECK-BIN-NODEBUG-NEXT: (try_table (result eqref) (catch $tag$0 $block11) ;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -2602,11 +2602,11 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $label$53 (result funcref) +;; CHECK-BIN-NODEBUG-NEXT: (block $block14 (result funcref) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $label$54 (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (br $label$53 -;; CHECK-BIN-NODEBUG-NEXT: (try_table (result funcref) (catch $tag$0 $label$54) +;; CHECK-BIN-NODEBUG-NEXT: (block $block13 (result i32) +;; CHECK-BIN-NODEBUG-NEXT: (br $block14 +;; CHECK-BIN-NODEBUG-NEXT: (try_table (result funcref) (catch $tag$0 $block13) ;; CHECK-BIN-NODEBUG-NEXT: (ref.func $3) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -2616,11 +2616,11 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $label$56 (result anyref) +;; CHECK-BIN-NODEBUG-NEXT: (block $block16 (result anyref) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $label$57 (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (br $label$56 -;; CHECK-BIN-NODEBUG-NEXT: (try_table (result anyref) (catch $tag$0 $label$57) +;; CHECK-BIN-NODEBUG-NEXT: (block $block15 (result i32) +;; CHECK-BIN-NODEBUG-NEXT: (br $block16 +;; CHECK-BIN-NODEBUG-NEXT: (try_table (result anyref) (catch $tag$0 $block15) ;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -2630,11 +2630,11 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $label$59 (result anyref) +;; CHECK-BIN-NODEBUG-NEXT: (block $block18 (result anyref) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $label$60 (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (br $label$59 -;; CHECK-BIN-NODEBUG-NEXT: (try_table (result anyref) (catch $tag$0 $label$60) +;; CHECK-BIN-NODEBUG-NEXT: (block $block17 (result i32) +;; CHECK-BIN-NODEBUG-NEXT: (br $block18 +;; CHECK-BIN-NODEBUG-NEXT: (try_table (result anyref) (catch $tag$0 $block17) ;; CHECK-BIN-NODEBUG-NEXT: (ref.null none) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) diff --git a/test/lit/basic/reg_switch.wast b/test/lit/basic/reg_switch.wast index db749451145..a1d00e8aa1c 100644 --- a/test/lit/basic/reg_switch.wast +++ b/test/lit/basic/reg_switch.wast @@ -35,8 +35,8 @@ ;; CHECK-BIN-NEXT: (if ;; CHECK-BIN-NEXT: (i32.const 0) ;; CHECK-BIN-NEXT: (then - ;; CHECK-BIN-NEXT: (block $label$2 - ;; CHECK-BIN-NEXT: (br_table $label$2 + ;; CHECK-BIN-NEXT: (block $block + ;; CHECK-BIN-NEXT: (br_table $block ;; CHECK-BIN-NEXT: (i32.const 0) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -47,8 +47,8 @@ ;; CHECK-BIN-NODEBUG-NEXT: (if ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0) ;; CHECK-BIN-NODEBUG-NEXT: (then - ;; CHECK-BIN-NODEBUG-NEXT: (block $label$2 - ;; CHECK-BIN-NODEBUG-NEXT: (br_table $label$2 + ;; CHECK-BIN-NODEBUG-NEXT: (block $block + ;; CHECK-BIN-NODEBUG-NEXT: (br_table $block ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) diff --git a/test/lit/basic/typed_continuations_resume.wast b/test/lit/basic/typed_continuations_resume.wast index 5cd2277d311..07afb9388f3 100644 --- a/test/lit/basic/typed_continuations_resume.wast +++ b/test/lit/basic/typed_continuations_resume.wast @@ -61,31 +61,28 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $go (type $3) (param $x (ref $ct)) (result i32) - ;; CHECK-BIN-NEXT: (local $1 (tuple i32 (ref $ct))) - ;; CHECK-BIN-NEXT: (local $2 i32) - ;; CHECK-BIN-NEXT: (local.set $1 - ;; CHECK-BIN-NEXT: (block $label$1 (type $2) (result i32 (ref $ct)) - ;; CHECK-BIN-NEXT: (return - ;; CHECK-BIN-NEXT: (resume $ct (on $t $label$1) - ;; CHECK-BIN-NEXT: (i32.const 123) - ;; CHECK-BIN-NEXT: (local.get $x) + ;; CHECK-BIN-NEXT: (local $scratch (tuple i32 (ref $ct))) + ;; CHECK-BIN-NEXT: (local $scratch_2 i32) + ;; CHECK-BIN-NEXT: (local.set $scratch_2 + ;; CHECK-BIN-NEXT: (tuple.extract 2 0 + ;; CHECK-BIN-NEXT: (local.tee $scratch + ;; CHECK-BIN-NEXT: (block $block (type $2) (result i32 (ref $ct)) + ;; CHECK-BIN-NEXT: (return + ;; CHECK-BIN-NEXT: (resume $ct (on $t $block) + ;; CHECK-BIN-NEXT: (i32.const 123) + ;; CHECK-BIN-NEXT: (local.get $x) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (block (result i32) - ;; CHECK-BIN-NEXT: (local.set $2 - ;; CHECK-BIN-NEXT: (tuple.extract 2 0 - ;; CHECK-BIN-NEXT: (local.get $1) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (tuple.extract 2 1 - ;; CHECK-BIN-NEXT: (local.get $1) - ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (drop + ;; CHECK-BIN-NEXT: (tuple.extract 2 1 + ;; CHECK-BIN-NEXT: (local.get $scratch) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (local.get $2) ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (local.get $scratch_2) ;; CHECK-BIN-NEXT: ) (func $go (param $x (ref $ct)) (result i32) (tuple.extract 2 0 @@ -135,29 +132,26 @@ ;; CHECK-BIN-NODEBUG: (tag $tag$0 (param i32) (result i32)) ;; CHECK-BIN-NODEBUG: (func $0 (type $3) (param $0 (ref $1)) (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (local $1 (tuple i32 (ref $1))) -;; CHECK-BIN-NODEBUG-NEXT: (local $2 i32) -;; CHECK-BIN-NODEBUG-NEXT: (local.set $1 -;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 (type $2) (result i32 (ref $1)) -;; CHECK-BIN-NODEBUG-NEXT: (return -;; CHECK-BIN-NODEBUG-NEXT: (resume $1 (on $tag$0 $label$1) -;; CHECK-BIN-NODEBUG-NEXT: (i32.const 123) -;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) +;; CHECK-BIN-NODEBUG-NEXT: (local $scratch (tuple i32 (ref $1))) +;; CHECK-BIN-NODEBUG-NEXT: (local $scratch_2 i32) +;; CHECK-BIN-NODEBUG-NEXT: (local.set $scratch_2 +;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 2 0 +;; CHECK-BIN-NODEBUG-NEXT: (local.tee $scratch +;; CHECK-BIN-NODEBUG-NEXT: (block $block (type $2) (result i32 (ref $1)) +;; CHECK-BIN-NODEBUG-NEXT: (return +;; CHECK-BIN-NODEBUG-NEXT: (resume $1 (on $tag$0 $block) +;; CHECK-BIN-NODEBUG-NEXT: (i32.const 123) +;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (block (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (local.set $2 -;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 2 0 -;; CHECK-BIN-NODEBUG-NEXT: (local.get $1) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 2 1 -;; CHECK-BIN-NODEBUG-NEXT: (local.get $1) -;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (drop +;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 2 1 +;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (local.get $2) ;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch_2) ;; CHECK-BIN-NODEBUG-NEXT: ) diff --git a/test/lit/basic/types-function-references.wast b/test/lit/basic/types-function-references.wast index 792536cfe30..e4c621c3035 100644 --- a/test/lit/basic/types-function-references.wast +++ b/test/lit/basic/types-function-references.wast @@ -194,37 +194,36 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $type-only-in-tuple-block (type $void) - ;; CHECK-BIN-NEXT: (local $0 (tuple i32 (ref null $mixed_results) f64)) - ;; CHECK-BIN-NEXT: (local $1 (ref null $mixed_results)) - ;; CHECK-BIN-NEXT: (local $2 i32) - ;; CHECK-BIN-NEXT: (local.set $0 - ;; CHECK-BIN-NEXT: (block $label$1 (type $3) (result i32 (ref null $mixed_results) f64) - ;; CHECK-BIN-NEXT: (unreachable) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (local $scratch (tuple i32 (ref null $mixed_results) f64)) + ;; CHECK-BIN-NEXT: (local $scratch_1 (ref null $mixed_results)) + ;; CHECK-BIN-NEXT: (local $scratch_2 i32) ;; CHECK-BIN-NEXT: (drop ;; CHECK-BIN-NEXT: (block (result i32) - ;; CHECK-BIN-NEXT: (local.set $2 + ;; CHECK-BIN-NEXT: (local.set $scratch_2 ;; CHECK-BIN-NEXT: (tuple.extract 3 0 - ;; CHECK-BIN-NEXT: (local.get $0) + ;; CHECK-BIN-NEXT: (local.tee $scratch + ;; CHECK-BIN-NEXT: (block (type $3) (result i32 (ref null $mixed_results) f64) + ;; CHECK-BIN-NEXT: (unreachable) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop ;; CHECK-BIN-NEXT: (block (result (ref null $mixed_results)) - ;; CHECK-BIN-NEXT: (local.set $1 + ;; CHECK-BIN-NEXT: (local.set $scratch_1 ;; CHECK-BIN-NEXT: (tuple.extract 3 1 - ;; CHECK-BIN-NEXT: (local.get $0) + ;; CHECK-BIN-NEXT: (local.get $scratch) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop ;; CHECK-BIN-NEXT: (tuple.extract 3 2 - ;; CHECK-BIN-NEXT: (local.get $0) + ;; CHECK-BIN-NEXT: (local.get $scratch) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (local.get $1) + ;; CHECK-BIN-NEXT: (local.get $scratch_1) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (local.get $2) + ;; CHECK-BIN-NEXT: (local.get $scratch_2) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -432,37 +431,36 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $8 (type $2) -;; CHECK-BIN-NODEBUG-NEXT: (local $0 (tuple i32 (ref null $0) f64)) -;; CHECK-BIN-NODEBUG-NEXT: (local $1 (ref null $0)) -;; CHECK-BIN-NODEBUG-NEXT: (local $2 i32) -;; CHECK-BIN-NODEBUG-NEXT: (local.set $0 -;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 (type $3) (result i32 (ref null $0) f64) -;; CHECK-BIN-NODEBUG-NEXT: (unreachable) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (local $scratch (tuple i32 (ref null $0) f64)) +;; CHECK-BIN-NODEBUG-NEXT: (local $scratch_1 (ref null $0)) +;; CHECK-BIN-NODEBUG-NEXT: (local $scratch_2 i32) ;; CHECK-BIN-NODEBUG-NEXT: (drop ;; CHECK-BIN-NODEBUG-NEXT: (block (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (local.set $2 +;; CHECK-BIN-NODEBUG-NEXT: (local.set $scratch_2 ;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 3 0 -;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) +;; CHECK-BIN-NODEBUG-NEXT: (local.tee $scratch +;; CHECK-BIN-NODEBUG-NEXT: (block (type $3) (result i32 (ref null $0) f64) +;; CHECK-BIN-NODEBUG-NEXT: (unreachable) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop ;; CHECK-BIN-NODEBUG-NEXT: (block (result (ref null $0)) -;; CHECK-BIN-NODEBUG-NEXT: (local.set $1 +;; CHECK-BIN-NODEBUG-NEXT: (local.set $scratch_1 ;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 3 1 -;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) +;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop ;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 3 2 -;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) +;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (local.get $1) +;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch_1) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (local.get $2) +;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch_2) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) diff --git a/test/lit/basic/unit.wat b/test/lit/basic/unit.wat index 5846febd55d..2bf67ff4b73 100644 --- a/test/lit/basic/unit.wat +++ b/test/lit/basic/unit.wat @@ -215,7 +215,7 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $importedDoubles (type $4) (result f64) ;; CHECK-BIN-NEXT: (local $temp f64) - ;; CHECK-BIN-NEXT: (block $label$1 (result f64) + ;; CHECK-BIN-NEXT: (block $block (result f64) ;; CHECK-BIN-NEXT: (local.set $temp ;; CHECK-BIN-NEXT: (f64.add ;; CHECK-BIN-NEXT: (f64.add @@ -248,7 +248,7 @@ ;; CHECK-BIN-NEXT: (i32.const 0) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (then - ;; CHECK-BIN-NEXT: (br $label$1 + ;; CHECK-BIN-NEXT: (br $block ;; CHECK-BIN-NEXT: (f64.const -3.4) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -261,7 +261,7 @@ ;; CHECK-BIN-NEXT: (f64.const 0) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (then - ;; CHECK-BIN-NEXT: (br $label$1 + ;; CHECK-BIN-NEXT: (br $block ;; CHECK-BIN-NEXT: (f64.const 5.6) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -381,14 +381,14 @@ ;; CHECK-BIN-NEXT: (local $t f64) ;; CHECK-BIN-NEXT: (local $Int f64) ;; CHECK-BIN-NEXT: (local $Double i32) - ;; CHECK-BIN-NEXT: (block $label$1 (result f64) + ;; CHECK-BIN-NEXT: (block $block (result f64) ;; CHECK-BIN-NEXT: (if ;; CHECK-BIN-NEXT: (f64.gt ;; CHECK-BIN-NEXT: (local.get $x) ;; CHECK-BIN-NEXT: (f64.const 0) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (then - ;; CHECK-BIN-NEXT: (br $label$1 + ;; CHECK-BIN-NEXT: (br $block ;; CHECK-BIN-NEXT: (f64.const 1.2) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -399,7 +399,7 @@ ;; CHECK-BIN-NEXT: (f64.const 0) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (then - ;; CHECK-BIN-NEXT: (br $label$1 + ;; CHECK-BIN-NEXT: (br $block ;; CHECK-BIN-NEXT: (f64.const -3.4) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -410,7 +410,7 @@ ;; CHECK-BIN-NEXT: (i32.const 0) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (then - ;; CHECK-BIN-NEXT: (br $label$1 + ;; CHECK-BIN-NEXT: (br $block ;; CHECK-BIN-NEXT: (f64.const 5.6) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -421,7 +421,7 @@ ;; CHECK-BIN-NEXT: (local.get $y) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (then - ;; CHECK-BIN-NEXT: (br $label$1 + ;; CHECK-BIN-NEXT: (br $block ;; CHECK-BIN-NEXT: (local.get $x) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -628,13 +628,13 @@ ;; CHECK-BIN-NEXT: (local $J f64) ;; CHECK-BIN-NEXT: (local.set $J ;; CHECK-BIN-NEXT: (f64.sub - ;; CHECK-BIN-NEXT: (block $label$1 (result f64) + ;; CHECK-BIN-NEXT: (block (result f64) ;; CHECK-BIN-NEXT: (drop ;; CHECK-BIN-NEXT: (f64.const 0.1) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (f64.const 5.1) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (block $label$2 (result f64) + ;; CHECK-BIN-NEXT: (block (result f64) ;; CHECK-BIN-NEXT: (drop ;; CHECK-BIN-NEXT: (f64.const 3.2) ;; CHECK-BIN-NEXT: ) @@ -749,77 +749,80 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $switcher (type $6) (param $x i32) (result i32) - ;; CHECK-BIN-NEXT: (block $label$1 (result i32) - ;; CHECK-BIN-NEXT: (block $label$2 - ;; CHECK-BIN-NEXT: (block $label$3 - ;; CHECK-BIN-NEXT: (block $label$4 - ;; CHECK-BIN-NEXT: (block $label$5 - ;; CHECK-BIN-NEXT: (br_table $label$5 $label$4 $label$3 + ;; CHECK-BIN-NEXT: (block $block2 (result i32) + ;; CHECK-BIN-NEXT: (block + ;; CHECK-BIN-NEXT: (block $block1 + ;; CHECK-BIN-NEXT: (block $block0 + ;; CHECK-BIN-NEXT: (block $block + ;; CHECK-BIN-NEXT: (br_table $block $block0 $block1 ;; CHECK-BIN-NEXT: (i32.sub ;; CHECK-BIN-NEXT: (local.get $x) ;; CHECK-BIN-NEXT: (i32.const 1) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (br $label$1 + ;; CHECK-BIN-NEXT: (br $block2 ;; CHECK-BIN-NEXT: (i32.const 1) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (br $label$1 + ;; CHECK-BIN-NEXT: (br $block2 ;; CHECK-BIN-NEXT: (i32.const 2) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (block $label$6 - ;; CHECK-BIN-NEXT: (block $label$7 - ;; CHECK-BIN-NEXT: (block $label$8 - ;; CHECK-BIN-NEXT: (block $label$9 - ;; CHECK-BIN-NEXT: (br_table $label$8 $label$7 $label$7 $label$7 $label$7 $label$7 $label$7 $label$9 $label$7 + ;; CHECK-BIN-NEXT: (block + ;; CHECK-BIN-NEXT: (block $block4 + ;; CHECK-BIN-NEXT: (block $block3 + ;; CHECK-BIN-NEXT: (block $block5 + ;; CHECK-BIN-NEXT: (br_table $block3 $block4 $block4 $block4 $block4 $block4 $block4 $block5 $block4 ;; CHECK-BIN-NEXT: (i32.sub ;; CHECK-BIN-NEXT: (local.get $x) ;; CHECK-BIN-NEXT: (i32.const 5) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (br $label$1 + ;; CHECK-BIN-NEXT: (br $block2 ;; CHECK-BIN-NEXT: (i32.const 121) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (br $label$1 + ;; CHECK-BIN-NEXT: (br $block2 ;; CHECK-BIN-NEXT: (i32.const 51) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (block $label$10 - ;; CHECK-BIN-NEXT: (block $label$11 - ;; CHECK-BIN-NEXT: (block $label$12 - ;; CHECK-BIN-NEXT: (block $label$13 - ;; CHECK-BIN-NEXT: (block $label$14 - ;; CHECK-BIN-NEXT: (block $label$15 - ;; CHECK-BIN-NEXT: (br_table $label$12 $label$11 $label$11 $label$13 $label$11 $label$11 $label$11 $label$11 $label$14 $label$11 $label$15 $label$11 + ;; CHECK-BIN-NEXT: (block $block11 + ;; CHECK-BIN-NEXT: (block $block7 + ;; CHECK-BIN-NEXT: (block $block6 + ;; CHECK-BIN-NEXT: (block $block8 + ;; CHECK-BIN-NEXT: (block $block9 + ;; CHECK-BIN-NEXT: (block $block10 + ;; CHECK-BIN-NEXT: (br_table $block6 $block7 $block7 $block8 $block7 $block7 $block7 $block7 $block9 $block7 $block10 $block7 ;; CHECK-BIN-NEXT: (i32.sub ;; CHECK-BIN-NEXT: (local.get $x) ;; CHECK-BIN-NEXT: (i32.const 2) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (br $label$10) + ;; CHECK-BIN-NEXT: (br $block11) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (br $label$10) + ;; CHECK-BIN-NEXT: (br $block11) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (block $label$16 - ;; CHECK-BIN-NEXT: (loop $label$17 - ;; CHECK-BIN-NEXT: (br $label$16) + ;; CHECK-BIN-NEXT: (block $block12 + ;; CHECK-BIN-NEXT: (loop + ;; CHECK-BIN-NEXT: (br $block12) ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (unreachable) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (block $label$18 - ;; CHECK-BIN-NEXT: (loop $label$19 - ;; CHECK-BIN-NEXT: (br $label$10) + ;; CHECK-BIN-NEXT: (block + ;; CHECK-BIN-NEXT: (loop + ;; CHECK-BIN-NEXT: (br $block11) ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (unreachable) ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (unreachable) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) @@ -918,8 +921,8 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $blocker (type $FUNCSIG$v) - ;; CHECK-BIN-NEXT: (block $label$1 - ;; CHECK-BIN-NEXT: (br $label$1) + ;; CHECK-BIN-NEXT: (block $block + ;; CHECK-BIN-NEXT: (br $block) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) (func $blocker (type $FUNCSIG$v) @@ -1115,7 +1118,7 @@ ;; CHECK-BIN-NEXT: (local $y f64) ;; CHECK-BIN-NEXT: (local $z f32) ;; CHECK-BIN-NEXT: (local.set $x - ;; CHECK-BIN-NEXT: (block $label$1 (result i32) + ;; CHECK-BIN-NEXT: (block (result i32) ;; CHECK-BIN-NEXT: (local.set $asm2wasm_i32_temp ;; CHECK-BIN-NEXT: (i32.const 0) ;; CHECK-BIN-NEXT: ) @@ -1337,11 +1340,11 @@ ;; CHECK-TEXT-NEXT: (i32.const 0) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $block_and_after (type $5) (result i32) - ;; CHECK-BIN-NEXT: (block $label$1 + ;; CHECK-BIN-NEXT: (block $block ;; CHECK-BIN-NEXT: (drop ;; CHECK-BIN-NEXT: (i32.const 1) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (br $label$1) + ;; CHECK-BIN-NEXT: (br $block) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (i32.const 0) ;; CHECK-BIN-NEXT: ) @@ -1363,7 +1366,7 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $loop-roundtrip (type $7) (param $0 f64) (result f64) - ;; CHECK-BIN-NEXT: (loop $label$1 (result f64) + ;; CHECK-BIN-NEXT: (loop (result f64) ;; CHECK-BIN-NEXT: (drop ;; CHECK-BIN-NEXT: (local.get $0) ;; CHECK-BIN-NEXT: ) @@ -1514,11 +1517,11 @@ ;; CHECK-TEXT-NEXT: (i32.const 1) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $unreachable-block-with-br (type $5) (result i32) - ;; CHECK-BIN-NEXT: (block $label$1 + ;; CHECK-BIN-NEXT: (block $block ;; CHECK-BIN-NEXT: (drop ;; CHECK-BIN-NEXT: (i32.const 1) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (br $label$1) + ;; CHECK-BIN-NEXT: (br $block) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (i32.const 1) ;; CHECK-BIN-NEXT: ) @@ -1560,6 +1563,7 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (unreachable) ;; CHECK-BIN-NEXT: ) (func $unreachable-if (result i32) (f64.abs @@ -1603,6 +1607,7 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (unreachable) ;; CHECK-BIN-NEXT: ) (func $unreachable-if-toplevel (result i32) (if ;; note no type - valid in binaryen IR, in wasm must be i32 @@ -1626,12 +1631,13 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $unreachable-loop (type $5) (result i32) - ;; CHECK-BIN-NEXT: (loop $label$1 + ;; CHECK-BIN-NEXT: (loop ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: (return ;; CHECK-BIN-NEXT: (i32.const 1) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (unreachable) ;; CHECK-BIN-NEXT: ) (func $unreachable-loop (result i32) (f64.abs @@ -1651,11 +1657,12 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $unreachable-loop0 (type $5) (result i32) - ;; CHECK-BIN-NEXT: (loop $label$1 + ;; CHECK-BIN-NEXT: (loop ;; CHECK-BIN-NEXT: (return ;; CHECK-BIN-NEXT: (i32.const 1) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (unreachable) ;; CHECK-BIN-NEXT: ) (func $unreachable-loop0 (result i32) (f64.abs @@ -1673,12 +1680,13 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $unreachable-loop-toplevel (type $5) (result i32) - ;; CHECK-BIN-NEXT: (loop $label$1 + ;; CHECK-BIN-NEXT: (loop ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: (return ;; CHECK-BIN-NEXT: (i32.const 1) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (unreachable) ;; CHECK-BIN-NEXT: ) (func $unreachable-loop-toplevel (result i32) (loop ;; note no type - valid in binaryen IR, in wasm must be i32 @@ -1694,11 +1702,12 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $unreachable-loop0-toplevel (type $5) (result i32) - ;; CHECK-BIN-NEXT: (loop $label$1 + ;; CHECK-BIN-NEXT: (loop ;; CHECK-BIN-NEXT: (return ;; CHECK-BIN-NEXT: (i32.const 1) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (unreachable) ;; CHECK-BIN-NEXT: ) (func $unreachable-loop0-toplevel (result i32) (loop ;; note no type - valid in binaryen IR, in wasm must be i32 @@ -1870,7 +1879,7 @@ ;; CHECK-BIN-NODEBUG: (func $1 (type $3) (result f64) ;; CHECK-BIN-NODEBUG-NEXT: (local $0 f64) -;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 (result f64) +;; CHECK-BIN-NODEBUG-NEXT: (block $block (result f64) ;; CHECK-BIN-NODEBUG-NEXT: (local.set $0 ;; CHECK-BIN-NODEBUG-NEXT: (f64.add ;; CHECK-BIN-NODEBUG-NEXT: (f64.add @@ -1903,7 +1912,7 @@ ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (then -;; CHECK-BIN-NODEBUG-NEXT: (br $label$1 +;; CHECK-BIN-NODEBUG-NEXT: (br $block ;; CHECK-BIN-NODEBUG-NEXT: (f64.const -3.4) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -1916,7 +1925,7 @@ ;; CHECK-BIN-NODEBUG-NEXT: (f64.const 0) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (then -;; CHECK-BIN-NODEBUG-NEXT: (br $label$1 +;; CHECK-BIN-NODEBUG-NEXT: (br $block ;; CHECK-BIN-NODEBUG-NEXT: (f64.const 5.6) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -1929,14 +1938,14 @@ ;; CHECK-BIN-NODEBUG-NEXT: (local $2 f64) ;; CHECK-BIN-NODEBUG-NEXT: (local $3 f64) ;; CHECK-BIN-NODEBUG-NEXT: (local $4 i32) -;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 (result f64) +;; CHECK-BIN-NODEBUG-NEXT: (block $block (result f64) ;; CHECK-BIN-NODEBUG-NEXT: (if ;; CHECK-BIN-NODEBUG-NEXT: (f64.gt ;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) ;; CHECK-BIN-NODEBUG-NEXT: (f64.const 0) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (then -;; CHECK-BIN-NODEBUG-NEXT: (br $label$1 +;; CHECK-BIN-NODEBUG-NEXT: (br $block ;; CHECK-BIN-NODEBUG-NEXT: (f64.const 1.2) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -1947,7 +1956,7 @@ ;; CHECK-BIN-NODEBUG-NEXT: (f64.const 0) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (then -;; CHECK-BIN-NODEBUG-NEXT: (br $label$1 +;; CHECK-BIN-NODEBUG-NEXT: (br $block ;; CHECK-BIN-NODEBUG-NEXT: (f64.const -3.4) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -1958,7 +1967,7 @@ ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (then -;; CHECK-BIN-NODEBUG-NEXT: (br $label$1 +;; CHECK-BIN-NODEBUG-NEXT: (br $block ;; CHECK-BIN-NODEBUG-NEXT: (f64.const 5.6) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -1969,7 +1978,7 @@ ;; CHECK-BIN-NODEBUG-NEXT: (local.get $1) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (then -;; CHECK-BIN-NODEBUG-NEXT: (br $label$1 +;; CHECK-BIN-NODEBUG-NEXT: (br $block ;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -2025,13 +2034,13 @@ ;; CHECK-BIN-NODEBUG-NEXT: (local $0 f64) ;; CHECK-BIN-NODEBUG-NEXT: (local.set $0 ;; CHECK-BIN-NODEBUG-NEXT: (f64.sub -;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 (result f64) +;; CHECK-BIN-NODEBUG-NEXT: (block (result f64) ;; CHECK-BIN-NODEBUG-NEXT: (drop ;; CHECK-BIN-NODEBUG-NEXT: (f64.const 0.1) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (f64.const 5.1) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (block $label$2 (result f64) +;; CHECK-BIN-NODEBUG-NEXT: (block (result f64) ;; CHECK-BIN-NODEBUG-NEXT: (drop ;; CHECK-BIN-NODEBUG-NEXT: (f64.const 3.2) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -2042,77 +2051,80 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $7 (type $6) (param $0 i32) (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (block $label$2 -;; CHECK-BIN-NODEBUG-NEXT: (block $label$3 -;; CHECK-BIN-NODEBUG-NEXT: (block $label$4 -;; CHECK-BIN-NODEBUG-NEXT: (block $label$5 -;; CHECK-BIN-NODEBUG-NEXT: (br_table $label$5 $label$4 $label$3 +;; CHECK-BIN-NODEBUG-NEXT: (block $block2 (result i32) +;; CHECK-BIN-NODEBUG-NEXT: (block +;; CHECK-BIN-NODEBUG-NEXT: (block $block1 +;; CHECK-BIN-NODEBUG-NEXT: (block $block0 +;; CHECK-BIN-NODEBUG-NEXT: (block $block +;; CHECK-BIN-NODEBUG-NEXT: (br_table $block $block0 $block1 ;; CHECK-BIN-NODEBUG-NEXT: (i32.sub ;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (br $label$1 +;; CHECK-BIN-NODEBUG-NEXT: (br $block2 ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (br $label$1 +;; CHECK-BIN-NODEBUG-NEXT: (br $block2 ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 2) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (block $label$6 -;; CHECK-BIN-NODEBUG-NEXT: (block $label$7 -;; CHECK-BIN-NODEBUG-NEXT: (block $label$8 -;; CHECK-BIN-NODEBUG-NEXT: (block $label$9 -;; CHECK-BIN-NODEBUG-NEXT: (br_table $label$8 $label$7 $label$7 $label$7 $label$7 $label$7 $label$7 $label$9 $label$7 +;; CHECK-BIN-NODEBUG-NEXT: (block +;; CHECK-BIN-NODEBUG-NEXT: (block $block4 +;; CHECK-BIN-NODEBUG-NEXT: (block $block3 +;; CHECK-BIN-NODEBUG-NEXT: (block $block5 +;; CHECK-BIN-NODEBUG-NEXT: (br_table $block3 $block4 $block4 $block4 $block4 $block4 $block4 $block5 $block4 ;; CHECK-BIN-NODEBUG-NEXT: (i32.sub ;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 5) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (br $label$1 +;; CHECK-BIN-NODEBUG-NEXT: (br $block2 ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 121) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (br $label$1 +;; CHECK-BIN-NODEBUG-NEXT: (br $block2 ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 51) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (block $label$10 -;; CHECK-BIN-NODEBUG-NEXT: (block $label$11 -;; CHECK-BIN-NODEBUG-NEXT: (block $label$12 -;; CHECK-BIN-NODEBUG-NEXT: (block $label$13 -;; CHECK-BIN-NODEBUG-NEXT: (block $label$14 -;; CHECK-BIN-NODEBUG-NEXT: (block $label$15 -;; CHECK-BIN-NODEBUG-NEXT: (br_table $label$12 $label$11 $label$11 $label$13 $label$11 $label$11 $label$11 $label$11 $label$14 $label$11 $label$15 $label$11 +;; CHECK-BIN-NODEBUG-NEXT: (block $block11 +;; CHECK-BIN-NODEBUG-NEXT: (block $block7 +;; CHECK-BIN-NODEBUG-NEXT: (block $block6 +;; CHECK-BIN-NODEBUG-NEXT: (block $block8 +;; CHECK-BIN-NODEBUG-NEXT: (block $block9 +;; CHECK-BIN-NODEBUG-NEXT: (block $block10 +;; CHECK-BIN-NODEBUG-NEXT: (br_table $block6 $block7 $block7 $block8 $block7 $block7 $block7 $block7 $block9 $block7 $block10 $block7 ;; CHECK-BIN-NODEBUG-NEXT: (i32.sub ;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 2) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (br $label$10) +;; CHECK-BIN-NODEBUG-NEXT: (br $block11) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (br $label$10) +;; CHECK-BIN-NODEBUG-NEXT: (br $block11) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (block $label$16 -;; CHECK-BIN-NODEBUG-NEXT: (loop $label$17 -;; CHECK-BIN-NODEBUG-NEXT: (br $label$16) +;; CHECK-BIN-NODEBUG-NEXT: (block $block12 +;; CHECK-BIN-NODEBUG-NEXT: (loop +;; CHECK-BIN-NODEBUG-NEXT: (br $block12) ;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (unreachable) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (block $label$18 -;; CHECK-BIN-NODEBUG-NEXT: (loop $label$19 -;; CHECK-BIN-NODEBUG-NEXT: (br $label$10) +;; CHECK-BIN-NODEBUG-NEXT: (block +;; CHECK-BIN-NODEBUG-NEXT: (loop +;; CHECK-BIN-NODEBUG-NEXT: (br $block11) ;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (unreachable) ;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (unreachable) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -2121,8 +2133,8 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $8 (type $1) -;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 -;; CHECK-BIN-NODEBUG-NEXT: (br $label$1) +;; CHECK-BIN-NODEBUG-NEXT: (block $block +;; CHECK-BIN-NODEBUG-NEXT: (br $block) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -2182,7 +2194,7 @@ ;; CHECK-BIN-NODEBUG-NEXT: (local $2 f64) ;; CHECK-BIN-NODEBUG-NEXT: (local $3 f32) ;; CHECK-BIN-NODEBUG-NEXT: (local.set $0 -;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 (result i32) +;; CHECK-BIN-NODEBUG-NEXT: (block (result i32) ;; CHECK-BIN-NODEBUG-NEXT: (local.set $1 ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -2265,17 +2277,17 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $19 (type $0) (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 +;; CHECK-BIN-NODEBUG-NEXT: (block $block ;; CHECK-BIN-NODEBUG-NEXT: (drop ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (br $label$1) +;; CHECK-BIN-NODEBUG-NEXT: (br $block) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $20 (type $7) (param $0 f64) (result f64) -;; CHECK-BIN-NODEBUG-NEXT: (loop $label$1 (result f64) +;; CHECK-BIN-NODEBUG-NEXT: (loop (result f64) ;; CHECK-BIN-NODEBUG-NEXT: (drop ;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -2331,11 +2343,11 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $28 (type $0) (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 +;; CHECK-BIN-NODEBUG-NEXT: (block $block ;; CHECK-BIN-NODEBUG-NEXT: (drop ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (br $label$1) +;; CHECK-BIN-NODEBUG-NEXT: (br $block) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -2354,6 +2366,7 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (unreachable) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $30 (type $0) (result i32) @@ -2370,40 +2383,45 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (unreachable) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $31 (type $0) (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (loop $label$1 +;; CHECK-BIN-NODEBUG-NEXT: (loop ;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: (return ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (unreachable) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $32 (type $0) (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (loop $label$1 +;; CHECK-BIN-NODEBUG-NEXT: (loop ;; CHECK-BIN-NODEBUG-NEXT: (return ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (unreachable) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $33 (type $0) (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (loop $label$1 +;; CHECK-BIN-NODEBUG-NEXT: (loop ;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: (return ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (unreachable) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $34 (type $0) (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (loop $label$1 +;; CHECK-BIN-NODEBUG-NEXT: (loop ;; CHECK-BIN-NODEBUG-NEXT: (return ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (unreachable) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $35 (type $1) diff --git a/test/lit/basic/unreachable-code.wast b/test/lit/basic/unreachable-code.wast index 0dfb00c4022..baf1564960f 100644 --- a/test/lit/basic/unreachable-code.wast +++ b/test/lit/basic/unreachable-code.wast @@ -59,6 +59,7 @@ ;; CHECK-BIN-NEXT: (unreachable) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (unreachable) ;; CHECK-BIN-NEXT: ) (func $b (if (i32.const 1) @@ -118,6 +119,7 @@ ;; CHECK-BIN-NEXT: (unreachable) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (unreachable) ;; CHECK-BIN-NEXT: ) (func $b-block (block @@ -186,6 +188,7 @@ ;; CHECK-BIN-NEXT: (unreachable) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (unreachable) ;; CHECK-BIN-NEXT: ) (func $b-prepost (nop) @@ -260,6 +263,7 @@ ;; CHECK-BIN-NEXT: (unreachable) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (unreachable) ;; CHECK-BIN-NEXT: ) (func $b-block-prepost (nop) @@ -289,9 +293,9 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $recurse (type $0) ;; CHECK-BIN-NEXT: (nop) - ;; CHECK-BIN-NEXT: (block $label$1 + ;; CHECK-BIN-NEXT: (block $block ;; CHECK-BIN-NEXT: (nop) - ;; CHECK-BIN-NEXT: (br $label$1) + ;; CHECK-BIN-NEXT: (br $block) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) @@ -319,12 +323,13 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $recurse-b (type $0) - ;; CHECK-BIN-NEXT: (block $label$1 + ;; CHECK-BIN-NEXT: (block $block ;; CHECK-BIN-NEXT: (nop) - ;; CHECK-BIN-NEXT: (block $label$2 + ;; CHECK-BIN-NEXT: (block ;; CHECK-BIN-NEXT: (nop) - ;; CHECK-BIN-NEXT: (br $label$1) + ;; CHECK-BIN-NEXT: (br $block) ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (unreachable) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) (func $recurse-b @@ -360,6 +365,7 @@ ;; CHECK-BIN-NODEBUG-NEXT: (unreachable) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (unreachable) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $2 (type $0) @@ -381,6 +387,7 @@ ;; CHECK-BIN-NODEBUG-NEXT: (unreachable) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (unreachable) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $4 (type $0) @@ -405,6 +412,7 @@ ;; CHECK-BIN-NODEBUG-NEXT: (unreachable) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (unreachable) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $6 (type $0) @@ -429,23 +437,25 @@ ;; CHECK-BIN-NODEBUG-NEXT: (unreachable) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (unreachable) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $8 (type $0) ;; CHECK-BIN-NODEBUG-NEXT: (nop) -;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 +;; CHECK-BIN-NODEBUG-NEXT: (block $block ;; CHECK-BIN-NODEBUG-NEXT: (nop) -;; CHECK-BIN-NODEBUG-NEXT: (br $label$1) +;; CHECK-BIN-NODEBUG-NEXT: (br $block) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $9 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 +;; CHECK-BIN-NODEBUG-NEXT: (block $block ;; CHECK-BIN-NODEBUG-NEXT: (nop) -;; CHECK-BIN-NODEBUG-NEXT: (block $label$2 +;; CHECK-BIN-NODEBUG-NEXT: (block ;; CHECK-BIN-NODEBUG-NEXT: (nop) -;; CHECK-BIN-NODEBUG-NEXT: (br $label$1) +;; CHECK-BIN-NODEBUG-NEXT: (br $block) ;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (unreachable) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) diff --git a/test/lit/basic/untaken-br_if.wast b/test/lit/basic/untaken-br_if.wast index bf2ad1ce3db..4d982654977 100644 --- a/test/lit/basic/untaken-br_if.wast +++ b/test/lit/basic/untaken-br_if.wast @@ -37,12 +37,10 @@ ;; CHECK-BIN-NEXT: (unreachable) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (else - ;; CHECK-BIN-NEXT: (block $label$3 (result f32) - ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (f32.const 1) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (unreachable) + ;; CHECK-BIN-NEXT: (drop + ;; CHECK-BIN-NEXT: (f32.const 1) ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (unreachable) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -72,12 +70,10 @@ ;; CHECK-BIN-NODEBUG-NEXT: (unreachable) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (else -;; CHECK-BIN-NODEBUG-NEXT: (block $label$3 (result f32) -;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (f32.const 1) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (unreachable) +;; CHECK-BIN-NODEBUG-NEXT: (drop +;; CHECK-BIN-NODEBUG-NEXT: (f32.const 1) ;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (unreachable) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) diff --git a/test/lit/binary/bad-delegate.test b/test/lit/binary/bad-delegate.test deleted file mode 100644 index 8e6a011a548..00000000000 --- a/test/lit/binary/bad-delegate.test +++ /dev/null @@ -1,17 +0,0 @@ -;; Test that we error properly on a file with a bad delegate (a delegate of an -;; index that does not refer to a valid try-catch). - -;; Disassembled binary from wabt: -;; -;; (module -;; (type (;0;) (func)) -;; (func (;0;) (type 0) -;; block ;; label = @1 -;; try ;; label = @2 -;; nop -;; delegate 0 -;; end)) - -;; RUN: not wasm-opt -all %s.wasm 2>&1 | filecheck %s - -;; CHECK: exceptionTargetNames not empty - invalid delegate diff --git a/test/lit/binary/declarative-element-use-expr.test b/test/lit/binary/declarative-element-use-expr.test index aecdf9ebde9..fa0eb965f52 100644 --- a/test/lit/binary/declarative-element-use-expr.test +++ b/test/lit/binary/declarative-element-use-expr.test @@ -13,16 +13,14 @@ ;; preserve declarative segments. This is fine, as we test that the ;; binary parser can parse it correctly. -;; RUN: wasm-opt -all %s.wasm -all --print | filecheck %s +;; RUN: wasm-opt -all %s.wasm -S -o - | filecheck %s ;; CHECK: (module ;; CHECK-NEXT: (type $0 (func)) ;; CHECK-NEXT: (elem declare func $0) ;; CHECK-NEXT: (func $0 (type $0) -;; CHECK-NEXT: (block $label$1 -;; CHECK-NEXT: (drop -;; CHECK-NEXT: (ref.func $0) -;; CHECK-NEXT: ) +;; CHECK-NEXT: (drop +;; CHECK-NEXT: (ref.func $0) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) diff --git a/test/lit/binary/delegate-block.test b/test/lit/binary/delegate-block.test new file mode 100644 index 00000000000..7da386cb0c1 --- /dev/null +++ b/test/lit/binary/delegate-block.test @@ -0,0 +1,27 @@ +;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. + +;; Test that we can parse a binary with a delegate that targets a block instead +;; of a try-catch. + +;; Disassembled binary from wabt: +;; +;; (module +;; (type (;0;) (func)) +;; (func (;0;) (type 0) +;; block ;; label = @1 +;; try ;; label = @2 +;; nop +;; delegate 0 +;; end)) + +;; RUN: wasm-opt -all %s.wasm -S -o - | filecheck %s +;; CHECK: (type $0 (func)) + +;; CHECK: (func $0 (type $0) +;; CHECK-NEXT: (try +;; CHECK-NEXT: (do +;; CHECK-NEXT: (nop) +;; CHECK-NEXT: ) +;; CHECK-NEXT: (delegate 0) +;; CHECK-NEXT: ) +;; CHECK-NEXT: ) diff --git a/test/lit/binary/bad-delegate.test.wasm b/test/lit/binary/delegate-block.test.wasm similarity index 100% rename from test/lit/binary/bad-delegate.test.wasm rename to test/lit/binary/delegate-block.test.wasm diff --git a/test/lit/binary/dwarf-multivalue.test b/test/lit/binary/dwarf-multivalue.test index c803dea1400..922256ceffe 100644 --- a/test/lit/binary/dwarf-multivalue.test +++ b/test/lit/binary/dwarf-multivalue.test @@ -39,8 +39,8 @@ ;; (local $10 f32) ;; If we parse this wasm file into Binaryen IR, two locals are added in the -;; process. Here $11 is added for tuple parsing and $12 is added for stacky IR -;; resolving during binary reading process. +;; process. Here $scratch is added for tuple parsing and $scratch_12 is added +;; for stacky IR resolving during binary reading process. ;; RUN: wasm-dis %s.wasm -o - | filecheck %s --check-prefix=ORIG ;; ORIG: (func $test ;; ORIG-NEXT: (local $0 i32) @@ -54,8 +54,8 @@ ;; ORIG-NEXT: (local $8 f32) ;; ORIG-NEXT: (local $9 i32) ;; ORIG-NEXT: (local $10 f32) -;; ORIG-NEXT: (local $11 (tuple i32 f32)) -;; ORIG-NEXT: (local $12 i32) +;; ORIG-NEXT: (local $scratch (tuple i32 f32)) +;; ORIG-NEXT: (local $scratch_12 i32) ;; If we write this IR into binary, even if this cannot be displayed in the wast ;; format, the local order of $test will look like this, because we don't diff --git a/test/lit/binary/stacky-eh-legacy.test b/test/lit/binary/stacky-eh-legacy.test index c22a5165d5d..ffaefc3e465 100644 --- a/test/lit/binary/stacky-eh-legacy.test +++ b/test/lit/binary/stacky-eh-legacy.test @@ -34,7 +34,7 @@ ;; The fixup will hoist the 'pop' and create another local to store it right ;; after 'catch'. -RUN: wasm-opt -all %s.wasm --print | filecheck %s +RUN: wasm-opt -all %s.wasm -S -o - | filecheck %s ;; CHECK: (func $0 ;; CHECK-NEXT: (local $0 i32) diff --git a/test/lit/binary/stacky-nn-tuple.test b/test/lit/binary/stacky-nn-tuple.test index e8a0475b596..731114e34f2 100644 --- a/test/lit/binary/stacky-nn-tuple.test +++ b/test/lit/binary/stacky-nn-tuple.test @@ -36,7 +36,7 @@ # ) # ) -RUN: wasm-opt -all %s.wasm -all --print +RUN: wasm-opt -all %s.wasm -all -S -o - | filecheck %s # CHECK: (module # CHECK-NEXT: (type ${mut:i32} (struct (field (mut i32)))) diff --git a/test/lit/blocktype.wast b/test/lit/blocktype.wast index 0150f0a37c0..805d5d07e51 100644 --- a/test/lit/blocktype.wast +++ b/test/lit/blocktype.wast @@ -25,30 +25,8 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; RTRIP: (func $f1 (type $f1) (result (ref $f1) (ref $f2)) - ;; RTRIP-NEXT: (local $0 (tuple (ref $f1) (ref $f2))) - ;; RTRIP-NEXT: (local $1 (tuple (ref $f1) (ref $f2))) - ;; RTRIP-NEXT: (local.set $1 - ;; RTRIP-NEXT: (loop $label$1 (type $f1) (result (ref $f1) (ref $f2)) - ;; RTRIP-NEXT: (local.set $0 - ;; RTRIP-NEXT: (call $f1) - ;; RTRIP-NEXT: ) - ;; RTRIP-NEXT: (tuple.make 2 - ;; RTRIP-NEXT: (tuple.extract 2 0 - ;; RTRIP-NEXT: (local.get $0) - ;; RTRIP-NEXT: ) - ;; RTRIP-NEXT: (tuple.extract 2 1 - ;; RTRIP-NEXT: (local.get $0) - ;; RTRIP-NEXT: ) - ;; RTRIP-NEXT: ) - ;; RTRIP-NEXT: ) - ;; RTRIP-NEXT: ) - ;; RTRIP-NEXT: (tuple.make 2 - ;; RTRIP-NEXT: (tuple.extract 2 0 - ;; RTRIP-NEXT: (local.get $1) - ;; RTRIP-NEXT: ) - ;; RTRIP-NEXT: (tuple.extract 2 1 - ;; RTRIP-NEXT: (local.get $1) - ;; RTRIP-NEXT: ) + ;; RTRIP-NEXT: (loop (type $f1) (result (ref $f1) (ref $f2)) + ;; RTRIP-NEXT: (call $f1) ;; RTRIP-NEXT: ) ;; RTRIP-NEXT: ) (func $f1 (type $f1) (result (ref $f1) (ref $f2)) @@ -64,30 +42,8 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; RTRIP: (func $f2 (type $f2) (result (ref $f2) (ref $f1)) - ;; RTRIP-NEXT: (local $0 (tuple (ref $f2) (ref $f1))) - ;; RTRIP-NEXT: (local $1 (tuple (ref $f2) (ref $f1))) - ;; RTRIP-NEXT: (local.set $1 - ;; RTRIP-NEXT: (loop $label$1 (type $f2) (result (ref $f2) (ref $f1)) - ;; RTRIP-NEXT: (local.set $0 - ;; RTRIP-NEXT: (call $f2) - ;; RTRIP-NEXT: ) - ;; RTRIP-NEXT: (tuple.make 2 - ;; RTRIP-NEXT: (tuple.extract 2 0 - ;; RTRIP-NEXT: (local.get $0) - ;; RTRIP-NEXT: ) - ;; RTRIP-NEXT: (tuple.extract 2 1 - ;; RTRIP-NEXT: (local.get $0) - ;; RTRIP-NEXT: ) - ;; RTRIP-NEXT: ) - ;; RTRIP-NEXT: ) - ;; RTRIP-NEXT: ) - ;; RTRIP-NEXT: (tuple.make 2 - ;; RTRIP-NEXT: (tuple.extract 2 0 - ;; RTRIP-NEXT: (local.get $1) - ;; RTRIP-NEXT: ) - ;; RTRIP-NEXT: (tuple.extract 2 1 - ;; RTRIP-NEXT: (local.get $1) - ;; RTRIP-NEXT: ) + ;; RTRIP-NEXT: (loop (type $f2) (result (ref $f2) (ref $f1)) + ;; RTRIP-NEXT: (call $f2) ;; RTRIP-NEXT: ) ;; RTRIP-NEXT: ) (func $f2 (type $f2) (result (ref $f2) (ref $f1)) diff --git a/test/lit/cast-and-recast-tuple.wast b/test/lit/cast-and-recast-tuple.wast index 3febcbff7ef..aed0a4fc144 100644 --- a/test/lit/cast-and-recast-tuple.wast +++ b/test/lit/cast-and-recast-tuple.wast @@ -16,46 +16,34 @@ (type $B (sub $A (struct))) ) - ;; CHECK: (func $test-local-tuple-1 (type $5) (param $B (ref $B)) (param $x i32) (result anyref i32) - ;; CHECK-NEXT: (local $2 (tuple (ref $B) i32)) - ;; CHECK-NEXT: (local $3 (ref $B)) - ;; CHECK-NEXT: (local $4 (tuple (ref $A) i32)) - ;; CHECK-NEXT: (local.set $4 - ;; CHECK-NEXT: (block $label$1 (type $3) (result (ref $A) i32) - ;; CHECK-NEXT: (local.set $2 - ;; CHECK-NEXT: (br_if $label$1 - ;; CHECK-NEXT: (tuple.make 2 - ;; CHECK-NEXT: (local.get $B) - ;; CHECK-NEXT: (i32.const 3) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.get $x) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (block (result (ref $B)) - ;; CHECK-NEXT: (local.set $3 - ;; CHECK-NEXT: (tuple.extract 2 0 - ;; CHECK-NEXT: (local.get $2) + ;; CHECK: (func $test-local-tuple-1 (type $3) (param $B (ref $B)) (param $x i32) (result anyref i32) + ;; CHECK-NEXT: (local $scratch (tuple (ref $B) i32)) + ;; CHECK-NEXT: (local $scratch_3 (ref $B)) + ;; CHECK-NEXT: (block $block (type $2) (result (ref $A) i32) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (block (result (ref $B)) + ;; CHECK-NEXT: (local.set $scratch_3 + ;; CHECK-NEXT: (tuple.extract 2 0 + ;; CHECK-NEXT: (local.tee $scratch + ;; CHECK-NEXT: (br_if $block + ;; CHECK-NEXT: (tuple.make 2 + ;; CHECK-NEXT: (local.get $B) + ;; CHECK-NEXT: (i32.const 3) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $x) + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (tuple.extract 2 1 - ;; CHECK-NEXT: (local.get $2) - ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (tuple.extract 2 1 + ;; CHECK-NEXT: (local.get $scratch) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.get $3) ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $scratch_3) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (unreachable) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (tuple.make 2 - ;; CHECK-NEXT: (tuple.extract 2 0 - ;; CHECK-NEXT: (local.get $4) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (tuple.extract 2 1 - ;; CHECK-NEXT: (local.get $4) ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $test-local-tuple-1 (param $B (ref $B)) (param $x i32) (result anyref i32) @@ -77,48 +65,36 @@ ) ) - ;; CHECK: (func $test-local-tuple-2 (type $9) (param $B (ref $B)) (param $x i32) (result i32 i32) + ;; CHECK: (func $test-local-tuple-2 (type $7) (param $B (ref $B)) (param $x i32) (result i32 i32) ;; CHECK-NEXT: (local $temp i32) ;; CHECK-NEXT: (local $3 i32) - ;; CHECK-NEXT: (local $4 (tuple i32 i32)) - ;; CHECK-NEXT: (local $5 i32) - ;; CHECK-NEXT: (local $6 (tuple i32 i32)) - ;; CHECK-NEXT: (local.set $6 - ;; CHECK-NEXT: (block $label$1 (type $4) (result i32 i32) - ;; CHECK-NEXT: (local.set $4 - ;; CHECK-NEXT: (br_if $label$1 - ;; CHECK-NEXT: (tuple.make 2 - ;; CHECK-NEXT: (i32.const -1) - ;; CHECK-NEXT: (i32.const 3) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.get $x) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.set $temp - ;; CHECK-NEXT: (block (result i32) - ;; CHECK-NEXT: (local.set $5 - ;; CHECK-NEXT: (tuple.extract 2 0 - ;; CHECK-NEXT: (local.get $4) + ;; CHECK-NEXT: (local $scratch (tuple i32 i32)) + ;; CHECK-NEXT: (local $scratch_5 i32) + ;; CHECK-NEXT: (block $block (type $4) (result i32 i32) + ;; CHECK-NEXT: (local.set $temp + ;; CHECK-NEXT: (block (result i32) + ;; CHECK-NEXT: (local.set $scratch_5 + ;; CHECK-NEXT: (tuple.extract 2 0 + ;; CHECK-NEXT: (local.tee $scratch + ;; CHECK-NEXT: (br_if $block + ;; CHECK-NEXT: (tuple.make 2 + ;; CHECK-NEXT: (i32.const -1) + ;; CHECK-NEXT: (i32.const 3) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $x) + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.set $3 - ;; CHECK-NEXT: (tuple.extract 2 1 - ;; CHECK-NEXT: (local.get $4) - ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $3 + ;; CHECK-NEXT: (tuple.extract 2 1 + ;; CHECK-NEXT: (local.get $scratch) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.get $5) ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $scratch_5) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (unreachable) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (tuple.make 2 - ;; CHECK-NEXT: (tuple.extract 2 0 - ;; CHECK-NEXT: (local.get $6) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (tuple.extract 2 1 - ;; CHECK-NEXT: (local.get $6) ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $test-local-tuple-2 (param $B (ref $B)) (param $x i32) (result i32 i32) @@ -139,48 +115,36 @@ ) ) - ;; CHECK: (func $test-local-tuple-3 (type $5) (param $B (ref $B)) (param $x i32) (result anyref i32) + ;; CHECK: (func $test-local-tuple-3 (type $3) (param $B (ref $B)) (param $x i32) (result anyref i32) ;; CHECK-NEXT: (local $temp (ref $B)) ;; CHECK-NEXT: (local $3 i32) - ;; CHECK-NEXT: (local $4 (tuple (ref $B) i32)) - ;; CHECK-NEXT: (local $5 (ref $B)) - ;; CHECK-NEXT: (local $6 (tuple (ref $B) i32)) - ;; CHECK-NEXT: (local.set $6 - ;; CHECK-NEXT: (block $label$1 (type $6) (result (ref $B) i32) - ;; CHECK-NEXT: (local.set $4 - ;; CHECK-NEXT: (br_if $label$1 - ;; CHECK-NEXT: (tuple.make 2 - ;; CHECK-NEXT: (local.get $B) - ;; CHECK-NEXT: (i32.const 3) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.get $x) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.set $temp - ;; CHECK-NEXT: (block (result (ref $B)) - ;; CHECK-NEXT: (local.set $5 - ;; CHECK-NEXT: (tuple.extract 2 0 - ;; CHECK-NEXT: (local.get $4) + ;; CHECK-NEXT: (local $scratch (tuple (ref $B) i32)) + ;; CHECK-NEXT: (local $scratch_5 (ref $B)) + ;; CHECK-NEXT: (block $block (type $5) (result (ref $B) i32) + ;; CHECK-NEXT: (local.set $temp + ;; CHECK-NEXT: (block (result (ref $B)) + ;; CHECK-NEXT: (local.set $scratch_5 + ;; CHECK-NEXT: (tuple.extract 2 0 + ;; CHECK-NEXT: (local.tee $scratch + ;; CHECK-NEXT: (br_if $block + ;; CHECK-NEXT: (tuple.make 2 + ;; CHECK-NEXT: (local.get $B) + ;; CHECK-NEXT: (i32.const 3) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $x) + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.set $3 - ;; CHECK-NEXT: (tuple.extract 2 1 - ;; CHECK-NEXT: (local.get $4) - ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $3 + ;; CHECK-NEXT: (tuple.extract 2 1 + ;; CHECK-NEXT: (local.get $scratch) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.get $5) ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $scratch_5) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (unreachable) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (tuple.make 2 - ;; CHECK-NEXT: (tuple.extract 2 0 - ;; CHECK-NEXT: (local.get $6) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (tuple.extract 2 1 - ;; CHECK-NEXT: (local.get $6) ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $test-local-tuple-3 (param $B (ref $B)) (param $x i32) (result anyref i32) @@ -201,64 +165,52 @@ ) ) - ;; CHECK: (func $test-local-tuple-4-bad (type $5) (param $B (ref $B)) (param $x i32) (result anyref i32) + ;; CHECK: (func $test-local-tuple-4-bad (type $3) (param $B (ref $B)) (param $x i32) (result anyref i32) ;; CHECK-NEXT: (local $temp (ref $B)) ;; CHECK-NEXT: (local $3 (ref $A)) ;; CHECK-NEXT: (local $4 i32) ;; CHECK-NEXT: (local $5 i32) - ;; CHECK-NEXT: (local $6 (tuple (ref $B) i32)) - ;; CHECK-NEXT: (local $7 (ref $B)) - ;; CHECK-NEXT: (local $8 (ref $B)) - ;; CHECK-NEXT: (local $9 (tuple (ref $A) i32)) - ;; CHECK-NEXT: (local.set $9 - ;; CHECK-NEXT: (block $label$1 (type $3) (result (ref $A) i32) - ;; CHECK-NEXT: (local.set $6 - ;; CHECK-NEXT: (br_if $label$1 - ;; CHECK-NEXT: (tuple.make 2 - ;; CHECK-NEXT: (local.get $B) - ;; CHECK-NEXT: (i32.const 3) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.get $x) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.set $3 - ;; CHECK-NEXT: (block (result (ref $B)) - ;; CHECK-NEXT: (local.set $7 - ;; CHECK-NEXT: (tuple.extract 2 0 - ;; CHECK-NEXT: (local.get $6) + ;; CHECK-NEXT: (local $scratch (tuple (ref $B) i32)) + ;; CHECK-NEXT: (local $scratch_7 (ref $B)) + ;; CHECK-NEXT: (local $scratch_8 (ref $B)) + ;; CHECK-NEXT: (block $block (type $2) (result (ref $A) i32) + ;; CHECK-NEXT: (local.set $3 + ;; CHECK-NEXT: (block (result (ref $B)) + ;; CHECK-NEXT: (local.set $scratch_7 + ;; CHECK-NEXT: (tuple.extract 2 0 + ;; CHECK-NEXT: (local.tee $scratch + ;; CHECK-NEXT: (br_if $block + ;; CHECK-NEXT: (tuple.make 2 + ;; CHECK-NEXT: (local.get $B) + ;; CHECK-NEXT: (i32.const 3) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $x) + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.set $5 - ;; CHECK-NEXT: (tuple.extract 2 1 - ;; CHECK-NEXT: (local.get $6) - ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $5 + ;; CHECK-NEXT: (tuple.extract 2 1 + ;; CHECK-NEXT: (local.get $scratch) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.get $7) ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $scratch_7) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.set $temp - ;; CHECK-NEXT: (block (result (ref $B)) - ;; CHECK-NEXT: (local.set $8 - ;; CHECK-NEXT: (ref.cast (ref $B) - ;; CHECK-NEXT: (local.get $3) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.set $4 - ;; CHECK-NEXT: (local.get $5) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $temp + ;; CHECK-NEXT: (block (result (ref $B)) + ;; CHECK-NEXT: (local.set $scratch_8 + ;; CHECK-NEXT: (ref.cast (ref $B) + ;; CHECK-NEXT: (local.get $3) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.get $8) ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $4 + ;; CHECK-NEXT: (local.get $5) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $scratch_8) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (unreachable) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (tuple.make 2 - ;; CHECK-NEXT: (tuple.extract 2 0 - ;; CHECK-NEXT: (local.get $9) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (tuple.extract 2 1 - ;; CHECK-NEXT: (local.get $9) ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $test-local-tuple-4-bad (param $B (ref $B)) (param $x i32) (result anyref i32) @@ -284,106 +236,91 @@ ) ) - ;; CHECK: (func $test-local-tuple-4-bad-dupes (type $10) (param $B (ref $B)) (param $x i32) (result i32 anyref i32) + ;; CHECK: (func $test-local-tuple-4-bad-dupes (type $8) (param $B (ref $B)) (param $x i32) (result i32 anyref i32) ;; CHECK-NEXT: (local $temp (ref $B)) ;; CHECK-NEXT: (local $3 (ref $B)) ;; CHECK-NEXT: (local $4 (ref $A)) ;; CHECK-NEXT: (local $5 i32) - ;; CHECK-NEXT: (local $scratch i32) + ;; CHECK-NEXT: (local $scratch_16 i32) ;; CHECK-NEXT: (local $7 i32) ;; CHECK-NEXT: (local $8 i32) ;; CHECK-NEXT: (local $9 i32) - ;; CHECK-NEXT: (local $10 (tuple i32 (ref $B) i32)) - ;; CHECK-NEXT: (local $11 (ref $B)) - ;; CHECK-NEXT: (local $12 i32) - ;; CHECK-NEXT: (local $13 (ref $B)) - ;; CHECK-NEXT: (local $14 i32) - ;; CHECK-NEXT: (local $15 (ref $B)) - ;; CHECK-NEXT: (local $16 (tuple i32 (ref $A) i32)) - ;; CHECK-NEXT: (local.set $16 - ;; CHECK-NEXT: (block $label$1 (type $7) (result i32 (ref $A) i32) - ;; CHECK-NEXT: (local.set $10 - ;; CHECK-NEXT: (br_if $label$1 - ;; CHECK-NEXT: (tuple.make 3 - ;; CHECK-NEXT: (i32.const -3) - ;; CHECK-NEXT: (local.get $B) - ;; CHECK-NEXT: (i32.const 3) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.get $x) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.set $9 - ;; CHECK-NEXT: (block (result i32) - ;; CHECK-NEXT: (local.set $12 - ;; CHECK-NEXT: (tuple.extract 3 0 - ;; CHECK-NEXT: (local.get $10) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.set $4 - ;; CHECK-NEXT: (block (result (ref $B)) - ;; CHECK-NEXT: (local.set $11 - ;; CHECK-NEXT: (tuple.extract 3 1 - ;; CHECK-NEXT: (local.get $10) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.set $8 - ;; CHECK-NEXT: (tuple.extract 3 2 - ;; CHECK-NEXT: (local.get $10) + ;; CHECK-NEXT: (local $scratch (tuple i32 (ref $B) i32)) + ;; CHECK-NEXT: (local $scratch_11 (ref $B)) + ;; CHECK-NEXT: (local $scratch_12 i32) + ;; CHECK-NEXT: (local $scratch_13 (ref $B)) + ;; CHECK-NEXT: (local $scratch_14 i32) + ;; CHECK-NEXT: (local $scratch_15 (ref $B)) + ;; CHECK-NEXT: (block $block (type $6) (result i32 (ref $A) i32) + ;; CHECK-NEXT: (local.set $9 + ;; CHECK-NEXT: (block (result i32) + ;; CHECK-NEXT: (local.set $scratch_12 + ;; CHECK-NEXT: (tuple.extract 3 0 + ;; CHECK-NEXT: (local.tee $scratch + ;; CHECK-NEXT: (br_if $block + ;; CHECK-NEXT: (tuple.make 3 + ;; CHECK-NEXT: (i32.const -3) + ;; CHECK-NEXT: (local.get $B) + ;; CHECK-NEXT: (i32.const 3) ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $x) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.get $11) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.get $12) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (local.tee $scratch - ;; CHECK-NEXT: (block (result i32) - ;; CHECK-NEXT: (local.set $14 - ;; CHECK-NEXT: (local.get $9) + ;; CHECK-NEXT: (local.set $4 + ;; CHECK-NEXT: (block (result (ref $B)) + ;; CHECK-NEXT: (local.set $scratch_11 + ;; CHECK-NEXT: (tuple.extract 3 1 + ;; CHECK-NEXT: (local.get $scratch) + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.set $3 - ;; CHECK-NEXT: (block (result (ref $B)) - ;; CHECK-NEXT: (local.set $13 - ;; CHECK-NEXT: (ref.cast (ref $B) - ;; CHECK-NEXT: (local.get $4) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.set $7 - ;; CHECK-NEXT: (local.get $8) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.get $13) + ;; CHECK-NEXT: (local.set $8 + ;; CHECK-NEXT: (tuple.extract 3 2 + ;; CHECK-NEXT: (local.get $scratch) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.get $14) + ;; CHECK-NEXT: (local.get $scratch_11) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $scratch_12) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.set $temp - ;; CHECK-NEXT: (block (result (ref $B)) - ;; CHECK-NEXT: (local.set $15 - ;; CHECK-NEXT: (local.get $3) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (local.tee $scratch_16 + ;; CHECK-NEXT: (block (result i32) + ;; CHECK-NEXT: (local.set $scratch_14 + ;; CHECK-NEXT: (local.get $9) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.set $5 - ;; CHECK-NEXT: (local.get $7) + ;; CHECK-NEXT: (local.set $3 + ;; CHECK-NEXT: (block (result (ref $B)) + ;; CHECK-NEXT: (local.set $scratch_13 + ;; CHECK-NEXT: (ref.cast (ref $B) + ;; CHECK-NEXT: (local.get $4) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $7 + ;; CHECK-NEXT: (local.get $8) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $scratch_13) + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.get $15) + ;; CHECK-NEXT: (local.get $scratch_14) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (unreachable) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (tuple.make 3 - ;; CHECK-NEXT: (tuple.extract 3 0 - ;; CHECK-NEXT: (local.get $16) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (tuple.extract 3 1 - ;; CHECK-NEXT: (local.get $16) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (tuple.extract 3 2 - ;; CHECK-NEXT: (local.get $16) + ;; CHECK-NEXT: (local.set $temp + ;; CHECK-NEXT: (block (result (ref $B)) + ;; CHECK-NEXT: (local.set $scratch_15 + ;; CHECK-NEXT: (local.get $3) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $5 + ;; CHECK-NEXT: (local.get $7) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $scratch_15) + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $test-local-tuple-4-bad-dupes (param $B (ref $B)) (param $x i32) (result i32 anyref i32) diff --git a/test/lit/cast-and-recast.wast b/test/lit/cast-and-recast.wast index a2fe4371146..ce2af9d9845 100644 --- a/test/lit/cast-and-recast.wast +++ b/test/lit/cast-and-recast.wast @@ -19,9 +19,9 @@ ) ;; CHECK: (func $test (type $3) (param $B (ref $B)) (param $x i32) (result anyref) - ;; CHECK-NEXT: (block $label$1 (result (ref $A)) + ;; CHECK-NEXT: (block $block (result (ref $A)) ;; CHECK-NEXT: (ref.cast (ref $B) - ;; CHECK-NEXT: (br_if $label$1 + ;; CHECK-NEXT: (br_if $block ;; CHECK-NEXT: (local.get $B) ;; CHECK-NEXT: (local.get $x) ;; CHECK-NEXT: ) @@ -41,9 +41,9 @@ ) ;; CHECK: (func $test-cast (type $3) (param $B (ref $B)) (param $x i32) (result anyref) - ;; CHECK-NEXT: (block $label$1 (result (ref $A)) + ;; CHECK-NEXT: (block $block (result (ref $A)) ;; CHECK-NEXT: (ref.cast (ref $B) - ;; CHECK-NEXT: (br_if $label$1 + ;; CHECK-NEXT: (br_if $block ;; CHECK-NEXT: (local.get $B) ;; CHECK-NEXT: (local.get $x) ;; CHECK-NEXT: ) @@ -64,9 +64,9 @@ ) ;; CHECK: (func $test-cast-more (type $3) (param $B (ref $B)) (param $x i32) (result anyref) - ;; CHECK-NEXT: (block $label$1 (result (ref $A)) + ;; CHECK-NEXT: (block $block (result (ref $A)) ;; CHECK-NEXT: (ref.cast (ref $C) - ;; CHECK-NEXT: (br_if $label$1 + ;; CHECK-NEXT: (br_if $block ;; CHECK-NEXT: (local.get $B) ;; CHECK-NEXT: (local.get $x) ;; CHECK-NEXT: ) @@ -87,9 +87,9 @@ ) ;; CHECK: (func $test-cast-less (type $3) (param $B (ref $B)) (param $x i32) (result anyref) - ;; CHECK-NEXT: (block $label$1 (result (ref $A)) + ;; CHECK-NEXT: (block $block (result (ref $A)) ;; CHECK-NEXT: (ref.cast (ref $B) - ;; CHECK-NEXT: (br_if $label$1 + ;; CHECK-NEXT: (br_if $block ;; CHECK-NEXT: (local.get $B) ;; CHECK-NEXT: (local.get $x) ;; CHECK-NEXT: ) @@ -112,10 +112,10 @@ ;; CHECK: (func $test-local (type $3) (param $B (ref $B)) (param $x i32) (result anyref) ;; CHECK-NEXT: (local $temp (ref $B)) - ;; CHECK-NEXT: (block $label$1 (result (ref $A)) + ;; CHECK-NEXT: (block $block (result (ref $A)) ;; CHECK-NEXT: (local.set $temp ;; CHECK-NEXT: (ref.cast (ref $B) - ;; CHECK-NEXT: (br_if $label$1 + ;; CHECK-NEXT: (br_if $block ;; CHECK-NEXT: (local.get $B) ;; CHECK-NEXT: (local.get $x) ;; CHECK-NEXT: ) @@ -140,9 +140,9 @@ ) ;; CHECK: (func $test-drop (type $3) (param $B (ref $B)) (param $x i32) (result anyref) - ;; CHECK-NEXT: (block $label$1 (result (ref $A)) + ;; CHECK-NEXT: (block $block (result (ref $A)) ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (br_if $label$1 + ;; CHECK-NEXT: (br_if $block ;; CHECK-NEXT: (local.get $B) ;; CHECK-NEXT: (local.get $x) ;; CHECK-NEXT: ) @@ -164,8 +164,8 @@ ) ;; CHECK: (func $test-same (type $4) (param $A (ref $A)) (param $x i32) (result anyref) - ;; CHECK-NEXT: (block $label$1 (result (ref $A)) - ;; CHECK-NEXT: (br_if $label$1 + ;; CHECK-NEXT: (block $block (result (ref $A)) + ;; CHECK-NEXT: (br_if $block ;; CHECK-NEXT: (local.get $A) ;; CHECK-NEXT: (local.get $x) ;; CHECK-NEXT: ) diff --git a/test/lit/cast-to-basic.wast b/test/lit/cast-to-basic.wast index 4c2e7c047a0..7c45cf8a3e4 100644 --- a/test/lit/cast-to-basic.wast +++ b/test/lit/cast-to-basic.wast @@ -33,9 +33,9 @@ ;; CHECK: (func $br (type $0) (param $anyref anyref) ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (block $label$1 (result structref) + ;; CHECK-NEXT: (block $block (result structref) ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (br_on_cast $label$1 anyref (ref struct) + ;; CHECK-NEXT: (br_on_cast $block anyref (ref struct) ;; CHECK-NEXT: (local.get $anyref) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -58,9 +58,9 @@ ;; CHECK: (func $br-null (type $0) (param $anyref anyref) ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (block $label$1 (result structref) + ;; CHECK-NEXT: (block $block (result structref) ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (br_on_cast $label$1 anyref structref + ;; CHECK-NEXT: (br_on_cast $block anyref structref ;; CHECK-NEXT: (local.get $anyref) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -83,9 +83,9 @@ ;; CHECK: (func $br-fail-null (type $0) (param $anyref anyref) ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (block $label$1 (result anyref) + ;; CHECK-NEXT: (block $block (result anyref) ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (br_on_cast_fail $label$1 anyref structref + ;; CHECK-NEXT: (br_on_cast_fail $block anyref structref ;; CHECK-NEXT: (local.get $anyref) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) diff --git a/test/lit/debug/source-map-stop.wast b/test/lit/debug/source-map-stop.wast index 95545e65a9b..04a77d9eaed 100644 --- a/test/lit/debug/source-map-stop.wast +++ b/test/lit/debug/source-map-stop.wast @@ -142,6 +142,8 @@ ;; CHECK-NEXT: (return) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ;;@ + ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) (func $foo (param $x i32) (param $y i32) ;;@ src.cpp:90:1 diff --git a/test/lit/downgrade-reftypes.wast b/test/lit/downgrade-reftypes.wast index 76d8d99750f..204bca2e7b1 100644 --- a/test/lit/downgrade-reftypes.wast +++ b/test/lit/downgrade-reftypes.wast @@ -13,29 +13,29 @@ ;; CHECK: (func $foo (type $f) ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (block $label$1 (result funcref) - ;; CHECK-NEXT: (br $label$1 + ;; CHECK-NEXT: (block $block (result funcref) + ;; CHECK-NEXT: (br $block ;; CHECK-NEXT: (ref.func $foo) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (block $label$2 (result funcref) - ;; CHECK-NEXT: (br $label$2 + ;; CHECK-NEXT: (block $block0 (result funcref) + ;; CHECK-NEXT: (br $block0 ;; CHECK-NEXT: (ref.null nofunc) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (block $label$3 (result externref) - ;; CHECK-NEXT: (br $label$3 + ;; CHECK-NEXT: (block $block1 (result externref) + ;; CHECK-NEXT: (br $block1 ;; CHECK-NEXT: (ref.null noextern) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (block $label$4 (result stringref) - ;; CHECK-NEXT: (br $label$4 + ;; CHECK-NEXT: (block $block2 (result stringref) + ;; CHECK-NEXT: (br $block2 ;; CHECK-NEXT: (string.const "hello world") ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) diff --git a/test/lit/multivalue-stack-ir.wast b/test/lit/multivalue-stack-ir.wast index b4a394a05bc..97c353eb416 100644 --- a/test/lit/multivalue-stack-ir.wast +++ b/test/lit/multivalue-stack-ir.wast @@ -9,16 +9,16 @@ ;; CHECK-NEXT: (local $pair f32) ;; CHECK-NEXT: (local $f32 f32) ;; CHECK-NEXT: (local $2 i32) - ;; CHECK-NEXT: (local $3 f32) + ;; CHECK-NEXT: (local $scratch f32) ;; CHECK-NEXT: (local.set $pair ;; CHECK-NEXT: (block (result f32) - ;; CHECK-NEXT: (local.set $3 + ;; CHECK-NEXT: (local.set $scratch ;; CHECK-NEXT: (f32.const 0) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (local.set $2 ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.get $3) + ;; CHECK-NEXT: (local.get $scratch) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (local.set $f32 diff --git a/test/lit/multivalue.wast b/test/lit/multivalue.wast index 0cfafb2a989..bb173c35343 100644 --- a/test/lit/multivalue.wast +++ b/test/lit/multivalue.wast @@ -28,35 +28,32 @@ ) ;; CHECK: (func $get-first (type $6) (result i32) - ;; CHECK-NEXT: (local $0 (tuple i32 i64 f32)) - ;; CHECK-NEXT: (local $1 i64) - ;; CHECK-NEXT: (local $2 i32) - ;; CHECK-NEXT: (local.set $0 - ;; CHECK-NEXT: (call $triple) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (block (result i32) - ;; CHECK-NEXT: (local.set $2 - ;; CHECK-NEXT: (tuple.extract 3 0 - ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local $scratch (tuple i32 i64 f32)) + ;; CHECK-NEXT: (local $scratch_1 i64) + ;; CHECK-NEXT: (local $scratch_2 i32) + ;; CHECK-NEXT: (local.set $scratch_2 + ;; CHECK-NEXT: (tuple.extract 3 0 + ;; CHECK-NEXT: (local.tee $scratch + ;; CHECK-NEXT: (call $triple) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (block (result i64) - ;; CHECK-NEXT: (local.set $1 - ;; CHECK-NEXT: (tuple.extract 3 1 - ;; CHECK-NEXT: (local.get $0) - ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (block (result i64) + ;; CHECK-NEXT: (local.set $scratch_1 + ;; CHECK-NEXT: (tuple.extract 3 1 + ;; CHECK-NEXT: (local.get $scratch) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (tuple.extract 3 2 - ;; CHECK-NEXT: (local.get $0) - ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (tuple.extract 3 2 + ;; CHECK-NEXT: (local.get $scratch) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.get $1) ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $scratch_1) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.get $2) ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $scratch_2) ;; CHECK-NEXT: ) (func $get-first (result i32) (tuple.extract 3 0 @@ -64,37 +61,36 @@ ) ) - ;; CHECK: (func $get-second (type $3) (result i64) + ;; CHECK: (func $get-second (type $2) (result i64) ;; CHECK-NEXT: (local $0 i64) - ;; CHECK-NEXT: (local $1 (tuple i32 i64 f32)) - ;; CHECK-NEXT: (local $2 i64) - ;; CHECK-NEXT: (local $3 i32) - ;; CHECK-NEXT: (local.set $1 - ;; CHECK-NEXT: (call $triple) - ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local $scratch (tuple i32 i64 f32)) + ;; CHECK-NEXT: (local $scratch_2 i64) + ;; CHECK-NEXT: (local $scratch_3 i32) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (block (result i32) - ;; CHECK-NEXT: (local.set $3 + ;; CHECK-NEXT: (local.set $scratch_3 ;; CHECK-NEXT: (tuple.extract 3 0 - ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (local.tee $scratch + ;; CHECK-NEXT: (call $triple) + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (local.set $0 ;; CHECK-NEXT: (block (result i64) - ;; CHECK-NEXT: (local.set $2 + ;; CHECK-NEXT: (local.set $scratch_2 ;; CHECK-NEXT: (tuple.extract 3 1 - ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (local.get $scratch) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (tuple.extract 3 2 - ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (local.get $scratch) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: (local.get $scratch_2) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.get $3) + ;; CHECK-NEXT: (local.get $scratch_3) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (local.get $0) @@ -107,35 +103,34 @@ ;; CHECK: (func $get-third (type $7) (result f32) ;; CHECK-NEXT: (local $0 f32) - ;; CHECK-NEXT: (local $1 (tuple i32 i64 f32)) - ;; CHECK-NEXT: (local $2 i64) - ;; CHECK-NEXT: (local $3 i32) - ;; CHECK-NEXT: (local.set $1 - ;; CHECK-NEXT: (call $triple) - ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local $scratch (tuple i32 i64 f32)) + ;; CHECK-NEXT: (local $scratch_2 i64) + ;; CHECK-NEXT: (local $scratch_3 i32) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (block (result i32) - ;; CHECK-NEXT: (local.set $3 + ;; CHECK-NEXT: (local.set $scratch_3 ;; CHECK-NEXT: (tuple.extract 3 0 - ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (local.tee $scratch + ;; CHECK-NEXT: (call $triple) + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (block (result i64) - ;; CHECK-NEXT: (local.set $2 + ;; CHECK-NEXT: (local.set $scratch_2 ;; CHECK-NEXT: (tuple.extract 3 1 - ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (local.get $scratch) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (local.set $0 ;; CHECK-NEXT: (tuple.extract 3 2 - ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (local.get $scratch) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: (local.get $scratch_2) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.get $3) + ;; CHECK-NEXT: (local.get $scratch_3) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (local.get $0) @@ -146,39 +141,38 @@ ) ) - ;; CHECK: (func $reverse (type $4) (result f32 i64 i32) + ;; CHECK: (func $reverse (type $3) (result f32 i64 i32) ;; CHECK-NEXT: (local $x i32) ;; CHECK-NEXT: (local $1 i64) ;; CHECK-NEXT: (local $2 f32) - ;; CHECK-NEXT: (local $3 (tuple i32 i64 f32)) - ;; CHECK-NEXT: (local $4 i64) - ;; CHECK-NEXT: (local $5 i32) - ;; CHECK-NEXT: (local.set $3 - ;; CHECK-NEXT: (call $triple) - ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local $scratch (tuple i32 i64 f32)) + ;; CHECK-NEXT: (local $scratch_4 i64) + ;; CHECK-NEXT: (local $scratch_5 i32) ;; CHECK-NEXT: (local.set $x ;; CHECK-NEXT: (block (result i32) - ;; CHECK-NEXT: (local.set $5 + ;; CHECK-NEXT: (local.set $scratch_5 ;; CHECK-NEXT: (tuple.extract 3 0 - ;; CHECK-NEXT: (local.get $3) + ;; CHECK-NEXT: (local.tee $scratch + ;; CHECK-NEXT: (call $triple) + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (local.set $1 ;; CHECK-NEXT: (block (result i64) - ;; CHECK-NEXT: (local.set $4 + ;; CHECK-NEXT: (local.set $scratch_4 ;; CHECK-NEXT: (tuple.extract 3 1 - ;; CHECK-NEXT: (local.get $3) + ;; CHECK-NEXT: (local.get $scratch) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (local.set $2 ;; CHECK-NEXT: (tuple.extract 3 2 - ;; CHECK-NEXT: (local.get $3) + ;; CHECK-NEXT: (local.get $scratch) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.get $4) + ;; CHECK-NEXT: (local.get $scratch_4) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.get $5) + ;; CHECK-NEXT: (local.get $scratch_5) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (tuple.make 3 @@ -205,7 +199,7 @@ ) ) - ;; CHECK: (func $unreachable (type $3) (result i64) + ;; CHECK: (func $unreachable (type $2) (result i64) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (i32.const 42) ;; CHECK-NEXT: ) @@ -226,16 +220,16 @@ ;; Test multivalue globals ;; CHECK: (func $global (type $0) (result i32 i64) - ;; CHECK-NEXT: (local $0 i32) + ;; CHECK-NEXT: (local $scratch i32) ;; CHECK-NEXT: (global.set $g1 ;; CHECK-NEXT: (block (result i32) - ;; CHECK-NEXT: (local.set $0 + ;; CHECK-NEXT: (local.set $scratch ;; CHECK-NEXT: (i32.const 42) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (global.set $g2 ;; CHECK-NEXT: (i64.const 7) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $scratch) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop @@ -263,24 +257,23 @@ ;; Test lowering of multivalue drops ;; CHECK: (func $drop-call (type $1) - ;; CHECK-NEXT: (local $0 (tuple i32 i64)) - ;; CHECK-NEXT: (local $1 i32) - ;; CHECK-NEXT: (local.set $0 - ;; CHECK-NEXT: (call $pair) - ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local $scratch (tuple i32 i64)) + ;; CHECK-NEXT: (local $scratch_1 i32) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (block (result i32) - ;; CHECK-NEXT: (local.set $1 + ;; CHECK-NEXT: (local.set $scratch_1 ;; CHECK-NEXT: (tuple.extract 2 0 - ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.tee $scratch + ;; CHECK-NEXT: (call $pair) + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (tuple.extract 2 1 - ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $scratch) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (local.get $scratch_1) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -291,16 +284,16 @@ ) ;; CHECK: (func $drop-tuple-make (type $1) - ;; CHECK-NEXT: (local $0 i32) + ;; CHECK-NEXT: (local $scratch i32) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (block (result i32) - ;; CHECK-NEXT: (local.set $0 + ;; CHECK-NEXT: (local.set $scratch ;; CHECK-NEXT: (i32.const 42) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (i64.const 42) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $scratch) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -314,29 +307,28 @@ ) ;; CHECK: (func $drop-block (type $1) - ;; CHECK-NEXT: (local $0 (tuple i32 i64)) - ;; CHECK-NEXT: (local $1 i32) - ;; CHECK-NEXT: (local.set $0 - ;; CHECK-NEXT: (block $label$1 (type $0) (result i32 i64) - ;; CHECK-NEXT: (tuple.make 2 - ;; CHECK-NEXT: (i32.const 42) - ;; CHECK-NEXT: (i64.const 42) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local $scratch (tuple i32 i64)) + ;; CHECK-NEXT: (local $scratch_1 i32) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (block (result i32) - ;; CHECK-NEXT: (local.set $1 + ;; CHECK-NEXT: (local.set $scratch_1 ;; CHECK-NEXT: (tuple.extract 2 0 - ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.tee $scratch + ;; CHECK-NEXT: (block (type $0) (result i32 i64) + ;; CHECK-NEXT: (tuple.make 2 + ;; CHECK-NEXT: (i32.const 42) + ;; CHECK-NEXT: (i64.const 42) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (tuple.extract 2 1 - ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $scratch) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (local.get $scratch_1) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -389,25 +381,14 @@ ) ;; CHECK: (func $mv-block-break (type $0) (result i32 i64) - ;; CHECK-NEXT: (local $0 (tuple i32 i64)) - ;; CHECK-NEXT: (local.set $0 - ;; CHECK-NEXT: (block $label$1 (type $0) (result i32 i64) - ;; CHECK-NEXT: (br $label$1 - ;; CHECK-NEXT: (tuple.make 2 - ;; CHECK-NEXT: (i32.const 42) - ;; CHECK-NEXT: (i64.const 42) - ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (block $block (type $0) (result i32 i64) + ;; CHECK-NEXT: (br $block + ;; CHECK-NEXT: (tuple.make 2 + ;; CHECK-NEXT: (i32.const 42) + ;; CHECK-NEXT: (i64.const 42) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (tuple.make 2 - ;; CHECK-NEXT: (tuple.extract 2 0 - ;; CHECK-NEXT: (local.get $0) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (tuple.extract 2 1 - ;; CHECK-NEXT: (local.get $0) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $mv-block-break (result i32 i64) (block $l (result i32 i64) @@ -421,35 +402,13 @@ ) ;; CHECK: (func $mv-block-br-if (type $0) (result i32 i64) - ;; CHECK-NEXT: (local $0 (tuple i32 i64)) - ;; CHECK-NEXT: (local $1 (tuple i32 i64)) - ;; CHECK-NEXT: (local.set $1 - ;; CHECK-NEXT: (block $label$1 (type $0) (result i32 i64) - ;; CHECK-NEXT: (local.set $0 - ;; CHECK-NEXT: (br_if $label$1 - ;; CHECK-NEXT: (tuple.make 2 - ;; CHECK-NEXT: (i32.const 42) - ;; CHECK-NEXT: (i64.const 42) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (i32.const 1) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (block $block (type $0) (result i32 i64) + ;; CHECK-NEXT: (br_if $block ;; CHECK-NEXT: (tuple.make 2 - ;; CHECK-NEXT: (tuple.extract 2 0 - ;; CHECK-NEXT: (local.get $0) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (tuple.extract 2 1 - ;; CHECK-NEXT: (local.get $0) - ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 42) + ;; CHECK-NEXT: (i64.const 42) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (tuple.make 2 - ;; CHECK-NEXT: (tuple.extract 2 0 - ;; CHECK-NEXT: (local.get $1) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (tuple.extract 2 1 - ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (i32.const 1) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -465,36 +424,22 @@ ) ) - ;; CHECK: (func $mv-if (type $2) (result i32 i64 externref) - ;; CHECK-NEXT: (local $0 (tuple i32 i64 externref)) - ;; CHECK-NEXT: (local.set $0 - ;; CHECK-NEXT: (if (type $2) (result i32 i64 externref) - ;; CHECK-NEXT: (i32.const 1) - ;; CHECK-NEXT: (then - ;; CHECK-NEXT: (tuple.make 3 - ;; CHECK-NEXT: (i32.const 42) - ;; CHECK-NEXT: (i64.const 42) - ;; CHECK-NEXT: (ref.null noextern) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (else - ;; CHECK-NEXT: (tuple.make 3 - ;; CHECK-NEXT: (i32.const 42) - ;; CHECK-NEXT: (i64.const 42) - ;; CHECK-NEXT: (ref.null noextern) - ;; CHECK-NEXT: ) + ;; CHECK: (func $mv-if (type $4) (result i32 i64 externref) + ;; CHECK-NEXT: (if (type $4) (result i32 i64 externref) + ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: (then + ;; CHECK-NEXT: (tuple.make 3 + ;; CHECK-NEXT: (i32.const 42) + ;; CHECK-NEXT: (i64.const 42) + ;; CHECK-NEXT: (ref.null noextern) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (tuple.make 3 - ;; CHECK-NEXT: (tuple.extract 3 0 - ;; CHECK-NEXT: (local.get $0) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (tuple.extract 3 1 - ;; CHECK-NEXT: (local.get $0) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (tuple.extract 3 2 - ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (else + ;; CHECK-NEXT: (tuple.make 3 + ;; CHECK-NEXT: (i32.const 42) + ;; CHECK-NEXT: (i64.const 42) + ;; CHECK-NEXT: (ref.null noextern) + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -519,21 +464,10 @@ ) ;; CHECK: (func $mv-loop (type $0) (result i32 i64) - ;; CHECK-NEXT: (local $0 (tuple i32 i64)) - ;; CHECK-NEXT: (local.set $0 - ;; CHECK-NEXT: (loop $label$1 (type $0) (result i32 i64) - ;; CHECK-NEXT: (tuple.make 2 - ;; CHECK-NEXT: (i32.const 42) - ;; CHECK-NEXT: (i64.const 42) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (tuple.make 2 - ;; CHECK-NEXT: (tuple.extract 2 0 - ;; CHECK-NEXT: (local.get $0) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (tuple.extract 2 1 - ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (loop (type $0) (result i32 i64) + ;; CHECK-NEXT: (tuple.make 2 + ;; CHECK-NEXT: (i32.const 42) + ;; CHECK-NEXT: (i64.const 42) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -547,39 +481,17 @@ ) ;; CHECK: (func $mv-switch (type $0) (result i32 i64) - ;; CHECK-NEXT: (local $0 (tuple i32 i64)) - ;; CHECK-NEXT: (local $1 (tuple i32 i64)) - ;; CHECK-NEXT: (local.set $1 - ;; CHECK-NEXT: (block $label$1 (type $0) (result i32 i64) - ;; CHECK-NEXT: (local.set $0 - ;; CHECK-NEXT: (block $label$2 (type $0) (result i32 i64) - ;; CHECK-NEXT: (br_table $label$1 $label$2 - ;; CHECK-NEXT: (tuple.make 2 - ;; CHECK-NEXT: (i32.const 42) - ;; CHECK-NEXT: (i64.const 42) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (i32.const 0) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (tuple.make 2 - ;; CHECK-NEXT: (tuple.extract 2 0 - ;; CHECK-NEXT: (local.get $0) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (tuple.extract 2 1 - ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (block $block (type $0) (result i32 i64) + ;; CHECK-NEXT: (block $block0 (type $0) (result i32 i64) + ;; CHECK-NEXT: (br_table $block $block0 + ;; CHECK-NEXT: (tuple.make 2 + ;; CHECK-NEXT: (i32.const 42) + ;; CHECK-NEXT: (i64.const 42) ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (tuple.make 2 - ;; CHECK-NEXT: (tuple.extract 2 0 - ;; CHECK-NEXT: (local.get $1) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (tuple.extract 2 1 - ;; CHECK-NEXT: (local.get $1) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $mv-switch (result i32 i64) (block $a (result i32 i64) diff --git a/test/lit/parse-double-unreachable.wast b/test/lit/parse-double-unreachable.wast index b232a40fbdc..9b0e8f573e8 100644 --- a/test/lit/parse-double-unreachable.wast +++ b/test/lit/parse-double-unreachable.wast @@ -15,7 +15,24 @@ ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (ref.null nofunc) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (local.get $x) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (ref.null nofunc) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (block ;; (replaces unreachable ArrayGet we can't emit) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $double-unreachable (param $x (ref $array)) (result i32) diff --git a/test/lit/passes/roundtrip-gc.wast b/test/lit/passes/roundtrip-gc.wast index 57300def512..e8c36631f06 100644 --- a/test/lit/passes/roundtrip-gc.wast +++ b/test/lit/passes/roundtrip-gc.wast @@ -6,14 +6,14 @@ ;; CHECK: (export "export" (func $test)) (export "export" (func $test)) ;; CHECK: (func $test (type $1) - ;; CHECK-NEXT: (local $0 (ref $\7bi32\7d)) + ;; CHECK-NEXT: (local $scratch (ref $\7bi32\7d)) ;; CHECK-NEXT: (call $help ;; CHECK-NEXT: (block (result (ref $\7bi32\7d)) - ;; CHECK-NEXT: (local.set $0 + ;; CHECK-NEXT: (local.set $scratch ;; CHECK-NEXT: (struct.new_default $\7bi32\7d) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (call $other) - ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $scratch) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (i32.const 1) ;; CHECK-NEXT: ) @@ -32,12 +32,14 @@ ) ) ;; CHECK: (func $help (type $2) (param $3 (ref $\7bi32\7d)) (param $4 i32) + ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $help (param $3 (ref $"{i32}")) (param $4 i32) (nop) ) ;; CHECK: (func $other (type $1) + ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $other ) diff --git a/test/lit/passes/roundtrip.wast b/test/lit/passes/roundtrip.wast index 59e303eafae..21aa1f67160 100644 --- a/test/lit/passes/roundtrip.wast +++ b/test/lit/passes/roundtrip.wast @@ -5,29 +5,28 @@ ;; CHECK: (type $none (func)) (type $none (func)) ;; CHECK: (func $foo (type $none) - ;; CHECK-NEXT: (local $0 (tuple funcref (ref $none))) - ;; CHECK-NEXT: (local $1 funcref) - ;; CHECK-NEXT: (local.set $0 - ;; CHECK-NEXT: (block $label$1 (type $1) (result funcref (ref $none)) - ;; CHECK-NEXT: (tuple.make 2 - ;; CHECK-NEXT: (ref.null nofunc) - ;; CHECK-NEXT: (ref.func $foo) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local $scratch (tuple funcref (ref $none))) + ;; CHECK-NEXT: (local $scratch_1 funcref) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (block (result funcref) - ;; CHECK-NEXT: (local.set $1 + ;; CHECK-NEXT: (local.set $scratch_1 ;; CHECK-NEXT: (tuple.extract 2 0 - ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.tee $scratch + ;; CHECK-NEXT: (block (type $1) (result funcref (ref $none)) + ;; CHECK-NEXT: (tuple.make 2 + ;; CHECK-NEXT: (ref.null nofunc) + ;; CHECK-NEXT: (ref.func $foo) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (tuple.extract 2 1 - ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $scratch) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (local.get $scratch_1) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) diff --git a/test/lit/passes/signature-refining_gto.wat b/test/lit/passes/signature-refining_gto.wat index ec2b517b14b..c69eeb24455 100644 --- a/test/lit/passes/signature-refining_gto.wat +++ b/test/lit/passes/signature-refining_gto.wat @@ -17,7 +17,9 @@ ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (local.get $0) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $struct.get (param $0 (ref $A)) ;; This function is always called with a null, so the parameter type will be diff --git a/test/lit/passes/stack-ir-roundtrip-eh-legacy.wast b/test/lit/passes/stack-ir-roundtrip-eh-legacy.wast index cedcdbf4537..0fd68f73ff1 100644 --- a/test/lit/passes/stack-ir-roundtrip-eh-legacy.wast +++ b/test/lit/passes/stack-ir-roundtrip-eh-legacy.wast @@ -5,9 +5,9 @@ ;; CHECK: (tag $tag (param i32)) (tag $tag (param i32)) ;; CHECK: (func $delegate-child (type $1) - ;; CHECK-NEXT: (try $label$9 + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (try $label$7 + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) @@ -15,7 +15,7 @@ ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (pop i32) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (try $label$6 + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) diff --git a/test/lit/reftypes-without-gc.wast b/test/lit/reftypes-without-gc.wast index e71aa526919..d251d0e0b84 100644 --- a/test/lit/reftypes-without-gc.wast +++ b/test/lit/reftypes-without-gc.wast @@ -10,8 +10,8 @@ (module ;; CHECK: (func $test (param $x i32) (result funcref) - ;; CHECK-NEXT: (block $label$1 (result funcref) - ;; CHECK-NEXT: (br_if $label$1 + ;; CHECK-NEXT: (block $block (result funcref) + ;; CHECK-NEXT: (br_if $block ;; CHECK-NEXT: (ref.func $test) ;; CHECK-NEXT: (local.get $x) ;; CHECK-NEXT: ) diff --git a/test/lit/source-map.wast b/test/lit/source-map.wast index f8ef07c65cc..90123e418e0 100644 --- a/test/lit/source-map.wast +++ b/test/lit/source-map.wast @@ -48,8 +48,6 @@ ;;@ src.cpp:40:1 (local.get $y) ) - ;; For the legacy parser - ;;@ src.cpp:50:1 (then ;; For the new parser ;;@ src.cpp:50:1 @@ -68,10 +66,10 @@ ;; CHECK: (func $nested-blocks ;; CHECK-NEXT: ;;@ src.cpp:2:1 - ;; CHECK-NEXT: (block $label$1 + ;; CHECK-NEXT: (block ;; CHECK-NEXT: ;;@ src.cpp:2:2 - ;; CHECK-NEXT: (block $label$2 - ;; CHECK-NEXT: (br $label$2) + ;; CHECK-NEXT: (block $block + ;; CHECK-NEXT: (br $block) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ;;@ src.cpp:3:1 diff --git a/test/lit/string.as_wtf16.wast b/test/lit/string.as_wtf16.wast index 916e11d39a1..f2559178d25 100644 --- a/test/lit/string.as_wtf16.wast +++ b/test/lit/string.as_wtf16.wast @@ -12,8 +12,10 @@ ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; RTRIP: (func $empty (type $2) + ;; RTRIP-NEXT: (nop) ;; RTRIP-NEXT: ) ;; RRTRP: (func $empty (type $2) + ;; RRTRP-NEXT: (nop) ;; RRTRP-NEXT: ) (func $empty (string.as_wtf16) @@ -27,33 +29,33 @@ ;; CHECK-NEXT: ) ;; RTRIP: (func $codeunit (type $1) (result i32) ;; RTRIP-NEXT: (local $0 i32) - ;; RTRIP-NEXT: (local $1 (ref string)) + ;; RTRIP-NEXT: (local $scratch (ref string)) ;; RTRIP-NEXT: (stringview_wtf16.get_codeunit ;; RTRIP-NEXT: (block (result (ref string)) - ;; RTRIP-NEXT: (local.set $1 + ;; RTRIP-NEXT: (local.set $scratch ;; RTRIP-NEXT: (string.const "abc") ;; RTRIP-NEXT: ) ;; RTRIP-NEXT: (local.set $0 ;; RTRIP-NEXT: (i32.const 0) ;; RTRIP-NEXT: ) - ;; RTRIP-NEXT: (local.get $1) + ;; RTRIP-NEXT: (local.get $scratch) ;; RTRIP-NEXT: ) ;; RTRIP-NEXT: (local.get $0) ;; RTRIP-NEXT: ) ;; RTRIP-NEXT: ) ;; RRTRP: (func $codeunit (type $1) (result i32) ;; RRTRP-NEXT: (local $0 i32) - ;; RRTRP-NEXT: (local $1 (ref string)) - ;; RRTRP-NEXT: (local $2 (ref string)) + ;; RRTRP-NEXT: (local $scratch_3 (ref string)) + ;; RRTRP-NEXT: (local $scratch (ref string)) ;; RRTRP-NEXT: (stringview_wtf16.get_codeunit ;; RRTRP-NEXT: (block (result (ref string)) - ;; RRTRP-NEXT: (local.set $2 + ;; RRTRP-NEXT: (local.set $scratch ;; RRTRP-NEXT: (string.const "abc") ;; RRTRP-NEXT: ) ;; RRTRP-NEXT: (local.set $0 ;; RRTRP-NEXT: (i32.const 0) ;; RRTRP-NEXT: ) - ;; RRTRP-NEXT: (local.get $2) + ;; RRTRP-NEXT: (local.get $scratch) ;; RRTRP-NEXT: ) ;; RRTRP-NEXT: (local.get $0) ;; RRTRP-NEXT: ) @@ -109,25 +111,25 @@ ;; RTRIP: (func $slice (type $0) (result stringref) ;; RTRIP-NEXT: (local $0 i32) ;; RTRIP-NEXT: (local $1 i32) - ;; RTRIP-NEXT: (local $2 i32) - ;; RTRIP-NEXT: (local $3 (ref string)) + ;; RTRIP-NEXT: (local $scratch i32) + ;; RTRIP-NEXT: (local $scratch_3 (ref string)) ;; RTRIP-NEXT: (stringview_wtf16.slice ;; RTRIP-NEXT: (block (result (ref string)) - ;; RTRIP-NEXT: (local.set $3 + ;; RTRIP-NEXT: (local.set $scratch_3 ;; RTRIP-NEXT: (string.const "abc") ;; RTRIP-NEXT: ) ;; RTRIP-NEXT: (local.set $0 ;; RTRIP-NEXT: (block (result i32) - ;; RTRIP-NEXT: (local.set $2 + ;; RTRIP-NEXT: (local.set $scratch ;; RTRIP-NEXT: (i32.const 1) ;; RTRIP-NEXT: ) ;; RTRIP-NEXT: (local.set $1 ;; RTRIP-NEXT: (i32.const 2) ;; RTRIP-NEXT: ) - ;; RTRIP-NEXT: (local.get $2) + ;; RTRIP-NEXT: (local.get $scratch) ;; RTRIP-NEXT: ) ;; RTRIP-NEXT: ) - ;; RTRIP-NEXT: (local.get $3) + ;; RTRIP-NEXT: (local.get $scratch_3) ;; RTRIP-NEXT: ) ;; RTRIP-NEXT: (local.get $0) ;; RTRIP-NEXT: (local.get $1) @@ -136,27 +138,27 @@ ;; RRTRP: (func $slice (type $0) (result stringref) ;; RRTRP-NEXT: (local $0 i32) ;; RRTRP-NEXT: (local $1 i32) - ;; RRTRP-NEXT: (local $2 i32) - ;; RRTRP-NEXT: (local $3 (ref string)) - ;; RRTRP-NEXT: (local $4 i32) - ;; RRTRP-NEXT: (local $5 (ref string)) + ;; RRTRP-NEXT: (local $scratch_6 i32) + ;; RRTRP-NEXT: (local $scratch_3 (ref string)) + ;; RRTRP-NEXT: (local $scratch i32) + ;; RRTRP-NEXT: (local $scratch_5 (ref string)) ;; RRTRP-NEXT: (stringview_wtf16.slice ;; RRTRP-NEXT: (block (result (ref string)) - ;; RRTRP-NEXT: (local.set $5 + ;; RRTRP-NEXT: (local.set $scratch_5 ;; RRTRP-NEXT: (string.const "abc") ;; RRTRP-NEXT: ) ;; RRTRP-NEXT: (local.set $0 ;; RRTRP-NEXT: (block (result i32) - ;; RRTRP-NEXT: (local.set $4 + ;; RRTRP-NEXT: (local.set $scratch ;; RRTRP-NEXT: (i32.const 1) ;; RRTRP-NEXT: ) ;; RRTRP-NEXT: (local.set $1 ;; RRTRP-NEXT: (i32.const 2) ;; RRTRP-NEXT: ) - ;; RRTRP-NEXT: (local.get $4) + ;; RRTRP-NEXT: (local.get $scratch) ;; RRTRP-NEXT: ) ;; RRTRP-NEXT: ) - ;; RRTRP-NEXT: (local.get $5) + ;; RRTRP-NEXT: (local.get $scratch_5) ;; RRTRP-NEXT: ) ;; RRTRP-NEXT: (local.get $0) ;; RRTRP-NEXT: (local.get $1) @@ -186,25 +188,25 @@ ;; RTRIP-NEXT: (local $start i32) ;; RTRIP-NEXT: (local $1 i32) ;; RTRIP-NEXT: (local $2 i32) - ;; RTRIP-NEXT: (local $3 i32) - ;; RTRIP-NEXT: (local $4 (ref string)) + ;; RTRIP-NEXT: (local $scratch i32) + ;; RTRIP-NEXT: (local $scratch_4 (ref string)) ;; RTRIP-NEXT: (stringview_wtf16.slice ;; RTRIP-NEXT: (block (result (ref string)) - ;; RTRIP-NEXT: (local.set $4 + ;; RTRIP-NEXT: (local.set $scratch_4 ;; RTRIP-NEXT: (string.const "abc") ;; RTRIP-NEXT: ) ;; RTRIP-NEXT: (local.set $1 ;; RTRIP-NEXT: (block (result i32) - ;; RTRIP-NEXT: (local.set $3 + ;; RTRIP-NEXT: (local.set $scratch ;; RTRIP-NEXT: (local.get $start) ;; RTRIP-NEXT: ) ;; RTRIP-NEXT: (local.set $2 ;; RTRIP-NEXT: (i32.const 2) ;; RTRIP-NEXT: ) - ;; RTRIP-NEXT: (local.get $3) + ;; RTRIP-NEXT: (local.get $scratch) ;; RTRIP-NEXT: ) ;; RTRIP-NEXT: ) - ;; RTRIP-NEXT: (local.get $4) + ;; RTRIP-NEXT: (local.get $scratch_4) ;; RTRIP-NEXT: ) ;; RTRIP-NEXT: (local.get $1) ;; RTRIP-NEXT: (local.get $2) @@ -214,27 +216,27 @@ ;; RRTRP-NEXT: (local $start i32) ;; RRTRP-NEXT: (local $1 i32) ;; RRTRP-NEXT: (local $2 i32) - ;; RRTRP-NEXT: (local $3 i32) - ;; RRTRP-NEXT: (local $4 (ref string)) - ;; RRTRP-NEXT: (local $5 i32) - ;; RRTRP-NEXT: (local $6 (ref string)) + ;; RRTRP-NEXT: (local $scratch_7 i32) + ;; RRTRP-NEXT: (local $scratch_4 (ref string)) + ;; RRTRP-NEXT: (local $scratch i32) + ;; RRTRP-NEXT: (local $scratch_6 (ref string)) ;; RRTRP-NEXT: (stringview_wtf16.slice ;; RRTRP-NEXT: (block (result (ref string)) - ;; RRTRP-NEXT: (local.set $6 + ;; RRTRP-NEXT: (local.set $scratch_6 ;; RRTRP-NEXT: (string.const "abc") ;; RRTRP-NEXT: ) ;; RRTRP-NEXT: (local.set $1 ;; RRTRP-NEXT: (block (result i32) - ;; RRTRP-NEXT: (local.set $5 + ;; RRTRP-NEXT: (local.set $scratch ;; RRTRP-NEXT: (local.get $start) ;; RRTRP-NEXT: ) ;; RRTRP-NEXT: (local.set $2 ;; RRTRP-NEXT: (i32.const 2) ;; RRTRP-NEXT: ) - ;; RRTRP-NEXT: (local.get $5) + ;; RRTRP-NEXT: (local.get $scratch) ;; RRTRP-NEXT: ) ;; RRTRP-NEXT: ) - ;; RRTRP-NEXT: (local.get $6) + ;; RRTRP-NEXT: (local.get $scratch_6) ;; RRTRP-NEXT: ) ;; RRTRP-NEXT: (local.get $1) ;; RRTRP-NEXT: (local.get $2) @@ -262,25 +264,25 @@ ;; RTRIP-NEXT: (local $end i32) ;; RTRIP-NEXT: (local $1 i32) ;; RTRIP-NEXT: (local $2 i32) - ;; RTRIP-NEXT: (local $3 i32) - ;; RTRIP-NEXT: (local $4 (ref string)) + ;; RTRIP-NEXT: (local $scratch i32) + ;; RTRIP-NEXT: (local $scratch_4 (ref string)) ;; RTRIP-NEXT: (stringview_wtf16.slice ;; RTRIP-NEXT: (block (result (ref string)) - ;; RTRIP-NEXT: (local.set $4 + ;; RTRIP-NEXT: (local.set $scratch_4 ;; RTRIP-NEXT: (string.const "abc") ;; RTRIP-NEXT: ) ;; RTRIP-NEXT: (local.set $1 ;; RTRIP-NEXT: (block (result i32) - ;; RTRIP-NEXT: (local.set $3 + ;; RTRIP-NEXT: (local.set $scratch ;; RTRIP-NEXT: (i32.const 1) ;; RTRIP-NEXT: ) ;; RTRIP-NEXT: (local.set $2 ;; RTRIP-NEXT: (local.get $end) ;; RTRIP-NEXT: ) - ;; RTRIP-NEXT: (local.get $3) + ;; RTRIP-NEXT: (local.get $scratch) ;; RTRIP-NEXT: ) ;; RTRIP-NEXT: ) - ;; RTRIP-NEXT: (local.get $4) + ;; RTRIP-NEXT: (local.get $scratch_4) ;; RTRIP-NEXT: ) ;; RTRIP-NEXT: (local.get $1) ;; RTRIP-NEXT: (local.get $2) @@ -290,27 +292,27 @@ ;; RRTRP-NEXT: (local $end i32) ;; RRTRP-NEXT: (local $1 i32) ;; RRTRP-NEXT: (local $2 i32) - ;; RRTRP-NEXT: (local $3 i32) - ;; RRTRP-NEXT: (local $4 (ref string)) - ;; RRTRP-NEXT: (local $5 i32) - ;; RRTRP-NEXT: (local $6 (ref string)) + ;; RRTRP-NEXT: (local $scratch_7 i32) + ;; RRTRP-NEXT: (local $scratch_4 (ref string)) + ;; RRTRP-NEXT: (local $scratch i32) + ;; RRTRP-NEXT: (local $scratch_6 (ref string)) ;; RRTRP-NEXT: (stringview_wtf16.slice ;; RRTRP-NEXT: (block (result (ref string)) - ;; RRTRP-NEXT: (local.set $6 + ;; RRTRP-NEXT: (local.set $scratch_6 ;; RRTRP-NEXT: (string.const "abc") ;; RRTRP-NEXT: ) ;; RRTRP-NEXT: (local.set $1 ;; RRTRP-NEXT: (block (result i32) - ;; RRTRP-NEXT: (local.set $5 + ;; RRTRP-NEXT: (local.set $scratch ;; RRTRP-NEXT: (i32.const 1) ;; RRTRP-NEXT: ) ;; RRTRP-NEXT: (local.set $2 ;; RRTRP-NEXT: (local.get $end) ;; RRTRP-NEXT: ) - ;; RRTRP-NEXT: (local.get $5) + ;; RRTRP-NEXT: (local.get $scratch) ;; RRTRP-NEXT: ) ;; RRTRP-NEXT: ) - ;; RRTRP-NEXT: (local.get $6) + ;; RRTRP-NEXT: (local.get $scratch_6) ;; RRTRP-NEXT: ) ;; RRTRP-NEXT: (local.get $1) ;; RRTRP-NEXT: (local.get $2) diff --git a/test/lld/em_asm_pthread.wasm.out b/test/lld/em_asm_pthread.wasm.out index 3b51b896ab7..e7263fd7231 100644 --- a/test/lld/em_asm_pthread.wasm.out +++ b/test/lld/em_asm_pthread.wasm.out @@ -126,6 +126,7 @@ (call $5) ) (func $1 (param $0 i32) + (nop) ) (func $2 (if @@ -269,8 +270,8 @@ ) (func $5 (local $0 i32) - (block $label$1 - (br_if $label$1 + (block $block + (br_if $block (i32.eqz (local.tee $0 (global.get $global$1) @@ -348,9 +349,9 @@ (i32.const 2147483647) ) ) - (block $label$1 - (block $label$2 - (br_if $label$2 + (block $block0 + (block $block + (br_if $block (i32.ne (i32.and (local.get $1) @@ -359,7 +360,7 @@ (i32.const 1) ) ) - (br_if $label$2 + (br_if $block (i32.ne (local.get $5) (local.get $3) @@ -368,7 +369,7 @@ (local.set $6 (i32.const 6) ) - (br_if $label$1 + (br_if $block0 (i32.gt_u (local.tee $5 (i32.load offset=20 @@ -392,14 +393,14 @@ (local.set $6 (i32.const 56) ) - (br_if $label$1 + (br_if $block0 (i32.eq (local.get $5) (i32.const 2147483647) ) ) - (block $label$3 - (br_if $label$3 + (block $block1 + (br_if $block1 (i32.eqz (i32.and (i32.load8_u @@ -409,8 +410,8 @@ ) ) ) - (block $label$4 - (br_if $label$4 + (block $block2 + (br_if $block2 (i32.load (i32.add (local.get $2) @@ -449,15 +450,15 @@ ) ) ) - (block $label$5 - (block $label$6 - (block $label$7 - (br_if $label$7 + (block $block5 + (block $block4 + (block $block3 + (br_if $block3 (i32.eqz (local.get $5) ) ) - (br_if $label$6 + (br_if $block4 (i32.eqz (i32.and (local.get $1) @@ -465,7 +466,7 @@ ) ) ) - (br_if $label$6 + (br_if $block4 (i32.eqz (i32.and (local.get $4) @@ -474,7 +475,7 @@ ) ) ) - (br_if $label$5 + (br_if $block5 (i32.eq (call $12 (i32.add @@ -523,8 +524,8 @@ (i32.const 16) ) ) - (block $label$8 - (br_if $label$8 + (block $block6 + (br_if $block6 (i32.eq (local.get $3) (local.get $6) @@ -552,7 +553,7 @@ ) (i32.const 0) ) - (br_if $label$1 + (br_if $block0 (i32.eqz (local.get $5) ) @@ -584,8 +585,8 @@ ) ) (func $13 (param $0 i32) (result i32) - (block $label$1 - (br_if $label$1 + (block $block + (br_if $block (i32.and (i32.load8_u (local.get $0) @@ -626,14 +627,14 @@ ) ) (func $17 - (block $label$1 - (br_if $label$1 + (block $block + (br_if $block (i32.ne (call $18) (i32.const 1) ) ) - (br_if $label$1 + (br_if $block (i32.eqz (i32.load offset=1796 (i32.const 0) @@ -683,10 +684,10 @@ (local.get $0) ) ) - (block $label$1 - (block $label$2 - (block $label$3 - (br_if $label$3 + (block $block1 + (block $block0 + (block $block + (br_if $block (local.tee $4 (i32.and (local.get $1) @@ -694,7 +695,7 @@ ) ) ) - (br $label$2) + (br $block0) ) (local.set $5 (call $7) @@ -702,7 +703,7 @@ (local.set $6 (i32.const 63) ) - (br_if $label$1 + (br_if $block1 (i32.ne (i32.and (i32.load offset=4 @@ -715,8 +716,8 @@ ) ) ) - (block $label$4 - (br_if $label$4 + (block $block2 + (br_if $block2 (i32.ne (i32.and (local.get $1) @@ -725,7 +726,7 @@ (i32.const 1) ) ) - (br_if $label$4 + (br_if $block2 (i32.eqz (local.tee $6 (i32.load offset=20 @@ -745,8 +746,8 @@ (i32.const 0) ) ) - (block $label$5 - (br_if $label$5 + (block $block3 + (br_if $block3 (local.get $2) ) (i32.store @@ -773,7 +774,7 @@ ) ) ) - (br_if $label$2 + (br_if $block0 (i32.eq (local.get $6) (i32.add @@ -810,13 +811,13 @@ ) ) ) - (block $label$6 - (br_if $label$6 + (block $block4 + (br_if $block4 (i32.eqz (local.get $4) ) ) - (br_if $label$6 + (br_if $block4 (local.get $2) ) (i32.store @@ -831,11 +832,11 @@ (local.set $6 (i32.const 0) ) - (block $label$7 - (br_if $label$7 + (block $block5 + (br_if $block5 (local.get $3) ) - (br_if $label$1 + (br_if $block1 (i32.gt_s (local.get $0) (i32.const -1) @@ -925,14 +926,14 @@ (local $1 i32) (local $2 i32) (local $3 i32) - (block $label$1 - (block $label$2 - (br_if $label$2 + (block $block0 + (block $block + (br_if $block (i32.eqz (call $10) ) ) - (br_if $label$1 + (br_if $block0 (i32.load8_u offset=1832 (i32.const 0) ) @@ -947,8 +948,8 @@ (i32.const 1804) ) ) - (block $label$3 - (br_if $label$3 + (block $block1 + (br_if $block1 (local.tee $0 (call $32 (call $14) @@ -960,7 +961,7 @@ (i32.const 1804) ) ) - (br_if $label$1 + (br_if $block0 (i32.eqz (call $10) ) @@ -971,8 +972,8 @@ ) (return) ) - (block $label$4 - (br_if $label$4 + (block $block2 + (br_if $block2 (i32.eq (local.tee $2 (call $23 @@ -994,7 +995,7 @@ ) ) ) - (loop $label$5 + (loop $label (drop (call $20 (i32.const 1804) @@ -1032,7 +1033,7 @@ ) ) ) - (br_if $label$5 + (br_if $label (i32.ne (local.get $2) (call $23 @@ -1053,7 +1054,7 @@ (i32.const 2147483647) ) ) - (br_if $label$1 + (br_if $block0 (i32.eqz (call $10) ) @@ -1066,14 +1067,14 @@ ) (func $32 (param $0 i32) (result i32) (local $1 i32) - (block $label$1 - (br_if $label$1 + (block $block + (br_if $block (i32.eqz (local.get $0) ) ) - (block $label$2 - (br_if $label$2 + (block $block0 + (br_if $block0 (i32.eqz (local.tee $1 (i32.load offset=1840 @@ -1082,9 +1083,9 @@ ) ) ) - (loop $label$3 - (block $label$4 - (br_if $label$4 + (loop $label + (block $block1 + (br_if $block1 (i32.ne (i32.load (local.get $1) @@ -1096,7 +1097,7 @@ (local.get $1) ) ) - (br_if $label$3 + (br_if $label (local.tee $1 (i32.load offset=16 (local.get $1) @@ -1119,10 +1120,10 @@ ) (func $33 (param $0 i32) (local $1 i32) - (block $label$1 - (block $label$2 - (block $label$3 - (br_if $label$3 + (block $block8 + (block $block41 + (block $block + (br_if $block (i32.eq (i32.and (local.tee $1 @@ -1135,67 +1136,67 @@ (i32.const 402653184) ) ) - (block $label$4 - (block $label$5 - (block $label$6 - (block $label$7 - (block $label$8 - (block $label$9 - (block $label$10 - (block $label$11 - (block $label$12 - (block $label$13 - (block $label$14 - (block $label$15 - (block $label$16 - (block $label$17 - (block $label$18 - (block $label$19 - (block $label$20 - (block $label$21 - (block $label$22 - (block $label$23 - (block $label$24 - (block $label$25 - (block $label$26 - (block $label$27 - (block $label$28 - (block $label$29 - (br_if $label$29 + (block $block7 + (block $block4 + (block $block12 + (block $block40 + (block $block39 + (block $block38 + (block $block36 + (block $block35 + (block $block32 + (block $block31 + (block $block30 + (block $block28 + (block $block27 + (block $block23 + (block $block22 + (block $block21 + (block $block20 + (block $block18 + (block $block16 + (block $block15 + (block $block13 + (block $block11 + (block $block10 + (block $block5 + (block $block3 + (block $block0 + (br_if $block0 (i32.gt_s (local.get $1) (i32.const 234881023) ) ) - (block $label$30 - (br_if $label$30 + (block $block1 + (br_if $block1 (i32.gt_s (local.get $1) (i32.const 100663335) ) ) - (block $label$31 - (br_if $label$31 + (block $block2 + (br_if $block2 (i32.gt_s (local.get $1) (i32.const 67108863) ) ) - (block $label$32 - (br_table $label$28 $label$5 $label$27 $label$32 + (block $block6 + (br_table $block3 $block4 $block5 $block6 (i32.add (local.get $1) (i32.const -33554432) ) ) ) - (br_if $label$4 + (br_if $block7 (i32.eq (local.get $1) (i32.const -2126512128) ) ) - (br_if $label$5 + (br_if $block4 (local.get $1) ) (call_indirect (type $2) @@ -1203,29 +1204,29 @@ (local.get $0) ) ) - (br $label$1) + (br $block8) ) - (block $label$33 - (br_if $label$33 + (block $block9 + (br_if $block9 (i32.gt_s (local.get $1) (i32.const 100663295) ) ) - (br_table $label$26 $label$5 $label$25 $label$6 + (br_table $block10 $block4 $block11 $block12 (i32.add (local.get $1) (i32.const -67108872) ) ) ) - (br_if $label$24 + (br_if $block13 (i32.eq (local.get $1) (i32.const 100663296) ) ) - (br_if $label$5 + (br_if $block4 (i32.ne (local.get $1) (i32.const 100663328) @@ -1251,30 +1252,30 @@ (local.get $0) ) ) - (br $label$1) + (br $block8) ) - (block $label$34 - (br_if $label$34 + (block $block14 + (br_if $block14 (i32.gt_s (local.get $1) (i32.const 134217895) ) ) - (block $label$35 - (br_table $label$23 $label$5 $label$22 $label$35 + (block $block17 + (br_table $block15 $block4 $block16 $block17 (i32.add (local.get $1) (i32.const -100663336) ) ) ) - (br_if $label$21 + (br_if $block18 (i32.eq (local.get $1) (i32.const 134217728) ) ) - (br_if $label$5 + (br_if $block4 (i32.ne (local.get $1) (i32.const 134217760) @@ -1306,29 +1307,29 @@ (local.get $0) ) ) - (br $label$1) + (br $block8) ) - (block $label$36 - (br_if $label$36 + (block $block19 + (br_if $block19 (i32.gt_s (local.get $1) (i32.const 167772839) ) ) - (br_table $label$20 $label$5 $label$19 $label$18 + (br_table $block20 $block4 $block21 $block22 (i32.add (local.get $1) (i32.const -134217896) ) ) ) - (br_if $label$17 + (br_if $block23 (i32.eq (local.get $1) (i32.const 167772840) ) ) - (br_if $label$5 + (br_if $block4 (i32.ne (local.get $1) (i32.const 201326592) @@ -1372,36 +1373,36 @@ (local.get $0) ) ) - (br $label$1) + (br $block8) ) - (block $label$37 - (br_if $label$37 + (block $block24 + (br_if $block24 (i32.gt_s (local.get $1) (i32.const 637534207) ) ) - (block $label$38 - (br_if $label$38 + (block $block25 + (br_if $block25 (i32.gt_s (local.get $1) (i32.const 369098751) ) ) - (block $label$39 - (br_if $label$39 + (block $block26 + (br_if $block26 (i32.gt_s (local.get $1) (i32.const 301989887) ) ) - (br_if $label$16 + (br_if $block27 (i32.eq (local.get $1) (i32.const 234881024) ) ) - (br_if $label$5 + (br_if $block4 (i32.ne (local.get $1) (i32.const 268435456) @@ -1457,15 +1458,15 @@ (local.get $0) ) ) - (br $label$1) + (br $block8) ) - (br_if $label$15 + (br_if $block28 (i32.eq (local.get $1) (i32.const 301989888) ) ) - (br_if $label$5 + (br_if $block4 (i32.ne (local.get $1) (i32.const 335544320) @@ -1533,22 +1534,22 @@ (local.get $0) ) ) - (br $label$1) + (br $block8) ) - (block $label$40 - (br_if $label$40 + (block $block29 + (br_if $block29 (i32.gt_s (local.get $1) (i32.const 570425343) ) ) - (br_if $label$14 + (br_if $block30 (i32.eq (local.get $1) (i32.const 369098752) ) ) - (br_if $label$5 + (br_if $block4 (i32.ne (local.get $1) (i32.const 536870912) @@ -1562,21 +1563,21 @@ ) ) ) - (br $label$1) + (br $block8) ) - (br_if $label$13 + (br_if $block31 (i32.eq (local.get $1) (i32.const 570425344) ) ) - (br_if $label$12 + (br_if $block32 (i32.eq (local.get $1) (i32.const 603979776) ) ) - (br_if $label$5 + (br_if $block4 (i32.ne (local.get $1) (i32.const 622854144) @@ -1596,29 +1597,29 @@ ) ) ) - (br $label$1) + (br $block8) ) - (block $label$41 - (br_if $label$41 + (block $block33 + (br_if $block33 (i32.gt_s (local.get $1) (i32.const 704643071) ) ) - (block $label$42 - (br_if $label$42 + (block $block34 + (br_if $block34 (i32.gt_s (local.get $1) (i32.const 671088639) ) ) - (br_if $label$11 + (br_if $block35 (i32.eq (local.get $1) (i32.const 637534208) ) ) - (br_if $label$5 + (br_if $block4 (i32.ne (local.get $1) (i32.const 657457152) @@ -1644,15 +1645,15 @@ ) ) ) - (br $label$1) + (br $block8) ) - (br_if $label$10 + (br_if $block36 (i32.eq (local.get $1) (i32.const 671088640) ) ) - (br_if $label$5 + (br_if $block4 (i32.ne (local.get $1) (i32.const 687865856) @@ -1684,22 +1685,22 @@ ) ) ) - (br $label$1) + (br $block8) ) - (block $label$43 - (br_if $label$43 + (block $block37 + (br_if $block37 (i32.gt_s (local.get $1) (i32.const 771751935) ) ) - (br_if $label$9 + (br_if $block38 (i32.eq (local.get $1) (i32.const 704643072) ) ) - (br_if $label$5 + (br_if $block4 (i32.ne (local.get $1) (i32.const 738197504) @@ -1746,21 +1747,21 @@ ) ) ) - (br $label$1) + (br $block8) ) - (br_if $label$8 + (br_if $block39 (i32.eq (local.get $1) (i32.const 771751936) ) ) - (br_if $label$7 + (br_if $block40 (i32.eq (local.get $1) (i32.const 805306368) ) ) - (br_if $label$5 + (br_if $block4 (i32.ne (local.get $1) (i32.const 838860800) @@ -1825,7 +1826,7 @@ ) ) ) - (br $label$1) + (br $block8) ) (call_indirect (type $1) (i32.load offset=16 @@ -1835,7 +1836,7 @@ (local.get $0) ) ) - (br $label$1) + (br $block8) ) (call_indirect (type $22) (f32.load offset=16 @@ -1845,7 +1846,7 @@ (local.get $0) ) ) - (br $label$1) + (br $block8) ) (call_indirect (type $23) (i32.load offset=16 @@ -1861,7 +1862,7 @@ (local.get $0) ) ) - (br $label$1) + (br $block8) ) (call_indirect (type $24) (f32.load offset=16 @@ -1877,7 +1878,7 @@ (local.get $0) ) ) - (br $label$1) + (br $block8) ) (call_indirect (type $11) (i32.load offset=16 @@ -1899,7 +1900,7 @@ (local.get $0) ) ) - (br $label$1) + (br $block8) ) (call_indirect (type $25) (i32.load offset=16 @@ -1921,7 +1922,7 @@ (local.get $0) ) ) - (br $label$1) + (br $block8) ) (call_indirect (type $26) (f32.load offset=16 @@ -1943,7 +1944,7 @@ (local.get $0) ) ) - (br $label$1) + (br $block8) ) (call_indirect (type $10) (i32.load offset=16 @@ -1971,7 +1972,7 @@ (local.get $0) ) ) - (br $label$1) + (br $block8) ) (call_indirect (type $27) (i32.load offset=16 @@ -1999,7 +2000,7 @@ (local.get $0) ) ) - (br $label$1) + (br $block8) ) (call_indirect (type $28) (f32.load offset=16 @@ -2027,9 +2028,9 @@ (local.get $0) ) ) - (br $label$1) + (br $block8) ) - (br_if $label$5 + (br_if $block4 (i32.ne (local.get $1) (i32.const 167772160) @@ -2067,7 +2068,7 @@ (local.get $0) ) ) - (br $label$1) + (br $block8) ) (call_indirect (type $30) (i32.load offset=16 @@ -2101,7 +2102,7 @@ (local.get $0) ) ) - (br $label$1) + (br $block8) ) (call_indirect (type $31) (i32.load offset=16 @@ -2147,7 +2148,7 @@ (local.get $0) ) ) - (br $label$1) + (br $block8) ) (call_indirect (type $32) (i32.load offset=16 @@ -2205,7 +2206,7 @@ (local.get $0) ) ) - (br $label$1) + (br $block8) ) (call_indirect (type $33) (i32.load offset=16 @@ -2275,7 +2276,7 @@ (local.get $0) ) ) - (br $label$1) + (br $block8) ) (i32.store offset=176 (local.get $0) @@ -2288,7 +2289,7 @@ ) ) ) - (br $label$1) + (br $block8) ) (i32.store offset=176 (local.get $0) @@ -2307,7 +2308,7 @@ ) ) ) - (br $label$1) + (br $block8) ) (i32.store offset=176 (local.get $0) @@ -2332,7 +2333,7 @@ ) ) ) - (br $label$1) + (br $block8) ) (i32.store offset=176 (local.get $0) @@ -2363,7 +2364,7 @@ ) ) ) - (br $label$1) + (br $block8) ) (i32.store offset=176 (local.get $0) @@ -2400,7 +2401,7 @@ ) ) ) - (br $label$1) + (br $block8) ) (i32.store offset=176 (local.get $0) @@ -2449,7 +2450,7 @@ ) ) ) - (br $label$1) + (br $block8) ) (i32.store offset=176 (local.get $0) @@ -2504,9 +2505,9 @@ ) ) ) - (br $label$1) + (br $block8) ) - (br_if $label$2 + (br_if $block41 (i32.eq (local.get $1) (i32.const 67108864) @@ -2536,7 +2537,7 @@ ) ) ) - (br $label$1) + (br $block8) ) (call $fimport$8 (i32.const 1254) @@ -2561,8 +2562,8 @@ ) ) ) - (block $label$44 - (br_if $label$44 + (block $block42 + (br_if $block42 (i32.eqz (i32.load offset=188 (local.get $0) @@ -2589,8 +2590,8 @@ ) ) (func $34 (param $0 i32) - (block $label$1 - (br_if $label$1 + (block $block + (br_if $block (i32.eqz (local.get $0) ) @@ -2608,8 +2609,8 @@ (func $35 (param $0 i32) (param $1 f64) (result i32) (local $2 i32) (local $3 f64) - (block $label$1 - (br_if $label$1 + (block $block + (br_if $block (local.tee $0 (call $23 (local.tee $2 @@ -2630,8 +2631,8 @@ (local.set $0 (i32.const 0) ) - (block $label$2 - (br_if $label$2 + (block $block0 + (br_if $block0 (i32.xor (f64.lt (local.get $3) @@ -2645,7 +2646,7 @@ (i32.const 1) ) ) - (loop $label$3 + (loop $label (drop (call $fimport$6 (local.get $2) @@ -2664,10 +2665,10 @@ (local.set $3 (call $fimport$4) ) - (br_if $label$2 + (br_if $block0 (local.get $0) ) - (br_if $label$3 + (br_if $label (f64.lt (local.get $3) (local.get $1) @@ -2703,18 +2704,18 @@ (local $5 i32) (local $6 i32) (local $7 i32) - (block $label$1 - (block $label$2 - (block $label$3 - (br_if $label$3 + (block $block9 + (block $block7 + (block $block + (br_if $block (i32.eqz (local.get $1) ) ) - (block $label$4 - (block $label$5 - (block $label$6 - (br_table $label$6 $label$5 $label$4 + (block $block2 + (block $block1 + (block $block0 + (br_table $block0 $block1 $block2 (local.get $0) ) ) @@ -2730,15 +2731,15 @@ (call $37) ) ) - (block $label$7 - (block $label$8 - (br_if $label$8 + (block $block4 + (block $block3 + (br_if $block3 (i32.eq (local.get $0) (i32.const 2) ) ) - (br_if $label$7 + (br_if $block4 (i32.ne (local.get $0) (call $14) @@ -2757,8 +2758,8 @@ (i32.const 1804) ) ) - (block $label$9 - (br_if $label$9 + (block $block5 + (br_if $block5 (i32.load offset=4 (local.tee $2 (call $39 @@ -2774,8 +2775,8 @@ ) ) ) - (block $label$10 - (br_if $label$10 + (block $block6 + (br_if $block6 (i32.ne (local.tee $4 (call $23 @@ -2807,13 +2808,13 @@ ) ) ) - (loop $label$11 + (loop $label (drop (call $20 (i32.const 1804) ) ) - (br_if $label$2 + (br_if $block7 (i32.ne (local.get $0) (call $37) @@ -2831,7 +2832,7 @@ (i32.const 1804) ) ) - (br_if $label$11 + (br_if $label (i32.eq (local.tee $4 (call $23 @@ -2867,14 +2868,14 @@ ) (local.get $1) ) - (block $label$12 - (br_if $label$12 + (block $block8 + (br_if $block8 (i32.ne (local.get $4) (local.get $6) ) ) - (br_if $label$12 + (br_if $block8 (call $fimport$10 (local.get $0) (call $37) @@ -2888,7 +2889,7 @@ (i32.const 1804) ) ) - (br $label$1) + (br $block9) ) (drop (call $24 @@ -2901,7 +2902,7 @@ (i32.const 1804) ) ) - (br $label$1) + (br $block9) ) (call $fimport$8 (i32.const 1090) @@ -2920,8 +2921,8 @@ (func $39 (param $0 i32) (result i32) (local $1 i32) (local $2 i32) - (block $label$1 - (br_if $label$1 + (block $block + (br_if $block (local.tee $1 (call $32 (local.get $0) @@ -2944,9 +2945,9 @@ (local.get $1) (local.get $0) ) - (block $label$2 - (block $label$3 - (br_if $label$3 + (block $block1 + (block $block0 + (br_if $block0 (local.tee $0 (i32.load offset=1840 (i32.const 0) @@ -2956,10 +2957,10 @@ (local.set $0 (i32.const 1840) ) - (br $label$2) + (br $block1) ) - (loop $label$4 - (br_if $label$4 + (loop $label + (br_if $label (local.tee $0 (i32.load offset=16 (local.tee $2 @@ -3117,13 +3118,13 @@ (local.get $0) ) (func $44 - (block $label$1 - (br_if $label$1 + (block $block + (br_if $block (i32.eqz (call $9) ) ) - (br_if $label$1 + (br_if $block (i32.eqz (i32.load offset=1432 (i32.const 0) @@ -3146,9 +3147,9 @@ ) ) ) - (block $label$1 - (block $label$2 - (br_if $label$2 + (block $block0 + (block $block + (br_if $block (i32.eqz (local.get $3) ) @@ -3164,7 +3165,7 @@ (local.set $5 (local.get $4) ) - (br $label$1) + (br $block0) ) (local.set $5 (call $46) @@ -3185,8 +3186,8 @@ (local.get $3) ) ) - (block $label$3 - (br_if $label$3 + (block $block1 + (br_if $block1 (i32.ge_s (local.get $1) (i32.const 20) @@ -3199,14 +3200,14 @@ (local.set $0 (i32.const 0) ) - (block $label$4 - (br_if $label$4 + (block $block2 + (br_if $block2 (i32.le_s (local.get $1) (i32.const 0) ) ) - (loop $label$5 + (loop $label (i64.store (i32.add (i32.add @@ -3236,7 +3237,7 @@ (local.set $0 (local.get $6) ) - (br_if $label$5 + (br_if $label (i32.ne (local.get $6) (local.get $1) @@ -3244,9 +3245,9 @@ ) ) ) - (block $label$6 - (block $label$7 - (br_if $label$7 + (block $block4 + (block $block3 + (br_if $block3 (i32.eqz (local.get $3) ) @@ -3259,7 +3260,7 @@ (local.get $4) ) ) - (br $label$6) + (br $block4) ) (call $40 (local.get $5) @@ -3288,8 +3289,8 @@ ) (func $46 (result i32) (local $0 i32) - (block $label$1 - (br_if $label$1 + (block $block + (br_if $block (local.tee $0 (call $60 (i32.const 192) @@ -3325,8 +3326,8 @@ ) ) ) - (block $label$1 - (br_if $label$1 + (block $block + (br_if $block (i32.eqz (local.tee $7 (call $46) @@ -3349,8 +3350,8 @@ (local.get $6) (local.get $5) ) - (block $label$2 - (br_if $label$2 + (block $block0 + (br_if $block0 (i32.eqz (local.tee $4 (i32.and @@ -3372,13 +3373,13 @@ (local.set $3 (i32.const 0) ) - (loop $label$3 - (block $label$4 - (block $label$5 - (block $label$6 - (block $label$7 - (block $label$8 - (br_table $label$8 $label$7 $label$6 $label$5 $label$8 + (loop $label + (block $block5 + (block $block4 + (block $block3 + (block $block2 + (block $block1 + (br_table $block1 $block2 $block3 $block4 $block1 (i32.and (local.get $2) (i32.const 3) @@ -3411,7 +3412,7 @@ (local.get $5) ) ) - (br $label$4) + (br $block5) ) (i32.store offset=12 (local.get $6) @@ -3445,7 +3446,7 @@ (local.get $5) ) ) - (br $label$4) + (br $block5) ) (i32.store offset=12 (local.get $6) @@ -3481,7 +3482,7 @@ ) ) ) - (br $label$4) + (br $block5) ) (i32.store offset=12 (local.get $6) @@ -3522,7 +3523,7 @@ (i32.const 2) ) ) - (br_if $label$3 + (br_if $label (i32.ne (local.tee $3 (i32.add @@ -3539,9 +3540,9 @@ (local.get $7) (i32.const 1) ) - (block $label$9 - (block $label$10 - (br_if $label$10 + (block $block7 + (block $block6 + (br_if $block6 (i32.eqz (local.get $0) ) @@ -3575,7 +3576,7 @@ (local.get $6) ) ) - (br $label$9) + (br $block7) ) (local.set $2 (call $38 @@ -3607,8 +3608,8 @@ (local.set $2 (i32.const 28) ) - (block $label$1 - (br_if $label$1 + (block $block + (br_if $block (i32.gt_u (local.get $0) (i32.const 2) @@ -3617,8 +3618,8 @@ (local.set $2 (call $7) ) - (block $label$2 - (br_if $label$2 + (block $block0 + (br_if $block0 (i32.eqz (local.get $1) ) @@ -3653,22 +3654,22 @@ ) ) ) - (block $label$1 - (block $label$2 - (block $label$3 - (block $label$4 - (br_if $label$4 + (block $block1 + (block $block3 + (block $block0 + (block $block + (br_if $block (local.get $3) ) (local.set $6 (f64.const inf) ) - (br $label$3) + (br $block0) ) (local.set $7 (i32.const 28) ) - (br_if $label$1 + (br_if $block1 (i32.gt_u (i32.load offset=4 (local.get $3) @@ -3676,7 +3677,7 @@ (i32.const 999999999) ) ) - (br_if $label$1 + (br_if $block1 (call $fimport$3 (local.get $2) (i32.add @@ -3711,8 +3712,8 @@ ) ) ) - (block $label$5 - (br_if $label$5 + (block $block2 + (br_if $block2 (i32.gt_s (local.get $3) (i32.const -1) @@ -3737,7 +3738,7 @@ ) ) ) - (br_if $label$2 + (br_if $block3 (i32.lt_s (local.get $7) (i32.const 0) @@ -3760,15 +3761,15 @@ ) ) ) - (block $label$6 - (block $label$7 - (block $label$8 - (br_if $label$8 + (block $block8 + (block $block5 + (block $block4 + (br_if $block4 (local.tee $3 (call $10) ) ) - (br_if $label$8 + (br_if $block4 (i32.ne (i32.load offset=56 (call $14) @@ -3776,7 +3777,7 @@ (i32.const 1) ) ) - (br_if $label$7 + (br_if $block5 (i32.ne (i32.load offset=60 (call $14) @@ -3791,9 +3792,9 @@ (call $fimport$4) ) ) - (loop $label$9 - (block $label$10 - (br_if $label$10 + (loop $label + (block $block6 + (br_if $block6 (i32.eqz (call $30 (call $14) @@ -3803,17 +3804,17 @@ (local.set $7 (i32.const 11) ) - (br $label$1) + (br $block1) ) - (block $label$11 - (br_if $label$11 + (block $block7 + (br_if $block7 (i32.eqz (local.get $3) ) ) (call $44) ) - (br_if $label$2 + (br_if $block3 (f64.le (local.tee $6 (f64.sub @@ -3824,7 +3825,7 @@ (f64.const 0) ) ) - (br_if $label$9 + (br_if $label (i32.eq (local.tee $7 (i32.sub @@ -3855,7 +3856,7 @@ (i32.const 73) ) ) - (br $label$6) + (br $block8) ) ) (local.set $7 @@ -3869,19 +3870,19 @@ ) ) ) - (br_if $label$1 + (br_if $block1 (i32.eq (local.get $7) (i32.const 11) ) ) - (br_if $label$1 + (br_if $block1 (i32.eq (local.get $7) (i32.const 27) ) ) - (br_if $label$1 + (br_if $block1 (i32.eq (local.get $7) (i32.const 73) @@ -3890,7 +3891,7 @@ (local.set $7 (i32.const 0) ) - (br $label$1) + (br $block1) ) (local.set $7 (i32.const 73) @@ -3962,9 +3963,9 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (block $label$1 - (block $label$2 - (br_if $label$2 + (block $block0 + (block $block + (br_if $block (i32.and (local.tee $2 (i32.load @@ -3977,7 +3978,7 @@ (local.set $3 (i32.const 0) ) - (br_if $label$1 + (br_if $block0 (i32.eqz (call $52 (i32.add @@ -3995,7 +3996,7 @@ ) ) ) - (br_if $label$1 + (br_if $block0 (i32.ne (local.tee $3 (call $13 @@ -4029,14 +4030,14 @@ (local.set $3 (i32.const 100) ) - (block $label$3 - (loop $label$4 - (br_if $label$3 + (block $block1 + (loop $label + (br_if $block1 (i32.eqz (local.get $3) ) ) - (br_if $label$3 + (br_if $block1 (i32.eqz (i32.load (local.get $2) @@ -4049,7 +4050,7 @@ (i32.const -1) ) ) - (br_if $label$4 + (br_if $label (i32.eqz (i32.load (local.get $5) @@ -4058,7 +4059,7 @@ ) ) ) - (br_if $label$1 + (br_if $block0 (i32.ne (local.tee $3 (call $13 @@ -4068,9 +4069,9 @@ (i32.const 10) ) ) - (loop $label$5 - (block $label$6 - (br_if $label$6 + (loop $label0 + (block $block2 + (br_if $block2 (i32.eqz (local.tee $3 (i32.load @@ -4084,8 +4085,8 @@ (local.get $0) ) ) - (block $label$7 - (br_if $label$7 + (block $block3 + (br_if $block3 (i32.eqz (i32.and (local.get $3) @@ -4093,15 +4094,15 @@ ) ) ) - (br_if $label$6 + (br_if $block2 (i32.and (local.get $6) (i32.const 4) ) ) ) - (block $label$8 - (br_if $label$8 + (block $block4 + (br_if $block4 (i32.ne (i32.and (local.get $6) @@ -4110,7 +4111,7 @@ (i32.const 2) ) ) - (br_if $label$8 + (br_if $block4 (i32.ne (i32.and (local.get $3) @@ -4152,19 +4153,19 @@ (call $54 (local.get $5) ) - (br_if $label$6 + (br_if $block2 (i32.eqz (local.get $3) ) ) - (br_if $label$1 + (br_if $block0 (i32.ne (local.get $3) (i32.const 27) ) ) ) - (br_if $label$5 + (br_if $label0 (i32.eq (local.tee $3 (call $13 @@ -4202,8 +4203,8 @@ ) ) (func $55 (param $0 i32) (result i32) - (block $label$1 - (br_if $label$1 + (block $block + (br_if $block (i32.and (i32.load8_u (local.get $0) @@ -4211,7 +4212,7 @@ (i32.const 15) ) ) - (br_if $label$1 + (br_if $block (call $56 (i32.add (local.get $0) @@ -4316,8 +4317,8 @@ (local.get $5) ) ) - (block $label$1 - (br_if $label$1 + (block $block + (br_if $block (i32.eqz (local.get $1) ) @@ -4346,17 +4347,17 @@ (local $9 i32) (local $10 i32) (local $11 i32) - (block $label$1 - (br_if $label$1 + (block $block + (br_if $block (i32.load offset=1844 (i32.const 0) ) ) (call $61) ) - (block $label$2 - (block $label$3 - (br_if $label$3 + (block $block1 + (block $block0 + (br_if $block0 (i32.eqz (i32.and (i32.load8_u offset=2312 @@ -4369,32 +4370,32 @@ (local.set $1 (i32.const 0) ) - (br_if $label$2 + (br_if $block1 (call $55 (i32.const 2316) ) ) ) - (block $label$4 - (block $label$5 - (block $label$6 - (block $label$7 - (block $label$8 - (block $label$9 - (block $label$10 - (block $label$11 - (block $label$12 - (block $label$13 - (block $label$14 - (block $label$15 - (br_if $label$15 + (block $block6 + (block $block18 + (block $block30 + (block $block39 + (block $block49 + (block $block43 + (block $block50 + (block $block32 + (block $block20 + (block $block16 + (block $block7 + (block $block2 + (br_if $block2 (i32.gt_u (local.get $0) (i32.const 244) ) ) - (block $label$16 - (br_if $label$16 + (block $block3 + (br_if $block3 (i32.eqz (i32.and (local.tee $0 @@ -4460,9 +4461,9 @@ (i32.const 8) ) ) - (block $label$17 - (block $label$18 - (br_if $label$18 + (block $block5 + (block $block4 + (br_if $block4 (i32.ne (local.tee $3 (i32.load offset=8 @@ -4487,7 +4488,7 @@ ) ) ) - (br $label$17) + (br $block5) ) (i32.store offset=12 (local.get $3) @@ -4524,9 +4525,9 @@ (i32.const 1) ) ) - (br $label$4) + (br $block6) ) - (br_if $label$14 + (br_if $block7 (i32.le_u (local.get $3) (local.tee $6 @@ -4536,15 +4537,15 @@ ) ) ) - (block $label$19 - (br_if $label$19 + (block $block8 + (br_if $block8 (i32.eqz (local.get $0) ) ) - (block $label$20 - (block $label$21 - (br_if $label$21 + (block $block10 + (block $block9 + (br_if $block9 (i32.ne (local.tee $1 (i32.load offset=8 @@ -4693,7 +4694,7 @@ ) ) ) - (br $label$20) + (br $block10) ) (i32.store offset=12 (local.get $1) @@ -4746,8 +4747,8 @@ ) (local.get $4) ) - (block $label$22 - (br_if $label$22 + (block $block11 + (br_if $block11 (i32.eqz (local.get $6) ) @@ -4771,9 +4772,9 @@ (i32.const 0) ) ) - (block $label$23 - (block $label$24 - (br_if $label$24 + (block $block13 + (block $block12 + (br_if $block12 (i32.and (local.get $2) (local.tee $7 @@ -4794,7 +4795,7 @@ (local.set $7 (local.get $3) ) - (br $label$23) + (br $block13) ) (local.set $7 (i32.load offset=8 @@ -4827,9 +4828,9 @@ (i32.const 0) (local.get $4) ) - (br $label$4) + (br $block6) ) - (br_if $label$14 + (br_if $block7 (i32.eqz (local.tee $8 (i32.load offset=1872 @@ -4951,17 +4952,17 @@ (local.set $4 (local.get $5) ) - (block $label$25 - (loop $label$26 - (block $label$27 - (br_if $label$27 + (block $block15 + (loop $label + (block $block14 + (br_if $block14 (local.tee $0 (i32.load offset=16 (local.get $4) ) ) ) - (br_if $label$25 + (br_if $block15 (i32.eqz (local.tee $0 (i32.load @@ -5006,10 +5007,10 @@ (local.set $4 (local.get $0) ) - (br $label$26) + (br $label) ) ) - (br_if $label$13 + (br_if $block16 (i32.le_u (local.tee $9 (i32.add @@ -5025,8 +5026,8 @@ (local.get $5) ) ) - (block $label$28 - (br_if $label$28 + (block $block17 + (br_if $block17 (i32.eq (local.tee $7 (i32.load offset=12 @@ -5056,10 +5057,10 @@ (local.get $7) (local.get $0) ) - (br $label$5) + (br $block18) ) - (block $label$29 - (br_if $label$29 + (block $block19 + (br_if $block19 (local.tee $0 (i32.load (local.tee $4 @@ -5071,7 +5072,7 @@ ) ) ) - (br_if $label$12 + (br_if $block20 (i32.eqz (local.tee $0 (i32.load offset=16 @@ -5087,11 +5088,11 @@ ) ) ) - (loop $label$30 + (loop $label0 (local.set $11 (local.get $4) ) - (br_if $label$30 + (br_if $label0 (local.tee $0 (i32.load (local.tee $4 @@ -5111,7 +5112,7 @@ (i32.const 16) ) ) - (br_if $label$30 + (br_if $label0 (local.tee $0 (i32.load offset=16 (local.get $7) @@ -5123,12 +5124,12 @@ (local.get $11) (i32.const 0) ) - (br $label$5) + (br $block18) ) (local.set $3 (i32.const -1) ) - (br_if $label$14 + (br_if $block7 (i32.gt_u (local.get $0) (i32.const -65) @@ -5145,7 +5146,7 @@ (i32.const -8) ) ) - (br_if $label$14 + (br_if $block7 (i32.eqz (local.tee $6 (i32.load offset=1872 @@ -5157,8 +5158,8 @@ (local.set $11 (i32.const 31) ) - (block $label$31 - (br_if $label$31 + (block $block21 + (br_if $block21 (i32.gt_u (local.get $3) (i32.const 16777215) @@ -5257,11 +5258,11 @@ (local.get $3) ) ) - (block $label$32 - (block $label$33 - (block $label$34 - (block $label$35 - (br_if $label$35 + (block $block27 + (block $block25 + (block $block23 + (block $block22 + (br_if $block22 (local.tee $4 (i32.load (i32.add @@ -5280,7 +5281,7 @@ (local.set $7 (i32.const 0) ) - (br $label$34) + (br $block23) ) (local.set $0 (i32.const 0) @@ -5307,9 +5308,9 @@ (local.set $7 (i32.const 0) ) - (loop $label$36 - (block $label$37 - (br_if $label$37 + (loop $label1 + (block $block24 + (br_if $block24 (i32.ge_u (local.tee $2 (i32.sub @@ -5331,7 +5332,7 @@ (local.set $7 (local.get $4) ) - (br_if $label$37 + (br_if $block24 (local.get $2) ) (local.set $1 @@ -5343,7 +5344,7 @@ (local.set $0 (local.get $4) ) - (br $label$33) + (br $block25) ) (local.set $0 (select @@ -5388,19 +5389,19 @@ (i32.const 1) ) ) - (br_if $label$36 + (br_if $label1 (local.get $4) ) ) ) - (block $label$38 - (br_if $label$38 + (block $block26 + (br_if $block26 (i32.or (local.get $0) (local.get $7) ) ) - (br_if $label$14 + (br_if $block7 (i32.eqz (local.tee $0 (i32.and @@ -5522,13 +5523,13 @@ ) ) ) - (br_if $label$32 + (br_if $block27 (i32.eqz (local.get $0) ) ) ) - (loop $label$39 + (loop $label2 (local.set $5 (i32.lt_u (local.tee $2 @@ -5545,8 +5546,8 @@ (local.get $1) ) ) - (block $label$40 - (br_if $label$40 + (block $block28 + (br_if $block28 (local.tee $4 (i32.load offset=16 (local.get $0) @@ -5579,17 +5580,17 @@ (local.set $0 (local.get $4) ) - (br_if $label$39 + (br_if $label2 (local.get $4) ) ) ) - (br_if $label$14 + (br_if $block7 (i32.eqz (local.get $7) ) ) - (br_if $label$14 + (br_if $block7 (i32.ge_u (local.get $1) (i32.sub @@ -5600,7 +5601,7 @@ ) ) ) - (br_if $label$13 + (br_if $block16 (i32.le_u (local.tee $11 (i32.add @@ -5616,8 +5617,8 @@ (local.get $7) ) ) - (block $label$41 - (br_if $label$41 + (block $block29 + (br_if $block29 (i32.eq (local.tee $5 (i32.load offset=12 @@ -5647,10 +5648,10 @@ (local.get $5) (local.get $0) ) - (br $label$6) + (br $block30) ) - (block $label$42 - (br_if $label$42 + (block $block31 + (br_if $block31 (local.tee $0 (i32.load (local.tee $4 @@ -5662,7 +5663,7 @@ ) ) ) - (br_if $label$11 + (br_if $block32 (i32.eqz (local.tee $0 (i32.load offset=16 @@ -5678,11 +5679,11 @@ ) ) ) - (loop $label$43 + (loop $label3 (local.set $2 (local.get $4) ) - (br_if $label$43 + (br_if $label3 (local.tee $0 (i32.load (local.tee $4 @@ -5702,7 +5703,7 @@ (i32.const 16) ) ) - (br_if $label$43 + (br_if $label3 (local.tee $0 (i32.load offset=16 (local.get $5) @@ -5714,10 +5715,10 @@ (local.get $2) (i32.const 0) ) - (br $label$6) + (br $block30) ) - (block $label$44 - (br_if $label$44 + (block $block33 + (br_if $block33 (i32.lt_u (local.tee $0 (i32.load offset=1876 @@ -5732,9 +5733,9 @@ (i32.const 0) ) ) - (block $label$45 - (block $label$46 - (br_if $label$46 + (block $block35 + (block $block34 + (br_if $block34 (i32.lt_u (local.tee $4 (i32.sub @@ -5779,7 +5780,7 @@ (i32.const 3) ) ) - (br $label$45) + (br $block35) ) (i32.store offset=1888 (i32.const 0) @@ -5817,10 +5818,10 @@ (i32.const 8) ) ) - (br $label$4) + (br $block6) ) - (block $label$47 - (br_if $label$47 + (block $block36 + (br_if $block36 (i32.le_u (local.tee $0 (i32.load offset=1880 @@ -5872,20 +5873,20 @@ (i32.const 8) ) ) - (br $label$4) + (br $block6) ) (local.set $1 (i32.const 0) ) - (block $label$48 - (br_if $label$48 + (block $block37 + (br_if $block37 (i32.load offset=1844 (i32.const 0) ) ) (call $61) ) - (br_if $label$4 + (br_if $block6 (i32.le_u (local.tee $7 (i32.and @@ -5914,8 +5915,8 @@ (local.set $1 (i32.const 0) ) - (block $label$49 - (br_if $label$49 + (block $block38 + (br_if $block38 (i32.eqz (local.tee $0 (i32.load offset=2308 @@ -5924,7 +5925,7 @@ ) ) ) - (br_if $label$4 + (br_if $block6 (i32.le_u (local.tee $5 (i32.add @@ -5939,7 +5940,7 @@ (local.get $4) ) ) - (br_if $label$4 + (br_if $block6 (i32.gt_u (local.get $5) (local.get $0) @@ -5952,7 +5953,7 @@ (local.set $5 (i32.const -1) ) - (br_if $label$7 + (br_if $block39 (i32.and (i32.load8_u offset=2312 (i32.const 0) @@ -5963,10 +5964,10 @@ (local.set $6 (i32.const 0) ) - (block $label$50 - (block $label$51 - (block $label$52 - (br_if $label$52 + (block $block48 + (block $block42 + (block $block40 + (br_if $block40 (i32.eqz (local.tee $1 (i32.load offset=1892 @@ -5978,9 +5979,9 @@ (local.set $0 (i32.const 2344) ) - (loop $label$53 - (block $label$54 - (br_if $label$54 + (loop $label4 + (block $block41 + (br_if $block41 (i32.gt_u (local.tee $4 (i32.load @@ -5990,7 +5991,7 @@ (local.get $1) ) ) - (br_if $label$51 + (br_if $block42 (i32.gt_u (i32.add (local.get $4) @@ -6002,7 +6003,7 @@ ) ) ) - (br_if $label$53 + (br_if $label4 (local.tee $0 (i32.load offset=8 (local.get $0) @@ -6016,7 +6017,7 @@ (i32.const 2368) ) ) - (br_if $label$9 + (br_if $block43 (i32.eq (local.tee $5 (call $66 @@ -6029,8 +6030,8 @@ (local.set $2 (local.get $7) ) - (block $label$55 - (br_if $label$55 + (block $block44 + (br_if $block44 (i32.eqz (i32.and (local.tee $1 @@ -6066,8 +6067,8 @@ ) ) ) - (block $label$56 - (br_if $label$56 + (block $block45 + (br_if $block45 (i32.gt_u (local.get $2) (local.get $3) @@ -6076,10 +6077,10 @@ (local.set $6 (i32.const 0) ) - (br $label$9) + (br $block43) ) - (block $label$57 - (br_if $label$57 + (block $block46 + (br_if $block46 (i32.le_u (local.get $2) (i32.const 2147483646) @@ -6088,13 +6089,13 @@ (local.set $6 (i32.const 0) ) - (br $label$9) + (br $block43) ) (local.set $6 (i32.const 0) ) - (block $label$58 - (br_if $label$58 + (block $block47 + (br_if $block47 (i32.eqz (local.tee $0 (i32.load offset=2308 @@ -6103,7 +6104,7 @@ ) ) ) - (br_if $label$9 + (br_if $block43 (i32.le_u (local.tee $4 (i32.add @@ -6118,14 +6119,14 @@ (local.get $1) ) ) - (br_if $label$9 + (br_if $block43 (i32.gt_u (local.get $4) (local.get $0) ) ) ) - (br_if $label$50 + (br_if $block48 (i32.ne (local.tee $0 (call $66 @@ -6135,7 +6136,7 @@ (local.get $5) ) ) - (br $label$8) + (br $block49) ) (drop (call $55 @@ -6145,7 +6146,7 @@ (local.set $6 (i32.const 0) ) - (br_if $label$9 + (br_if $block43 (i32.gt_u (local.tee $2 (i32.and @@ -6171,7 +6172,7 @@ (i32.const 2147483646) ) ) - (br_if $label$10 + (br_if $block50 (i32.eq (local.tee $5 (call $66 @@ -6195,8 +6196,8 @@ (local.set $6 (i32.const 0) ) - (block $label$59 - (br_if $label$59 + (block $block51 + (br_if $block51 (i32.le_u (i32.add (local.get $3) @@ -6205,14 +6206,14 @@ (local.get $2) ) ) - (br_if $label$59 + (br_if $block51 (i32.eq (local.get $0) (i32.const -1) ) ) - (block $label$60 - (br_if $label$60 + (block $block52 + (br_if $block52 (i32.le_u (local.tee $1 (i32.and @@ -6239,10 +6240,10 @@ (local.set $5 (local.get $0) ) - (br $label$8) + (br $block49) ) - (block $label$61 - (br_if $label$61 + (block $block53 + (br_if $block53 (i32.eq (call $66 (local.get $1) @@ -6259,7 +6260,7 @@ (local.set $5 (local.get $0) ) - (br $label$8) + (br $block49) ) (drop (call $66 @@ -6272,35 +6273,36 @@ (local.set $6 (i32.const 0) ) - (br $label$9) + (br $block43) ) (local.set $5 (local.get $0) ) - (br_if $label$8 + (br_if $block49 (i32.ne (local.get $0) (i32.const -1) ) ) - (br $label$9) + (br $block43) ) (unreachable) + (unreachable) ) (local.set $7 (i32.const 0) ) - (br $label$5) + (br $block18) ) (local.set $5 (i32.const 0) ) - (br $label$6) + (br $block30) ) (local.set $6 (local.get $2) ) - (br_if $label$8 + (br_if $block49 (i32.ne (local.get $5) (i32.const -1) @@ -6329,16 +6331,16 @@ ) ) ) - (block $label$62 - (block $label$63 - (block $label$64 - (br_if $label$64 + (block $block55 + (block $block56 + (block $block54 + (br_if $block54 (i32.gt_u (local.get $7) (i32.const 2147483646) ) ) - (br_if $label$64 + (br_if $block54 (i32.ne (local.get $5) (i32.const -1) @@ -6364,25 +6366,25 @@ (i32.const 2368) ) ) - (br_if $label$62 + (br_if $block55 (i32.ge_u (local.get $5) (local.get $0) ) ) - (br_if $label$62 + (br_if $block55 (i32.eq (local.get $5) (i32.const -1) ) ) - (br_if $label$62 + (br_if $block55 (i32.eq (local.get $0) (i32.const -1) ) ) - (br_if $label$63 + (br_if $block56 (i32.gt_u (local.tee $2 (i32.sub @@ -6396,9 +6398,9 @@ ) ) ) - (br $label$62) + (br $block55) ) - (br_if $label$62 + (br_if $block55 (i32.eq (local.get $5) (i32.const -1) @@ -6416,8 +6418,8 @@ ) ) ) - (block $label$65 - (br_if $label$65 + (block $block57 + (br_if $block57 (i32.le_u (local.get $0) (i32.load offset=2304 @@ -6430,11 +6432,11 @@ (local.get $0) ) ) - (block $label$66 - (block $label$67 - (block $label$68 - (block $label$69 - (br_if $label$69 + (block $block63 + (block $block60 + (block $block59 + (block $block58 + (br_if $block58 (i32.eqz (local.tee $1 (i32.load offset=1892 @@ -6446,8 +6448,8 @@ (local.set $0 (i32.const 2344) ) - (loop $label$70 - (br_if $label$68 + (loop $label5 + (br_if $block59 (i32.eq (local.get $5) (i32.add @@ -6464,19 +6466,19 @@ ) ) ) - (br_if $label$70 + (br_if $label5 (local.tee $0 (i32.load offset=8 (local.get $0) ) ) ) - (br $label$67) + (br $block60) ) ) - (block $label$71 - (block $label$72 - (br_if $label$72 + (block $block62 + (block $block61 + (br_if $block61 (i32.eqz (local.tee $0 (i32.load offset=1884 @@ -6485,7 +6487,7 @@ ) ) ) - (br_if $label$71 + (br_if $block62 (i32.ge_u (local.get $5) (local.get $0) @@ -6522,7 +6524,7 @@ (i32.const 0) (i32.const 0) ) - (loop $label$73 + (loop $label6 (i32.store (i32.add (local.tee $1 @@ -6547,7 +6549,7 @@ ) (local.get $4) ) - (br_if $label$73 + (br_if $label6 (i32.ne (local.tee $0 (i32.add @@ -6620,21 +6622,21 @@ (i32.const 0) ) ) - (br $label$66) + (br $block63) ) - (br_if $label$67 + (br_if $block60 (i32.le_u (local.get $5) (local.get $1) ) ) - (br_if $label$67 + (br_if $block60 (i32.gt_u (local.get $4) (local.get $1) ) ) - (br_if $label$67 + (br_if $block60 (i32.and (i32.load offset=12 (local.get $0) @@ -6712,10 +6714,10 @@ (i32.const 0) ) ) - (br $label$66) + (br $block63) ) - (block $label$74 - (br_if $label$74 + (block $block64 + (br_if $block64 (i32.ge_u (local.get $5) (local.tee $7 @@ -6742,15 +6744,15 @@ (local.set $0 (i32.const 2344) ) - (block $label$75 - (block $label$76 - (block $label$77 - (block $label$78 - (block $label$79 - (block $label$80 - (block $label$81 - (loop $label$82 - (br_if $label$81 + (block $block96 + (block $block71 + (block $block89 + (block $block69 + (block $block67 + (block $block66 + (block $block65 + (loop $label7 + (br_if $block65 (i32.eq (i32.load (local.get $0) @@ -6758,17 +6760,17 @@ (local.get $4) ) ) - (br_if $label$82 + (br_if $label7 (local.tee $0 (i32.load offset=8 (local.get $0) ) ) ) - (br $label$80) + (br $block66) ) ) - (br_if $label$79 + (br_if $block67 (i32.eqz (i32.and (i32.load8_u offset=12 @@ -6782,9 +6784,9 @@ (local.set $0 (i32.const 2344) ) - (loop $label$83 - (block $label$84 - (br_if $label$84 + (loop $label8 + (block $block68 + (br_if $block68 (i32.gt_u (local.tee $4 (i32.load @@ -6794,7 +6796,7 @@ (local.get $1) ) ) - (br_if $label$78 + (br_if $block69 (i32.gt_u (local.tee $4 (i32.add @@ -6813,7 +6815,7 @@ (local.get $0) ) ) - (br $label$83) + (br $label8) ) ) (i32.store @@ -6893,8 +6895,8 @@ (local.get $3) ) ) - (block $label$85 - (br_if $label$85 + (block $block70 + (br_if $block70 (i32.ne (local.get $1) (local.get $2) @@ -6922,10 +6924,10 @@ (i32.const 1) ) ) - (br $label$76) + (br $block71) ) - (block $label$86 - (br_if $label$86 + (block $block72 + (br_if $block72 (i32.ne (i32.load offset=1888 (i32.const 0) @@ -6962,10 +6964,10 @@ ) (local.get $0) ) - (br $label$76) + (br $block71) ) - (block $label$87 - (br_if $label$87 + (block $block73 + (br_if $block73 (i32.ne (i32.and (local.tee $0 @@ -6984,9 +6986,9 @@ (i32.const -8) ) ) - (block $label$88 - (block $label$89 - (br_if $label$89 + (block $block76 + (block $block74 + (br_if $block74 (i32.gt_u (local.get $0) (i32.const 255) @@ -7015,8 +7017,8 @@ ) ) ) - (block $label$90 - (br_if $label$90 + (block $block75 + (br_if $block75 (i32.ne (local.tee $0 (i32.load offset=12 @@ -7038,7 +7040,7 @@ ) ) ) - (br $label$88) + (br $block76) ) (drop (i32.eq @@ -7054,16 +7056,16 @@ (local.get $0) (local.get $1) ) - (br $label$88) + (br $block76) ) (local.set $8 (i32.load offset=24 (local.get $2) ) ) - (block $label$91 - (block $label$92 - (br_if $label$92 + (block $block78 + (block $block77 + (br_if $block77 (i32.eq (local.tee $5 (i32.load offset=12 @@ -7091,10 +7093,10 @@ (local.get $5) (local.get $0) ) - (br $label$91) + (br $block78) ) - (block $label$93 - (br_if $label$93 + (block $block79 + (br_if $block79 (local.tee $1 (i32.load (local.tee $0 @@ -7106,7 +7108,7 @@ ) ) ) - (br_if $label$93 + (br_if $block79 (local.tee $1 (i32.load (local.tee $0 @@ -7121,13 +7123,13 @@ (local.set $5 (i32.const 0) ) - (br $label$91) + (br $block78) ) - (loop $label$94 + (loop $label9 (local.set $7 (local.get $0) ) - (br_if $label$94 + (br_if $label9 (local.tee $1 (i32.load (local.tee $0 @@ -7147,7 +7149,7 @@ (i32.const 16) ) ) - (br_if $label$94 + (br_if $label9 (local.tee $1 (i32.load offset=16 (local.get $5) @@ -7160,14 +7162,14 @@ (i32.const 0) ) ) - (br_if $label$88 + (br_if $block76 (i32.eqz (local.get $8) ) ) - (block $label$95 - (block $label$96 - (br_if $label$96 + (block $block81 + (block $block80 + (br_if $block80 (i32.ne (i32.load (local.tee $0 @@ -7191,7 +7193,7 @@ (local.get $0) (local.get $5) ) - (br_if $label$95 + (br_if $block81 (local.get $5) ) (i32.store offset=1872 @@ -7206,7 +7208,7 @@ ) ) ) - (br $label$88) + (br $block76) ) (i32.store (i32.add @@ -7224,7 +7226,7 @@ ) (local.get $5) ) - (br_if $label$88 + (br_if $block76 (i32.eqz (local.get $5) ) @@ -7234,8 +7236,8 @@ (local.get $5) (local.get $8) ) - (block $label$97 - (br_if $label$97 + (block $block82 + (br_if $block82 (i32.eqz (local.tee $0 (i32.load offset=16 @@ -7253,7 +7255,7 @@ (local.get $5) ) ) - (br_if $label$88 + (br_if $block76 (i32.eqz (local.tee $0 (i32.load offset=20 @@ -7310,8 +7312,8 @@ ) (local.get $4) ) - (block $label$98 - (br_if $label$98 + (block $block83 + (br_if $block83 (i32.gt_u (local.get $4) (i32.const 255) @@ -7331,9 +7333,9 @@ (i32.const 1908) ) ) - (block $label$99 - (block $label$100 - (br_if $label$100 + (block $block85 + (block $block84 + (br_if $block84 (i32.and (local.tee $4 (i32.load offset=1868 @@ -7358,7 +7360,7 @@ (local.set $1 (local.get $0) ) - (br $label$99) + (br $block85) ) (local.set $1 (i32.load offset=8 @@ -7382,13 +7384,13 @@ (local.get $3) (local.get $1) ) - (br $label$76) + (br $block71) ) (local.set $0 (i32.const 31) ) - (block $label$101 - (br_if $label$101 + (block $block86 + (br_if $block86 (i32.gt_u (local.get $4) (i32.const 16777215) @@ -7498,9 +7500,9 @@ (i32.const 2172) ) ) - (block $label$102 - (block $label$103 - (br_if $label$103 + (block $block88 + (block $block87 + (br_if $block87 (i32.and (local.tee $5 (i32.load offset=1872 @@ -7530,7 +7532,7 @@ (local.get $3) (local.get $1) ) - (br $label$102) + (br $block88) ) (local.set $0 (i32.shl @@ -7556,8 +7558,8 @@ (local.get $1) ) ) - (loop $label$104 - (br_if $label$77 + (loop $label10 + (br_if $block89 (i32.eq (i32.and (i32.load offset=4 @@ -7582,7 +7584,7 @@ (i32.const 1) ) ) - (br_if $label$104 + (br_if $label10 (local.tee $5 (i32.load (local.tee $7 @@ -7618,7 +7620,7 @@ (local.get $3) (local.get $3) ) - (br $label$76) + (br $block71) ) (i32.store offset=1880 (i32.const 0) @@ -7761,7 +7763,7 @@ (i32.const 24) ) ) - (loop $label$105 + (loop $label11 (i32.store offset=4 (local.get $0) (i32.const 7) @@ -7778,14 +7780,14 @@ (i32.const 4) ) ) - (br_if $label$105 + (br_if $label11 (i32.gt_u (local.get $4) (local.get $5) ) ) ) - (br_if $label$66 + (br_if $block63 (i32.eq (local.get $7) (local.get $1) @@ -7816,8 +7818,8 @@ (local.get $7) (local.get $2) ) - (block $label$106 - (br_if $label$106 + (block $block90 + (br_if $block90 (i32.gt_u (local.get $2) (i32.const 255) @@ -7837,9 +7839,9 @@ (i32.const 1908) ) ) - (block $label$107 - (block $label$108 - (br_if $label$108 + (block $block92 + (block $block91 + (br_if $block91 (i32.and (local.tee $5 (i32.load offset=1868 @@ -7864,7 +7866,7 @@ (local.set $4 (local.get $0) ) - (br $label$107) + (br $block92) ) (local.set $4 (i32.load offset=8 @@ -7888,13 +7890,13 @@ (local.get $1) (local.get $4) ) - (br $label$66) + (br $block63) ) (local.set $0 (i32.const 31) ) - (block $label$109 - (br_if $label$109 + (block $block93 + (br_if $block93 (i32.gt_u (local.get $2) (i32.const 16777215) @@ -8007,9 +8009,9 @@ (i32.const 2172) ) ) - (block $label$110 - (block $label$111 - (br_if $label$111 + (block $block95 + (block $block94 + (br_if $block94 (i32.and (local.tee $5 (i32.load offset=1872 @@ -8042,7 +8044,7 @@ ) (local.get $4) ) - (br $label$110) + (br $block95) ) (local.set $0 (i32.shl @@ -8068,8 +8070,8 @@ (local.get $4) ) ) - (loop $label$112 - (br_if $label$75 + (loop $label12 + (br_if $block96 (i32.eq (i32.and (i32.load offset=4 @@ -8094,7 +8096,7 @@ (i32.const 1) ) ) - (br_if $label$112 + (br_if $label12 (local.tee $5 (i32.load (local.tee $7 @@ -8133,7 +8135,7 @@ (local.get $1) (local.get $1) ) - (br $label$66) + (br $block63) ) (i32.store offset=12 (local.tee $0 @@ -8166,7 +8168,7 @@ (i32.const 8) ) ) - (br $label$4) + (br $block6) ) (i32.store offset=12 (local.tee $0 @@ -8196,7 +8198,7 @@ (local.get $0) ) ) - (br_if $label$62 + (br_if $block55 (i32.le_u (local.tee $0 (i32.load offset=1880 @@ -8248,7 +8250,7 @@ (i32.const 8) ) ) - (br $label$4) + (br $block6) ) (i32.store (call $25) @@ -8257,17 +8259,17 @@ (local.set $1 (i32.const 0) ) - (br $label$4) + (br $block6) ) - (block $label$113 - (br_if $label$113 + (block $block97 + (br_if $block97 (i32.eqz (local.get $8) ) ) - (block $label$114 - (block $label$115 - (br_if $label$115 + (block $block99 + (block $block98 + (br_if $block98 (i32.ne (local.get $7) (i32.load @@ -8291,7 +8293,7 @@ (local.get $0) (local.get $5) ) - (br_if $label$114 + (br_if $block99 (local.get $5) ) (i32.store offset=1872 @@ -8306,7 +8308,7 @@ ) ) ) - (br $label$113) + (br $block97) ) (i32.store (i32.add @@ -8324,7 +8326,7 @@ ) (local.get $5) ) - (br_if $label$113 + (br_if $block97 (i32.eqz (local.get $5) ) @@ -8334,8 +8336,8 @@ (local.get $5) (local.get $8) ) - (block $label$116 - (br_if $label$116 + (block $block100 + (br_if $block100 (i32.eqz (local.tee $0 (i32.load offset=16 @@ -8353,7 +8355,7 @@ (local.get $5) ) ) - (br_if $label$113 + (br_if $block97 (i32.eqz (local.tee $0 (i32.load @@ -8377,9 +8379,9 @@ (local.get $5) ) ) - (block $label$117 - (block $label$118 - (br_if $label$118 + (block $block102 + (block $block101 + (br_if $block101 (i32.gt_u (local.get $1) (i32.const 15) @@ -8411,7 +8413,7 @@ (i32.const 1) ) ) - (br $label$117) + (br $block102) ) (i32.store offset=4 (local.get $7) @@ -8434,8 +8436,8 @@ ) (local.get $1) ) - (block $label$119 - (br_if $label$119 + (block $block103 + (br_if $block103 (i32.gt_u (local.get $1) (i32.const 255) @@ -8455,9 +8457,9 @@ (i32.const 1908) ) ) - (block $label$120 - (block $label$121 - (br_if $label$121 + (block $block105 + (block $block104 + (br_if $block104 (i32.and (local.tee $4 (i32.load offset=1868 @@ -8482,7 +8484,7 @@ (local.set $1 (local.get $0) ) - (br $label$120) + (br $block105) ) (local.set $1 (i32.load offset=8 @@ -8506,13 +8508,13 @@ (local.get $11) (local.get $1) ) - (br $label$117) + (br $block102) ) (local.set $0 (i32.const 31) ) - (block $label$122 - (br_if $label$122 + (block $block106 + (br_if $block106 (i32.gt_u (local.get $1) (i32.const 16777215) @@ -8622,10 +8624,10 @@ (i32.const 2172) ) ) - (block $label$123 - (block $label$124 - (block $label$125 - (br_if $label$125 + (block $block109 + (block $block108 + (block $block107 + (br_if $block107 (i32.and (local.get $6) (local.tee $3 @@ -8651,7 +8653,7 @@ (local.get $11) (local.get $4) ) - (br $label$124) + (br $block108) ) (local.set $0 (i32.shl @@ -8677,8 +8679,8 @@ (local.get $4) ) ) - (loop $label$126 - (br_if $label$123 + (loop $label13 + (br_if $block109 (i32.eq (i32.and (i32.load offset=4 @@ -8703,7 +8705,7 @@ (i32.const 1) ) ) - (br_if $label$126 + (br_if $label13 (local.tee $3 (i32.load (local.tee $5 @@ -8739,7 +8741,7 @@ (local.get $11) (local.get $11) ) - (br $label$117) + (br $block102) ) (i32.store offset=12 (local.tee $0 @@ -8772,17 +8774,17 @@ (i32.const 8) ) ) - (br $label$4) + (br $block6) ) - (block $label$127 - (br_if $label$127 + (block $block110 + (br_if $block110 (i32.eqz (local.get $10) ) ) - (block $label$128 - (block $label$129 - (br_if $label$129 + (block $block112 + (block $block111 + (br_if $block111 (i32.ne (local.get $5) (i32.load @@ -8806,7 +8808,7 @@ (local.get $0) (local.get $7) ) - (br_if $label$128 + (br_if $block112 (local.get $7) ) (i32.store offset=1872 @@ -8819,7 +8821,7 @@ ) ) ) - (br $label$127) + (br $block110) ) (i32.store (i32.add @@ -8837,7 +8839,7 @@ ) (local.get $7) ) - (br_if $label$127 + (br_if $block110 (i32.eqz (local.get $7) ) @@ -8847,8 +8849,8 @@ (local.get $7) (local.get $10) ) - (block $label$130 - (br_if $label$130 + (block $block113 + (br_if $block113 (i32.eqz (local.tee $0 (i32.load offset=16 @@ -8866,7 +8868,7 @@ (local.get $7) ) ) - (br_if $label$127 + (br_if $block110 (i32.eqz (local.tee $0 (i32.load @@ -8890,9 +8892,9 @@ (local.get $7) ) ) - (block $label$131 - (block $label$132 - (br_if $label$132 + (block $block115 + (block $block114 + (br_if $block114 (i32.gt_u (local.get $1) (i32.const 15) @@ -8924,7 +8926,7 @@ (i32.const 1) ) ) - (br $label$131) + (br $block115) ) (i32.store offset=4 (local.get $5) @@ -8947,8 +8949,8 @@ ) (local.get $1) ) - (block $label$133 - (br_if $label$133 + (block $block116 + (br_if $block116 (i32.eqz (local.get $6) ) @@ -8972,9 +8974,9 @@ (i32.const 0) ) ) - (block $label$134 - (block $label$135 - (br_if $label$135 + (block $block118 + (block $block117 + (br_if $block117 (i32.and (local.tee $3 (i32.shl @@ -8995,7 +8997,7 @@ (local.set $3 (local.get $4) ) - (br $label$134) + (br $block118) ) (local.set $3 (i32.load offset=8 @@ -9036,7 +9038,7 @@ ) ) ) - (br_if $label$2 + (br_if $block1 (i32.eqz (i32.and (i32.load8_u offset=2312 @@ -9069,8 +9071,8 @@ (i32.const 2368) ) ) - (block $label$1 - (br_if $label$1 + (block $block + (br_if $block (i32.load offset=1844 (i32.const 0) ) @@ -9091,8 +9093,8 @@ (i32.const 0) (i32.const 2) ) - (block $label$2 - (br_if $label$2 + (block $block0 + (br_if $block0 (call $57 (i32.add (local.get $0) @@ -9100,7 +9102,7 @@ ) ) ) - (br_if $label$2 + (br_if $block0 (call $58 (i32.const 2316) (i32.add @@ -9152,14 +9154,14 @@ (local $5 i32) (local $6 i32) (local $7 i32) - (block $label$1 - (br_if $label$1 + (block $block + (br_if $block (i32.eqz (local.get $0) ) ) - (block $label$2 - (br_if $label$2 + (block $block0 + (br_if $block0 (i32.eqz (i32.and (i32.load8_u offset=2312 @@ -9169,7 +9171,7 @@ ) ) ) - (br_if $label$1 + (br_if $block (call $55 (i32.const 2316) ) @@ -9198,15 +9200,15 @@ ) ) ) - (block $label$3 - (block $label$4 - (br_if $label$4 + (block $block2 + (block $block1 + (br_if $block1 (i32.and (local.get $2) (i32.const 1) ) ) - (br_if $label$3 + (br_if $block2 (i32.eqz (i32.and (local.get $2) @@ -9214,7 +9216,7 @@ ) ) ) - (br_if $label$3 + (br_if $block2 (i32.lt_u (local.tee $1 (i32.sub @@ -9239,8 +9241,8 @@ (local.get $0) ) ) - (block $label$5 - (br_if $label$5 + (block $block3 + (br_if $block3 (i32.eq (i32.load offset=1888 (i32.const 0) @@ -9248,8 +9250,8 @@ (local.get $1) ) ) - (block $label$6 - (br_if $label$6 + (block $block4 + (br_if $block4 (i32.gt_u (local.get $2) (i32.const 255) @@ -9278,8 +9280,8 @@ ) ) ) - (block $label$7 - (br_if $label$7 + (block $block5 + (br_if $block5 (i32.ne (local.tee $2 (i32.load offset=12 @@ -9301,7 +9303,7 @@ ) ) ) - (br $label$4) + (br $block1) ) (drop (i32.eq @@ -9317,16 +9319,16 @@ (local.get $2) (local.get $4) ) - (br $label$4) + (br $block1) ) (local.set $7 (i32.load offset=24 (local.get $1) ) ) - (block $label$8 - (block $label$9 - (br_if $label$9 + (block $block7 + (block $block6 + (br_if $block6 (i32.eq (local.tee $6 (i32.load offset=12 @@ -9354,10 +9356,10 @@ (local.get $6) (local.get $2) ) - (br $label$8) + (br $block7) ) - (block $label$10 - (br_if $label$10 + (block $block8 + (br_if $block8 (local.tee $4 (i32.load (local.tee $2 @@ -9369,7 +9371,7 @@ ) ) ) - (br_if $label$10 + (br_if $block8 (local.tee $4 (i32.load (local.tee $2 @@ -9384,13 +9386,13 @@ (local.set $6 (i32.const 0) ) - (br $label$8) + (br $block7) ) - (loop $label$11 + (loop $label (local.set $5 (local.get $2) ) - (br_if $label$11 + (br_if $label (local.tee $4 (i32.load (local.tee $2 @@ -9410,7 +9412,7 @@ (i32.const 16) ) ) - (br_if $label$11 + (br_if $label (local.tee $4 (i32.load offset=16 (local.get $6) @@ -9423,14 +9425,14 @@ (i32.const 0) ) ) - (br_if $label$4 + (br_if $block1 (i32.eqz (local.get $7) ) ) - (block $label$12 - (block $label$13 - (br_if $label$13 + (block $block10 + (block $block9 + (br_if $block9 (i32.ne (i32.load (local.tee $2 @@ -9454,7 +9456,7 @@ (local.get $2) (local.get $6) ) - (br_if $label$12 + (br_if $block10 (local.get $6) ) (i32.store offset=1872 @@ -9469,7 +9471,7 @@ ) ) ) - (br $label$4) + (br $block1) ) (i32.store (i32.add @@ -9487,7 +9489,7 @@ ) (local.get $6) ) - (br_if $label$4 + (br_if $block1 (i32.eqz (local.get $6) ) @@ -9497,8 +9499,8 @@ (local.get $6) (local.get $7) ) - (block $label$14 - (br_if $label$14 + (block $block11 + (br_if $block11 (i32.eqz (local.tee $2 (i32.load offset=16 @@ -9516,7 +9518,7 @@ (local.get $6) ) ) - (br_if $label$4 + (br_if $block1 (i32.eqz (local.tee $2 (i32.load offset=20 @@ -9536,9 +9538,9 @@ (local.get $2) (local.get $6) ) - (br $label$4) + (br $block1) ) - (br_if $label$4 + (br_if $block1 (i32.ne (i32.and (local.tee $2 @@ -9576,15 +9578,15 @@ ) (local.get $0) ) - (br $label$3) + (br $block2) ) - (br_if $label$3 + (br_if $block2 (i32.le_u (local.get $3) (local.get $1) ) ) - (br_if $label$3 + (br_if $block2 (i32.eqz (i32.and (local.tee $2 @@ -9596,16 +9598,16 @@ ) ) ) - (block $label$15 - (block $label$16 - (br_if $label$16 + (block $block24 + (block $block12 + (br_if $block12 (i32.and (local.get $2) (i32.const 2) ) ) - (block $label$17 - (br_if $label$17 + (block $block13 + (br_if $block13 (i32.ne (i32.load offset=1892 (i32.const 0) @@ -9635,7 +9637,7 @@ (i32.const 1) ) ) - (br_if $label$3 + (br_if $block2 (i32.ne (local.get $1) (i32.load offset=1888 @@ -9651,10 +9653,10 @@ (i32.const 0) (i32.const 0) ) - (br $label$3) + (br $block2) ) - (block $label$18 - (br_if $label$18 + (block $block14 + (br_if $block14 (i32.ne (i32.load offset=1888 (i32.const 0) @@ -9691,7 +9693,7 @@ ) (local.get $0) ) - (br $label$3) + (br $block2) ) (local.set $0 (i32.add @@ -9702,9 +9704,9 @@ (local.get $0) ) ) - (block $label$19 - (block $label$20 - (br_if $label$20 + (block $block17 + (block $block15 + (br_if $block15 (i32.gt_u (local.get $2) (i32.const 255) @@ -9733,8 +9735,8 @@ ) ) ) - (block $label$21 - (br_if $label$21 + (block $block16 + (br_if $block16 (i32.ne (local.tee $2 (i32.load offset=12 @@ -9756,7 +9758,7 @@ ) ) ) - (br $label$19) + (br $block17) ) (drop (i32.eq @@ -9772,16 +9774,16 @@ (local.get $2) (local.get $4) ) - (br $label$19) + (br $block17) ) (local.set $7 (i32.load offset=24 (local.get $3) ) ) - (block $label$22 - (block $label$23 - (br_if $label$23 + (block $block19 + (block $block18 + (br_if $block18 (i32.eq (local.tee $6 (i32.load offset=12 @@ -9811,10 +9813,10 @@ (local.get $6) (local.get $2) ) - (br $label$22) + (br $block19) ) - (block $label$24 - (br_if $label$24 + (block $block20 + (br_if $block20 (local.tee $2 (i32.load (local.tee $4 @@ -9826,7 +9828,7 @@ ) ) ) - (br_if $label$24 + (br_if $block20 (local.tee $2 (i32.load (local.tee $4 @@ -9841,13 +9843,13 @@ (local.set $6 (i32.const 0) ) - (br $label$22) + (br $block19) ) - (loop $label$25 + (loop $label0 (local.set $5 (local.get $4) ) - (br_if $label$25 + (br_if $label0 (local.tee $2 (i32.load (local.tee $4 @@ -9867,7 +9869,7 @@ (i32.const 16) ) ) - (br_if $label$25 + (br_if $label0 (local.tee $2 (i32.load offset=16 (local.get $6) @@ -9880,14 +9882,14 @@ (i32.const 0) ) ) - (br_if $label$19 + (br_if $block17 (i32.eqz (local.get $7) ) ) - (block $label$26 - (block $label$27 - (br_if $label$27 + (block $block22 + (block $block21 + (br_if $block21 (i32.ne (i32.load (local.tee $2 @@ -9911,7 +9913,7 @@ (local.get $2) (local.get $6) ) - (br_if $label$26 + (br_if $block22 (local.get $6) ) (i32.store offset=1872 @@ -9926,7 +9928,7 @@ ) ) ) - (br $label$19) + (br $block17) ) (i32.store (i32.add @@ -9944,7 +9946,7 @@ ) (local.get $6) ) - (br_if $label$19 + (br_if $block17 (i32.eqz (local.get $6) ) @@ -9954,8 +9956,8 @@ (local.get $6) (local.get $7) ) - (block $label$28 - (br_if $label$28 + (block $block23 + (br_if $block23 (i32.eqz (local.tee $2 (i32.load offset=16 @@ -9973,7 +9975,7 @@ (local.get $6) ) ) - (br_if $label$19 + (br_if $block17 (i32.eqz (local.tee $2 (i32.load offset=20 @@ -10008,7 +10010,7 @@ ) (local.get $0) ) - (br_if $label$15 + (br_if $block24 (i32.ne (local.get $1) (i32.load offset=1888 @@ -10020,7 +10022,7 @@ (i32.const 0) (local.get $0) ) - (br $label$3) + (br $block2) ) (i32.store offset=4 (local.get $3) @@ -10044,8 +10046,8 @@ (local.get $0) ) ) - (block $label$29 - (br_if $label$29 + (block $block25 + (br_if $block25 (i32.gt_u (local.get $0) (i32.const 255) @@ -10065,9 +10067,9 @@ (i32.const 1908) ) ) - (block $label$30 - (block $label$31 - (br_if $label$31 + (block $block27 + (block $block26 + (br_if $block26 (i32.and (local.tee $4 (i32.load offset=1868 @@ -10092,7 +10094,7 @@ (local.set $2 (local.get $0) ) - (br $label$30) + (br $block27) ) (local.set $2 (i32.load offset=8 @@ -10116,13 +10118,13 @@ (local.get $1) (local.get $2) ) - (br $label$3) + (br $block2) ) (local.set $2 (i32.const 31) ) - (block $label$32 - (br_if $label$32 + (block $block28 + (br_if $block28 (i32.gt_u (local.get $0) (i32.const 16777215) @@ -10235,11 +10237,11 @@ (i32.const 2172) ) ) - (block $label$33 - (block $label$34 - (block $label$35 - (block $label$36 - (br_if $label$36 + (block $block32 + (block $block31 + (block $block30 + (block $block29 + (br_if $block29 (i32.and (local.tee $6 (i32.load offset=1872 @@ -10272,7 +10274,7 @@ ) (local.get $4) ) - (br $label$35) + (br $block30) ) (local.set $2 (i32.shl @@ -10298,8 +10300,8 @@ (local.get $4) ) ) - (loop $label$37 - (br_if $label$34 + (loop $label1 + (br_if $block31 (i32.eq (i32.and (i32.load offset=4 @@ -10324,7 +10326,7 @@ (i32.const 1) ) ) - (br_if $label$37 + (br_if $label1 (local.tee $6 (i32.load (local.tee $3 @@ -10363,7 +10365,7 @@ (local.get $1) (local.get $1) ) - (br $label$33) + (br $block32) ) (i32.store offset=12 (local.tee $0 @@ -10409,7 +10411,7 @@ ) ) ) - (br_if $label$1 + (br_if $block (i32.eqz (i32.and (i32.load8_u offset=2312 @@ -10427,8 +10429,8 @@ ) ) (func $63 (param $0 i32) (param $1 i32) (result i32) - (block $label$1 - (br_if $label$1 + (block $block + (br_if $block (i32.gt_u (local.get $0) (i32.const 8) @@ -10454,9 +10456,9 @@ (local.set $2 (i32.const 16) ) - (block $label$1 - (block $label$2 - (br_if $label$2 + (block $block0 + (block $block + (br_if $block (i32.and (local.tee $3 (select @@ -10477,9 +10479,9 @@ (local.set $0 (local.get $3) ) - (br $label$1) + (br $block0) ) - (loop $label$3 + (loop $label (local.set $2 (i32.shl (local.tee $0 @@ -10488,7 +10490,7 @@ (i32.const 1) ) ) - (br_if $label$3 + (br_if $label (i32.lt_u (local.get $0) (local.get $3) @@ -10496,8 +10498,8 @@ ) ) ) - (block $label$4 - (br_if $label$4 + (block $block1 + (br_if $block1 (i32.gt_u (i32.sub (i32.const -64) @@ -10514,8 +10516,8 @@ (i32.const 0) ) ) - (block $label$5 - (br_if $label$5 + (block $block2 + (br_if $block2 (local.tee $3 (call $60 (i32.add @@ -10550,9 +10552,9 @@ (local.set $2 (i32.const 0) ) - (block $label$6 - (block $label$7 - (br_if $label$7 + (block $block4 + (block $block3 + (br_if $block3 (i32.eqz (i32.and (i32.load8_u offset=2312 @@ -10562,7 +10564,7 @@ ) ) ) - (br_if $label$6 + (br_if $block4 (call $55 (i32.const 2316) ) @@ -10574,8 +10576,8 @@ (i32.const -8) ) ) - (block $label$8 - (br_if $label$8 + (block $block5 + (br_if $block5 (i32.eqz (i32.and (i32.add @@ -10641,9 +10643,9 @@ ) ) ) - (block $label$9 - (block $label$10 - (br_if $label$10 + (block $block7 + (block $block6 + (br_if $block6 (i32.and (local.get $5) (i32.const 3) @@ -10665,7 +10667,7 @@ (local.get $3) ) ) - (br $label$9) + (br $block7) ) (i32.store offset=4 (local.get $0) @@ -10734,8 +10736,8 @@ (local.get $0) ) ) - (block $label$11 - (br_if $label$11 + (block $block8 + (br_if $block8 (i32.eqz (i32.and (local.tee $0 @@ -10747,7 +10749,7 @@ ) ) ) - (br_if $label$11 + (br_if $block8 (i32.le_u (local.tee $3 (i32.and @@ -10816,7 +10818,7 @@ (i32.const 8) ) ) - (br_if $label$6 + (br_if $block4 (i32.eqz (i32.and (i32.load8_u offset=2312 @@ -10847,9 +10849,9 @@ (local.get $1) ) ) - (block $label$1 - (block $label$2 - (br_if $label$2 + (block $block0 + (block $block + (br_if $block (i32.and (local.tee $3 (i32.load offset=4 @@ -10859,7 +10861,7 @@ (i32.const 1) ) ) - (br_if $label$1 + (br_if $block0 (i32.eqz (i32.and (local.get $3) @@ -10877,9 +10879,9 @@ (local.get $1) ) ) - (block $label$3 - (block $label$4 - (br_if $label$4 + (block $block3 + (block $block1 + (br_if $block1 (i32.eq (i32.load offset=1888 (i32.const 0) @@ -10892,8 +10894,8 @@ ) ) ) - (block $label$5 - (br_if $label$5 + (block $block2 + (br_if $block2 (i32.gt_u (local.get $3) (i32.const 255) @@ -10922,7 +10924,7 @@ ) ) ) - (br_if $label$3 + (br_if $block3 (i32.ne (local.tee $3 (i32.load offset=12 @@ -10944,16 +10946,16 @@ ) ) ) - (br $label$2) + (br $block) ) (local.set $7 (i32.load offset=24 (local.get $0) ) ) - (block $label$6 - (block $label$7 - (br_if $label$7 + (block $block5 + (block $block4 + (br_if $block4 (i32.eq (local.tee $6 (i32.load offset=12 @@ -10983,10 +10985,10 @@ (local.get $6) (local.get $3) ) - (br $label$6) + (br $block5) ) - (block $label$8 - (br_if $label$8 + (block $block6 + (br_if $block6 (local.tee $4 (i32.load (local.tee $3 @@ -10998,7 +11000,7 @@ ) ) ) - (br_if $label$8 + (br_if $block6 (local.tee $4 (i32.load (local.tee $3 @@ -11013,13 +11015,13 @@ (local.set $6 (i32.const 0) ) - (br $label$6) + (br $block5) ) - (loop $label$9 + (loop $label (local.set $5 (local.get $3) ) - (br_if $label$9 + (br_if $label (local.tee $4 (i32.load (local.tee $3 @@ -11039,7 +11041,7 @@ (i32.const 16) ) ) - (br_if $label$9 + (br_if $label (local.tee $4 (i32.load offset=16 (local.get $6) @@ -11052,14 +11054,14 @@ (i32.const 0) ) ) - (br_if $label$2 + (br_if $block (i32.eqz (local.get $7) ) ) - (block $label$10 - (block $label$11 - (br_if $label$11 + (block $block8 + (block $block7 + (br_if $block7 (i32.ne (i32.load (local.tee $3 @@ -11083,7 +11085,7 @@ (local.get $3) (local.get $6) ) - (br_if $label$10 + (br_if $block8 (local.get $6) ) (i32.store offset=1872 @@ -11098,7 +11100,7 @@ ) ) ) - (br $label$2) + (br $block) ) (i32.store (i32.add @@ -11116,7 +11118,7 @@ ) (local.get $6) ) - (br_if $label$2 + (br_if $block (i32.eqz (local.get $6) ) @@ -11126,8 +11128,8 @@ (local.get $6) (local.get $7) ) - (block $label$12 - (br_if $label$12 + (block $block9 + (br_if $block9 (i32.eqz (local.tee $3 (i32.load offset=16 @@ -11145,7 +11147,7 @@ (local.get $6) ) ) - (br_if $label$2 + (br_if $block (i32.eqz (local.tee $3 (i32.load offset=20 @@ -11165,9 +11167,9 @@ (local.get $3) (local.get $6) ) - (br $label$2) + (br $block) ) - (br_if $label$2 + (br_if $block (i32.ne (i32.and (local.tee $3 @@ -11219,9 +11221,9 @@ (local.get $4) ) ) - (block $label$13 - (block $label$14 - (br_if $label$14 + (block $block22 + (block $block10 + (br_if $block10 (i32.and (local.tee $3 (i32.load offset=4 @@ -11231,8 +11233,8 @@ (i32.const 2) ) ) - (block $label$15 - (br_if $label$15 + (block $block11 + (br_if $block11 (i32.ne (i32.load offset=1892 (i32.const 0) @@ -11262,7 +11264,7 @@ (i32.const 1) ) ) - (br_if $label$1 + (br_if $block0 (i32.ne (local.get $0) (i32.load offset=1888 @@ -11280,8 +11282,8 @@ ) (return) ) - (block $label$16 - (br_if $label$16 + (block $block12 + (br_if $block12 (i32.ne (i32.load offset=1888 (i32.const 0) @@ -11329,9 +11331,9 @@ (local.get $1) ) ) - (block $label$17 - (block $label$18 - (br_if $label$18 + (block $block15 + (block $block13 + (br_if $block13 (i32.gt_u (local.get $3) (i32.const 255) @@ -11360,8 +11362,8 @@ ) ) ) - (block $label$19 - (br_if $label$19 + (block $block14 + (br_if $block14 (i32.ne (local.tee $3 (i32.load offset=12 @@ -11383,7 +11385,7 @@ ) ) ) - (br $label$17) + (br $block15) ) (drop (i32.eq @@ -11399,16 +11401,16 @@ (local.get $3) (local.get $4) ) - (br $label$17) + (br $block15) ) (local.set $7 (i32.load offset=24 (local.get $2) ) ) - (block $label$20 - (block $label$21 - (br_if $label$21 + (block $block17 + (block $block16 + (br_if $block16 (i32.eq (local.tee $6 (i32.load offset=12 @@ -11438,10 +11440,10 @@ (local.get $6) (local.get $3) ) - (br $label$20) + (br $block17) ) - (block $label$22 - (br_if $label$22 + (block $block18 + (br_if $block18 (local.tee $3 (i32.load (local.tee $4 @@ -11453,7 +11455,7 @@ ) ) ) - (br_if $label$22 + (br_if $block18 (local.tee $3 (i32.load (local.tee $4 @@ -11468,13 +11470,13 @@ (local.set $6 (i32.const 0) ) - (br $label$20) + (br $block17) ) - (loop $label$23 + (loop $label0 (local.set $5 (local.get $4) ) - (br_if $label$23 + (br_if $label0 (local.tee $3 (i32.load (local.tee $4 @@ -11494,7 +11496,7 @@ (i32.const 16) ) ) - (br_if $label$23 + (br_if $label0 (local.tee $3 (i32.load offset=16 (local.get $6) @@ -11507,14 +11509,14 @@ (i32.const 0) ) ) - (br_if $label$17 + (br_if $block15 (i32.eqz (local.get $7) ) ) - (block $label$24 - (block $label$25 - (br_if $label$25 + (block $block20 + (block $block19 + (br_if $block19 (i32.ne (i32.load (local.tee $3 @@ -11538,7 +11540,7 @@ (local.get $3) (local.get $6) ) - (br_if $label$24 + (br_if $block20 (local.get $6) ) (i32.store offset=1872 @@ -11553,7 +11555,7 @@ ) ) ) - (br $label$17) + (br $block15) ) (i32.store (i32.add @@ -11571,7 +11573,7 @@ ) (local.get $6) ) - (br_if $label$17 + (br_if $block15 (i32.eqz (local.get $6) ) @@ -11581,8 +11583,8 @@ (local.get $6) (local.get $7) ) - (block $label$26 - (br_if $label$26 + (block $block21 + (br_if $block21 (i32.eqz (local.tee $3 (i32.load offset=16 @@ -11600,7 +11602,7 @@ (local.get $6) ) ) - (br_if $label$17 + (br_if $block15 (i32.eqz (local.tee $3 (i32.load offset=20 @@ -11635,7 +11637,7 @@ ) (local.get $1) ) - (br_if $label$13 + (br_if $block22 (i32.ne (local.get $0) (i32.load offset=1888 @@ -11671,8 +11673,8 @@ (local.get $1) ) ) - (block $label$27 - (br_if $label$27 + (block $block23 + (br_if $block23 (i32.gt_u (local.get $1) (i32.const 255) @@ -11692,9 +11694,9 @@ (i32.const 1908) ) ) - (block $label$28 - (block $label$29 - (br_if $label$29 + (block $block25 + (block $block24 + (br_if $block24 (i32.and (local.tee $4 (i32.load offset=1868 @@ -11719,7 +11721,7 @@ (local.set $3 (local.get $1) ) - (br $label$28) + (br $block25) ) (local.set $3 (i32.load offset=8 @@ -11748,8 +11750,8 @@ (local.set $3 (i32.const 31) ) - (block $label$30 - (br_if $label$30 + (block $block26 + (br_if $block26 (i32.gt_u (local.get $1) (i32.const 16777215) @@ -11862,10 +11864,10 @@ (i32.const 2172) ) ) - (block $label$31 - (block $label$32 - (block $label$33 - (br_if $label$33 + (block $block29 + (block $block28 + (block $block27 + (br_if $block27 (i32.and (local.tee $6 (i32.load offset=1872 @@ -11898,7 +11900,7 @@ ) (local.get $4) ) - (br $label$32) + (br $block28) ) (local.set $3 (i32.shl @@ -11924,8 +11926,8 @@ (local.get $4) ) ) - (loop $label$34 - (br_if $label$31 + (loop $label1 + (br_if $block29 (i32.eq (i32.and (i32.load offset=4 @@ -11950,7 +11952,7 @@ (i32.const 1) ) ) - (br_if $label$34 + (br_if $label1 (local.tee $6 (i32.load (local.tee $2 @@ -12038,8 +12040,8 @@ (i32.const 1) ) ) - (block $label$1 - (loop $label$2 + (block $block0 + (loop $label (local.set $0 (i32.add (local.tee $3 @@ -12050,19 +12052,19 @@ (local.get $1) ) ) - (block $label$3 - (br_if $label$3 + (block $block + (br_if $block (local.get $2) ) - (br_if $label$1 + (br_if $block0 (i32.le_u (local.get $0) (local.get $3) ) ) ) - (block $label$4 - (br_if $label$4 + (block $block1 + (br_if $block1 (i32.le_u (local.get $0) (i32.shl @@ -12071,7 +12073,7 @@ ) ) ) - (br_if $label$1 + (br_if $block0 (i32.eqz (call $fimport$15 (local.get $0) @@ -12079,7 +12081,7 @@ ) ) ) - (br_if $label$2 + (br_if $label (i32.ne (i32.atomic.rmw.cmpxchg offset=1436 (i32.const 0) @@ -12101,8 +12103,10 @@ (i32.const -1) ) (func $67 (param $0 i32) + (nop) ) (func $68 (param $0 i32) + (nop) ) (func $69 (result i32) (call $67 @@ -12116,8 +12120,8 @@ ) ) (func $71 (param $0 i32) (result i32) - (block $label$1 - (br_if $label$1 + (block $block + (br_if $block (local.get $0) ) (return @@ -12191,11 +12195,11 @@ (i32.const 16) ) ) - (block $label$1 - (block $label$2 - (block $label$3 - (block $label$4 - (br_if $label$4 + (block $block2 + (block $block1 + (block $block0 + (block $block + (br_if $block (call $71 (call $fimport$16 (i32.load offset=60 @@ -12213,8 +12217,8 @@ ) ) ) - (loop $label$5 - (br_if $label$3 + (loop $label + (br_if $block0 (i32.eq (local.get $6) (local.tee $4 @@ -12224,7 +12228,7 @@ ) ) ) - (br_if $label$2 + (br_if $block1 (i32.le_s (local.get $4) (i32.const -1) @@ -12289,7 +12293,7 @@ (local.get $4) ) ) - (br_if $label$5 + (br_if $label (i32.eqz (call $71 (call $fimport$16 @@ -12322,7 +12326,7 @@ ) ) ) - (br_if $label$2 + (br_if $block1 (i32.ne (local.get $6) (i32.const -1) @@ -12353,7 +12357,7 @@ (local.set $4 (local.get $2) ) - (br $label$1) + (br $block2) ) (local.set $4 (i32.const 0) @@ -12375,7 +12379,7 @@ (i32.const 32) ) ) - (br_if $label$1 + (br_if $block2 (i32.eq (local.get $7) (i32.const 2) @@ -12408,6 +12412,7 @@ (i32.const 1) ) (func $76 (param $0 i32) + (nop) ) (func $77 (result i32) (global.get $global$0) @@ -12436,15 +12441,15 @@ (func $80 (param $0 i32) (result i32) (local $1 i32) (local $2 i32) - (block $label$1 - (block $label$2 - (br_if $label$2 + (block $block1 + (block $block + (br_if $block (i32.eqz (local.get $0) ) ) - (block $label$3 - (br_if $label$3 + (block $block0 + (br_if $block0 (i32.gt_s (i32.load offset=76 (local.get $0) @@ -12468,7 +12473,7 @@ (local.get $0) ) ) - (br_if $label$1 + (br_if $block1 (i32.eqz (local.get $1) ) @@ -12483,8 +12488,8 @@ (local.set $2 (i32.const 0) ) - (block $label$4 - (br_if $label$4 + (block $block2 + (br_if $block2 (i32.eqz (i32.load offset=1584 (i32.const 0) @@ -12499,8 +12504,8 @@ ) ) ) - (block $label$5 - (br_if $label$5 + (block $block3 + (br_if $block3 (i32.eqz (local.tee $0 (i32.load @@ -12509,12 +12514,12 @@ ) ) ) - (loop $label$6 + (loop $label (local.set $1 (i32.const 0) ) - (block $label$7 - (br_if $label$7 + (block $block4 + (br_if $block4 (i32.lt_s (i32.load offset=76 (local.get $0) @@ -12528,8 +12533,8 @@ ) ) ) - (block $label$8 - (br_if $label$8 + (block $block5 + (br_if $block5 (i32.le_u (i32.load offset=20 (local.get $0) @@ -12548,8 +12553,8 @@ ) ) ) - (block $label$9 - (br_if $label$9 + (block $block6 + (br_if $block6 (i32.eqz (local.get $1) ) @@ -12558,7 +12563,7 @@ (local.get $0) ) ) - (br_if $label$6 + (br_if $label (local.tee $0 (i32.load offset=56 (local.get $0) @@ -12574,8 +12579,8 @@ (func $81 (param $0 i32) (result i32) (local $1 i32) (local $2 i32) - (block $label$1 - (br_if $label$1 + (block $block + (br_if $block (i32.le_u (i32.load offset=20 (local.get $0) @@ -12595,7 +12600,7 @@ ) ) ) - (br_if $label$1 + (br_if $block (i32.load offset=20 (local.get $0) ) @@ -12604,8 +12609,8 @@ (i32.const -1) ) ) - (block $label$2 - (br_if $label$2 + (block $block0 + (br_if $block0 (i32.ge_u (local.tee $1 (i32.load offset=4 @@ -12670,8 +12675,8 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (block $label$1 - (br_if $label$1 + (block $block + (br_if $block (i32.eqz (i32.load offset=44 (local.tee $0 @@ -12683,16 +12688,16 @@ (local.set $1 (i32.const 0) ) - (loop $label$2 + (loop $label0 (local.set $2 (i32.const 0) ) (local.set $3 (i32.const 0) ) - (loop $label$3 - (block $label$4 - (br_if $label$4 + (loop $label + (block $block0 + (br_if $block0 (i32.eqz (local.tee $6 (i32.load @@ -12713,7 +12718,7 @@ ) ) ) - (br_if $label$4 + (br_if $block0 (i32.eqz (i32.load (local.tee $4 @@ -12739,7 +12744,7 @@ (i32.const 1) ) ) - (br_if $label$3 + (br_if $label (i32.ne (local.tee $2 (i32.add @@ -12751,7 +12756,7 @@ ) ) ) - (br_if $label$1 + (br_if $block (i32.gt_u (local.get $1) (i32.const 2) @@ -12763,7 +12768,7 @@ (i32.const 1) ) ) - (br_if $label$2 + (br_if $label0 (local.get $3) ) ) diff --git a/test/lld/shared_add_to_table.wasm.out b/test/lld/shared_add_to_table.wasm.out index 556c162285f..a3b9977847e 100644 --- a/test/lld/shared_add_to_table.wasm.out +++ b/test/lld/shared_add_to_table.wasm.out @@ -27,6 +27,7 @@ (call $__wasm_apply_relocs) ) (func $__wasm_apply_relocs + (nop) ) (func $waka_func_mine\28int\29 (param $0 i32) (result i32) (i32.add diff --git a/test/passes/O.bin.txt b/test/passes/O.bin.txt index 3302ebcc710..fc4724490ce 100644 --- a/test/passes/O.bin.txt +++ b/test/passes/O.bin.txt @@ -55,7 +55,7 @@ (local.set $1 (i64.const 1) ) - (loop $label$3 + (loop $label (if (i32.eqz (i64.eqz @@ -75,7 +75,7 @@ (i64.const 1) ) ) - (br $label$3) + (br $label) ) ) ) @@ -92,14 +92,14 @@ (i64.const 2) ) (then - (loop $label$3 + (loop $label (local.set $1 (i64.mul (local.get $0) (local.get $1) ) ) - (br_if $label$3 + (br_if $label (i64.gt_s (local.tee $0 (i64.sub diff --git a/test/passes/converge_O3_metrics.bin.txt b/test/passes/converge_O3_metrics.bin.txt index 712172cc794..2d9ef8f5713 100644 --- a/test/passes/converge_O3_metrics.bin.txt +++ b/test/passes/converge_O3_metrics.bin.txt @@ -59,8 +59,8 @@ total (local.set $0 (i32.const 10888) ) - (loop $label$3 - (br_if $label$3 + (loop $label + (br_if $label (i32.load8_s (local.tee $0 (i32.add @@ -94,8 +94,8 @@ total ) ) (then - (block $label$2 - (br_if $label$2 + (block $block + (br_if $block (call_indirect (type $0) (local.get $1) (i32.const 10888) @@ -113,8 +113,8 @@ total ) ) ) - (block $label$1 - (br_if $label$1 + (block $block0 + (br_if $block0 (if (result i32) (i32.load (i32.add @@ -291,8 +291,8 @@ total (local.set $0 (i32.const 10888) ) - (loop $label$3 - (br_if $label$3 + (loop $label + (br_if $label (i32.load8_s (local.tee $0 (i32.add @@ -326,8 +326,8 @@ total ) ) (then - (block $label$2 - (br_if $label$2 + (block $block + (br_if $block (call_indirect (type $0) (local.get $1) (i32.const 10888) @@ -345,8 +345,8 @@ total ) ) ) - (block $label$1 - (br_if $label$1 + (block $block0 + (br_if $block0 (if (result i32) (i32.load (i32.add @@ -518,8 +518,8 @@ total (local.set $0 (i32.const 10888) ) - (loop $label$3 - (br_if $label$3 + (loop $label + (br_if $label (i32.load8_s (local.tee $0 (i32.add @@ -553,8 +553,8 @@ total ) ) (then - (block $label$2 - (br_if $label$2 + (block $block + (br_if $block (call_indirect (type $0) (local.get $1) (i32.const 10888) @@ -572,8 +572,8 @@ total ) ) ) - (block $label$1 - (br_if $label$1 + (block $block0 + (br_if $block0 (if (result i32) (i32.load (i32.add diff --git a/test/passes/dce_vacuum_remove-unused-names.bin.txt b/test/passes/dce_vacuum_remove-unused-names.bin.txt index 8a01d2ee58b..3befa47b3c7 100644 --- a/test/passes/dce_vacuum_remove-unused-names.bin.txt +++ b/test/passes/dce_vacuum_remove-unused-names.bin.txt @@ -4,8 +4,8 @@ (export "f32.compute_radix" (func $0)) (export "f64.compute_radix" (func $1)) (func $0 (param $0 f32) (param $1 f32) (result f32) - (loop $label$2 - (br_if $label$2 + (loop $label + (br_if $label (f32.eq (f32.add (f32.sub @@ -45,8 +45,8 @@ ) ) (func $1 (param $0 f64) (param $1 f64) (result f64) - (loop $label$2 - (br_if $label$2 + (loop $label + (br_if $label (f64.eq (f64.add (f64.sub @@ -67,8 +67,8 @@ ) ) ) - (loop $label$3 - (br_if $label$3 + (loop $label0 + (br_if $label0 (f64.ne (f64.sub (f64.sub diff --git a/test/passes/flatten.bin.txt b/test/passes/flatten.bin.txt index 53fbcc3977f..680f2c393c5 100644 --- a/test/passes/flatten.bin.txt +++ b/test/passes/flatten.bin.txt @@ -100,10 +100,120 @@ (local $6 i64) (local $7 f32) (local $8 f64) - (block $label$1 + (local $9 f32) + (local $10 f32) + (local $11 f64) + (local $12 f64) + (local $13 i32) + (local $14 i32) + (local $15 i32) + (local $16 i32) + (local $17 f32) + (local $18 f32) + (local $19 i64) + (local $20 i32) + (local $21 i64) + (local $22 i32) + (local $23 f64) + (local $24 f64) + (block (nop) (unreachable) + (i64.eqz + (unreachable) + ) + (drop + (unreachable) + ) (unreachable) + (local.set $9 + (local.get $1) + ) + (local.set $10 + (f32.neg + (local.get $9) + ) + ) + (drop + (local.get $10) + ) + (local.set $11 + (local.get $2) + ) + (local.set $12 + (f64.neg + (local.get $11) + ) + ) + (drop + (local.get $12) + ) + (local.set $13 + (local.get $3) + ) + (local.set $14 + (i32.eqz + (local.get $13) + ) + ) + (drop + (local.get $14) + ) + (local.set $15 + (local.get $4) + ) + (local.set $16 + (i32.eqz + (local.get $15) + ) + ) + (drop + (local.get $16) + ) + (local.set $17 + (local.get $7) + ) + (local.set $18 + (f32.neg + (local.get $17) + ) + ) + (drop + (local.get $18) + ) + (local.set $19 + (local.get $5) + ) + (local.set $20 + (i64.eqz + (local.get $19) + ) + ) + (drop + (local.get $20) + ) + (local.set $21 + (local.get $6) + ) + (local.set $22 + (i64.eqz + (local.get $21) + ) + ) + (drop + (local.get $22) + ) + (local.set $23 + (local.get $8) + ) + (local.set $24 + (f64.neg + (local.get $23) + ) + ) + (drop + (local.get $24) + ) ) (unreachable) ) @@ -138,7 +248,7 @@ (local $32 f64) (local $33 f64) (local $34 f64) - (block $label$1 + (block (local.set $7 (f32.const 5.5) ) diff --git a/test/passes/print.bin.txt b/test/passes/print.bin.txt index 25b2cc38720..f54f883d1e5 100644 --- a/test/passes/print.bin.txt +++ b/test/passes/print.bin.txt @@ -27,8 +27,8 @@ (i32.const 55) ) (then - (loop $label$2 - (br_if $label$2 + (loop $label + (br_if $label (i32.ne (i32.rem_s (local.tee $0 @@ -120,8 +120,8 @@ (i32.const 55) ) (then - (loop $label$2 - (br_if $label$2 + (loop $label + (br_if $label (i32.ne (i32.rem_s (local.tee $0 diff --git a/test/passes/print_g_metrics.bin.txt b/test/passes/print_g_metrics.bin.txt index 2acec546f4a..084dd625686 100644 --- a/test/passes/print_g_metrics.bin.txt +++ b/test/passes/print_g_metrics.bin.txt @@ -30,8 +30,8 @@ (i32.const 55) ) (then - (loop $label$2 - (br_if $label$2 + (loop $label + (br_if $label (i32.ne (i32.rem_s (local.tee $0 @@ -120,8 +120,8 @@ total (i32.const 55) ) (then - (loop $label$2 - (br_if $label$2 + (loop $label + (br_if $label (i32.ne (i32.rem_s (local.tee $0 diff --git a/test/reduce/memory_table.wast.txt b/test/reduce/memory_table.wast.txt index ca2fde91414..5578072d110 100644 --- a/test/reduce/memory_table.wast.txt +++ b/test/reduce/memory_table.wast.txt @@ -13,6 +13,7 @@ (export "f4" (func $2)) (export "f5" (func $3)) (func $0 + (nop) ) (func $1 (result i32) (i32.store diff --git a/test/stacky.wasm.fromBinary b/test/stacky.wasm.fromBinary index 9891e10716c..d7c85091e1d 100644 --- a/test/stacky.wasm.fromBinary +++ b/test/stacky.wasm.fromBinary @@ -3,16 +3,16 @@ (memory $0 256 256) (export "add" (func $0)) (func $0 (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) + (local $scratch i32) (i32.add (block (result i32) - (local.set $2 + (local.set $scratch (local.get $0) ) (local.set $0 (i32.const 100) ) - (local.get $2) + (local.get $scratch) ) (local.get $1) ) diff --git a/test/try-delegate.wasm.fromBinary b/test/try-delegate.wasm.fromBinary index 07aee56113c..5b6d7ad2f61 100644 --- a/test/try-delegate.wasm.fromBinary +++ b/test/try-delegate.wasm.fromBinary @@ -2,41 +2,42 @@ (type $0 (func)) (tag $tag$0) (func $0 - (try $label$6 + (try $label (do - (block $label$1 - (try $label$4 - (do - ) - (delegate $label$6) + (try + (do + (nop) ) + (delegate $label) ) ) (catch $tag$0 + (nop) ) ) ) (func $1 - (try $label$9 + (try $label (do - (block $label$1 - (try $label$7 - (do + (try + (do + (nop) + ) + (catch $tag$0 + (drop + (i32.const 0) ) - (catch $tag$0 - (drop - (i32.const 0) - ) - (try $label$6 - (do - ) - (delegate $label$9) + (try + (do + (nop) ) + (delegate $label) ) ) ) ) (catch $tag$0 + (nop) ) ) ) diff --git a/test/unreachable-pops.wasm.fromBinary b/test/unreachable-pops.wasm.fromBinary index 08af405f262..d4ed2ae703c 100644 --- a/test/unreachable-pops.wasm.fromBinary +++ b/test/unreachable-pops.wasm.fromBinary @@ -1,7 +1,8 @@ (module (type $0 (func (result i32))) (func $0 (result i32) - (block $label$1 (result i32) + (i32.add + (unreachable) (unreachable) ) ) From 06a219803c4b9a4b0c64fe7f91e9fdc387b58b39 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Tue, 12 Nov 2024 11:21:30 -0800 Subject: [PATCH 07/56] Consolidate printing of function signatures There were previously two separate code paths for printing function signatures, one for imported functions and one for declared functions. The only intended difference was that parameter names were printed for declared functions but not for imported functions. Reduce duplication by consolidating the code paths, and add support for printing names for imported function parameters that have them. Also fix a bug where empty names were printed as `$` rather than the correct `$""`. --- src/passes/Print.cpp | 99 ++++++++----------- src/support/name.cpp | 2 +- test/lit/basic/imported-params.wast | 22 +++++ .../limit-segments_disable-bulk-memory.txt | 2 +- 4 files changed, 67 insertions(+), 58 deletions(-) create mode 100644 test/lit/basic/imported-params.wast diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index 854ea0b5b4d..5a5d0129996 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -382,7 +382,7 @@ struct PrintSExpression : public UnifiedExpressionVisitor { } // Module-level visitors - void handleSignature(HeapType curr, Name name = Name()); + void handleSignature(Function* curr, bool printImplicitNames = false); void visitExport(Export* curr); void emitImportHeader(Importable* curr); void visitGlobal(Global* curr); @@ -2883,41 +2883,51 @@ static bool requiresExplicitFuncType(HeapType type) { return type.isOpen() || type.isShared() || type.getRecGroup().size() > 1; } -void PrintSExpression::handleSignature(HeapType curr, Name name) { - Signature sig = curr.getSignature(); - o << "(func"; - if (name.is()) { - o << ' '; - name.print(o); - if ((currModule && currModule->features.hasGC()) || - requiresExplicitFuncType(curr)) { - o << " (type "; - printHeapType(curr) << ')'; - } +void PrintSExpression::handleSignature(Function* curr, + bool printImplicitNames) { + o << '('; + printMajor(o, "func "); + curr->name.print(o); + if ((currModule && currModule->features.hasGC()) || + requiresExplicitFuncType(curr->type)) { + o << " (type "; + printHeapType(curr->type) << ')'; } - if (sig.params.size() > 0) { - o << maybeSpace; - o << "(param "; - auto sep = ""; - for (auto type : sig.params) { - o << sep; - printType(type); - sep = " "; + bool inParam = false; + Index i = 0; + for (const auto& param : curr->getParams()) { + auto hasName = printImplicitNames || curr->hasLocalName(i); + if (hasName && inParam) { + o << ')' << maybeSpace; + inParam = false; + } else if (inParam) { + o << ' '; + } else { + o << maybeSpace; + } + if (!inParam) { + o << '('; + printMinor(o, "param "); + inParam = true; + } + if (hasName) { + printLocal(i, currFunction, o); + o << ' '; + } + printType(param); + if (hasName) { + o << ')'; + inParam = false; } + ++i; + } + if (inParam) { o << ')'; } - if (sig.results.size() > 0) { + if (curr->getResults() != Type::none) { o << maybeSpace; - o << "(result "; - auto sep = ""; - for (auto type : sig.results) { - o << sep; - printType(type); - sep = " "; - } - o << ')'; + printResultType(curr->getResults()); } - o << ")"; } void PrintSExpression::visitExport(Export* curr) { @@ -3014,8 +3024,8 @@ void PrintSExpression::visitImportedFunction(Function* curr) { lastPrintedLocation = std::nullopt; o << '('; emitImportHeader(curr); - handleSignature(curr->type, curr->name); - o << ')'; + handleSignature(curr); + o << "))"; o << maybeNewLine; } @@ -3027,30 +3037,7 @@ void PrintSExpression::visitDefinedFunction(Function* curr) { if (currFunction->prologLocation.size()) { printDebugLocation(*currFunction->prologLocation.begin()); } - o << '('; - printMajor(o, "func "); - curr->name.print(o); - if ((currModule && currModule->features.hasGC()) || - requiresExplicitFuncType(curr->type)) { - o << " (type "; - printHeapType(curr->type) << ')'; - } - if (curr->getParams().size() > 0) { - Index i = 0; - for (const auto& param : curr->getParams()) { - o << maybeSpace; - o << '('; - printMinor(o, "param "); - printLocal(i, currFunction, o); - o << ' '; - printType(param) << ')'; - ++i; - } - } - if (curr->getResults() != Type::none) { - o << maybeSpace; - printResultType(curr->getResults()); - } + handleSignature(curr, true); incIndent(); for (size_t i = curr->getVarIndexBase(); i < curr->getNumLocals(); i++) { doIndent(o, indent); diff --git a/src/support/name.cpp b/src/support/name.cpp index 4e53e3f832c..4c599defca0 100644 --- a/src/support/name.cpp +++ b/src/support/name.cpp @@ -46,7 +46,7 @@ std::ostream& Name::print(std::ostream& o) const { // TODO: This is not spec-compliant since the spec does not yet support // quoted identifiers and has a limited set of valid idchars. o << '$'; - if (std::all_of(str.begin(), str.end(), isIDChar)) { + if (size() >= 1 && std::all_of(str.begin(), str.end(), isIDChar)) { return o << str; } else { return String::printEscaped(o, str); diff --git a/test/lit/basic/imported-params.wast b/test/lit/basic/imported-params.wast new file mode 100644 index 00000000000..c81bf0870dd --- /dev/null +++ b/test/lit/basic/imported-params.wast @@ -0,0 +1,22 @@ +;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. + +;; Test that parameter names are preserved for imported functions + +;; RUN: wasm-opt %s -S -o - | filecheck %s + +(module + (import "" "" (func (param i32 i64) (param $x i32) (param $y i64) (param f32 f64))) + (import "" "" (func (param $x i32) (param f32 f64) (param $y i64))) + (import "" "" (func (param $"" i32))) +) +;; CHECK: (type $0 (func (param i32 i64 i32 i64 f32 f64))) + +;; CHECK: (type $1 (func (param i32 f32 f64 i64))) + +;; CHECK: (type $2 (func (param i32))) + +;; CHECK: (import "" "" (func $fimport$0 (param i32 i64) (param $x i32) (param $y i64) (param f32 f64))) + +;; CHECK: (import "" "" (func $fimport$1 (param $x i32) (param f32 f64) (param $y i64))) + +;; CHECK: (import "" "" (func $fimport$2 (param $"" i32))) diff --git a/test/passes/limit-segments_disable-bulk-memory.txt b/test/passes/limit-segments_disable-bulk-memory.txt index ed3388dc4a6..0cbd4a645ba 100644 --- a/test/passes/limit-segments_disable-bulk-memory.txt +++ b/test/passes/limit-segments_disable-bulk-memory.txt @@ -99998,5 +99998,5 @@ (data $99995 (i32.const 299985) "a") (data $99996 (i32.const 299988) "a") (data $99997 (i32.const 299991) "a") - (data $ (i32.const 299994) "a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a") + (data $"" (i32.const 299994) "a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a\00\00a") ) From e0b992e6e9f5c3448c50886f4e651caf2d8d8fc8 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Mon, 11 Nov 2024 16:39:21 -0800 Subject: [PATCH 08/56] Read the names section first Rather than back-patching names when we get to the names section in the binary reader, skip ahead to read the names section before anything else so we can use the final names right away. This is a prerequisite for using IRBuilder in the binary reader. The only functional change is that we now allow empty local names. Empty names are perfectly valid. --- src/wasm-binary.h | 46 +- src/wasm/wasm-binary.cpp | 650 +++++++++++++------------- test/lit/binary/empty-param-name.test | 9 +- 3 files changed, 346 insertions(+), 359 deletions(-) diff --git a/src/wasm-binary.h b/src/wasm-binary.h index 82f48708556..67c1dec968a 100644 --- a/src/wasm-binary.h +++ b/src/wasm-binary.h @@ -1547,44 +1547,31 @@ class WasmBinaryReader { Name getNextLabel(); - // We read functions and globals before we know their names, so we need to - // backpatch the names later + // We read the names section first so we know in advance what names various + // elements should have. Store the information for use when building + // expressions. + std::unordered_map functionNames; + std::unordered_map> localNames; + std::unordered_map typeNames; + std::unordered_map> fieldNames; + std::unordered_map tableNames; + std::unordered_map memoryNames; + std::unordered_map globalNames; + std::unordered_map tagNames; + std::unordered_map dataNames; + std::unordered_map elemNames; - // at index i we have all refs to the function i - std::map> functionRefs; Function* currFunction = nullptr; // before we see a function (like global init expressions), there is no end of // function to check Index endOfFunction = -1; - // at index i we have all references to the table i - std::map> tableRefs; - - std::map elemTables; - - // at index i we have all references to the memory i - std::map> memoryRefs; - - // at index i we have all refs to the global i - std::map> globalRefs; - - // at index i we have all refs to the tag i - std::map> tagRefs; - - // at index i we have all refs to the data segment i - std::map> dataRefs; - - // at index i we have all refs to the element segment i - std::map> elemRefs; - // Throws a parsing error if we are not in a function context void requireFunctionContext(const char* error); void readFunctions(); void readVars(); - std::map exportIndices; - std::vector> exportOrder; void readExports(); // The strings in the strings section (which are referred to by StringConst). @@ -1647,12 +1634,13 @@ class WasmBinaryReader { Expression* popTuple(size_t numElems); Expression* popTypedExpression(Type type); - void validateBinary(); // validations that cannot be performed on the Module - void processNames(); + // validations that cannot be performed on the Module + void validateBinary(); size_t dataCount = 0; bool hasDataCount = false; + void createDataSegments(Index count); void readDataSegments(); void readDataSegmentCount(); @@ -1662,7 +1650,7 @@ class WasmBinaryReader { void readTags(); static Name escape(Name name); - void readNames(size_t); + void findAndReadNames(); void readFeatures(size_t); void readDylink(size_t); void readDylink0(size_t); diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index 7e1daf0b11d..7ca9bc4ea3b 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -1780,10 +1780,16 @@ void WasmBinaryReader::read() { } } + // Skip ahead and read the name section so we know what names to use when we + // construct module elements. + if (debugInfo) { + findAndReadNames(); + } + readHeader(); readSourceMapHeader(); - // read sections until the end + // Read sections until the end while (more()) { uint8_t sectionCode = getInt8(); uint32_t payloadLen = getU32LEB(); @@ -1793,7 +1799,7 @@ void WasmBinaryReader::read() { auto oldPos = pos; - // note the section in the list of seen sections, as almost no sections can + // Note the section in the list of seen sections, as almost no sections can // appear more than once, and verify those that shouldn't do not. if (sectionCode != BinaryConsts::Section::Custom && !seenSections.insert(sectionCode).second) { @@ -1870,8 +1876,26 @@ void WasmBinaryReader::read() { } } + // Set local names for imported and declared functions. + for (auto& [index, locals] : localNames) { + if (index >= wasm.functions.size()) { + std::cerr << "warning: function index out of bounds in name section: " + "locals at index " + << index << '\n'; + continue; + } + for (auto& [local, name] : locals) { + if (local >= wasm.functions[index]->getNumLocals()) { + std::cerr << "warning: local index out of bounds in name section: " + << name << " at index " << local << " in function " << index + << '\n'; + continue; + } + wasm.functions[index]->setLocalName(local, name); + } + } + validateBinary(); - processNames(); } void WasmBinaryReader::readCustomSection(size_t payloadLen) { @@ -1883,11 +1907,8 @@ void WasmBinaryReader::readCustomSection(size_t payloadLen) { } payloadLen -= read; if (sectionName.equals(BinaryConsts::CustomSections::Name)) { - if (debugInfo) { - readNames(payloadLen); - } else { - pos += payloadLen; - } + // We already read the name section before anything else. + pos += payloadLen; } else if (sectionName.equals(BinaryConsts::CustomSections::TargetFeatures)) { readFeatures(payloadLen); } else if (sectionName.equals(BinaryConsts::CustomSections::Dylink)) { @@ -2233,16 +2254,47 @@ void WasmBinaryReader::readHeader() { } } -void WasmBinaryReader::readStart() { startIndex = getU32LEB(); } +void WasmBinaryReader::readStart() { + startIndex = getU32LEB(); + wasm.start = getFunctionName(startIndex); +} static Name makeName(std::string prefix, size_t counter) { return Name(prefix + std::to_string(counter)); } +// Look up a name from the names section or use a validated version of the +// provided name. Return the name and whether it is explicit in the input. +static std::pair +getOrMakeName(const std::unordered_map& nameMap, + Index i, + Name name, + std::unordered_set usedNames) { + if (auto it = nameMap.find(i); it != nameMap.end()) { + return {it->second, true}; + } else { + auto valid = Names::getValidNameGivenExisting(name, usedNames); + usedNames.insert(valid); + return {valid, false}; + } +} + void WasmBinaryReader::readMemories() { auto num = getU32LEB(); + auto numImports = wasm.memories.size(); + std::unordered_set usedNames; + for (auto& [index, name] : memoryNames) { + if (index >= num + numImports) { + std::cerr << "warning: memory index out of bounds in name section: " + << name << " at index " << index << '\n'; + } + usedNames.insert(name); + } for (size_t i = 0; i < num; i++) { - auto memory = Builder::makeMemory(makeName("", i)); + auto [name, isExplicit] = + getOrMakeName(memoryNames, numImports + i, makeName("", i), usedNames); + auto memory = Builder::makeMemory(name); + memory->hasExplicitName = isExplicit; getResizableLimits(memory->initial, memory->max, memory->shared, @@ -2423,6 +2475,39 @@ void WasmBinaryReader::readTypes() { for (Index i = 0; i < types.size(); ++i) { wasm.typeIndices.insert({types[i], i}); } + + // Assign names from the names section. + for (auto& [index, name] : typeNames) { + if (index >= types.size()) { + std::cerr << "warning: type index out of bounds in name section: " << name + << " at index " << index << '\n'; + continue; + } + wasm.typeNames[types[index]].name = name; + } + for (auto& [index, fields] : fieldNames) { + if (index >= types.size()) { + std::cerr + << "warning: type index out of bounds in name section: fields at index " + << index << '\n'; + continue; + } + if (!types[index].isStruct()) { + std::cerr << "warning: field names applied to non-struct type at index " + << index << '\n'; + continue; + } + auto& names = wasm.typeNames[types[index]].fieldNames; + for (auto& [field, name] : fields) { + if (field >= types[index].getStruct().fields.size()) { + std::cerr << "warning: field index out of bounds in name section: " + << name << " at index " << field << " in type " << index + << '\n'; + continue; + } + names[field] = name; + } + } } Name WasmBinaryReader::getFunctionName(Index index) { @@ -2513,11 +2598,8 @@ void WasmBinaryReader::getResizableLimits(Address& initial, void WasmBinaryReader::readImports() { size_t num = getU32LEB(); Builder builder(wasm); - size_t tableCounter = 0; - size_t memoryCounter = 0; - size_t functionCounter = 0; - size_t globalCounter = 0; - size_t tagCounter = 0; + std::unordered_set usedFunctionNames, usedTableNames, usedMemoryNames, + usedGlobalNames, usedTagNames; for (size_t i = 0; i < num; i++) { auto module = getInlineString(); auto base = getInlineString(); @@ -2527,7 +2609,11 @@ void WasmBinaryReader::readImports() { // could occur later due to the names section. switch (kind) { case ExternalKind::Function: { - Name name = makeName("fimport$", functionCounter++); + auto [name, isExplicit] = + getOrMakeName(functionNames, + wasm.functions.size(), + makeName("fimport$", wasm.functions.size()), + usedFunctionNames); auto index = getU32LEB(); functionTypes.push_back(getTypeByIndex(index)); auto type = getTypeByIndex(index); @@ -2537,13 +2623,20 @@ void WasmBinaryReader::readImports() { "'s type must be a signature. Given: " + type.toString()); } auto curr = builder.makeFunction(name, type, {}); + curr->hasExplicitName = isExplicit; curr->module = module; curr->base = base; wasm.addFunction(std::move(curr)); break; } case ExternalKind::Table: { - auto table = builder.makeTable(makeName("timport$", tableCounter++)); + auto [name, isExplicit] = + getOrMakeName(tableNames, + wasm.tables.size(), + makeName("timport$", wasm.tables.size()), + usedTableNames); + auto table = builder.makeTable(name); + table->hasExplicitName = isExplicit; table->module = module; table->base = base; table->type = getType(); @@ -2562,7 +2655,13 @@ void WasmBinaryReader::readImports() { break; } case ExternalKind::Memory: { - auto memory = builder.makeMemory(makeName("mimport$", memoryCounter++)); + auto [name, isExplicit] = + getOrMakeName(memoryNames, + wasm.memories.size(), + makeName("mimport$", wasm.memories.size()), + usedMemoryNames); + auto memory = builder.makeMemory(name); + memory->hasExplicitName = isExplicit; memory->module = module; memory->base = base; getResizableLimits(memory->initial, @@ -2574,26 +2673,37 @@ void WasmBinaryReader::readImports() { break; } case ExternalKind::Global: { + auto [name, isExplicit] = + getOrMakeName(globalNames, + wasm.globals.size(), + makeName("gimport$", wasm.globals.size()), + usedGlobalNames); auto type = getConcreteType(); auto mutable_ = getU32LEB(); if (mutable_ & ~1) { throwError("Global mutability must be 0 or 1"); } auto curr = - builder.makeGlobal(makeName("gimport$", globalCounter++), + builder.makeGlobal(name, type, nullptr, mutable_ ? Builder::Mutable : Builder::Immutable); + curr->hasExplicitName = isExplicit; curr->module = module; curr->base = base; wasm.addGlobal(std::move(curr)); break; } case ExternalKind::Tag: { - Name name = makeName("eimport$", tagCounter++); + auto [name, isExplicit] = + getOrMakeName(tagNames, + wasm.tags.size(), + makeName("eimport$", wasm.tags.size()), + usedTagNames); getInt8(); // Reserved 'attribute' field auto index = getU32LEB(); auto curr = builder.makeTag(name, getSignatureByTypeIndex(index)); + curr->hasExplicitName = isExplicit; curr->module = module; curr->base = base; wasm.addTag(std::move(curr)); @@ -2620,14 +2730,26 @@ void WasmBinaryReader::requireFunctionContext(const char* error) { void WasmBinaryReader::readFunctionSignatures() { size_t num = getU32LEB(); + auto numImports = wasm.functions.size(); + std::unordered_set usedNames; + for (auto& [index, name] : functionNames) { + if (index >= num + numImports) { + std::cerr << "warning: function index out of bounds in name section: " + << name << " at index " << index << '\n'; + } + usedNames.insert(name); + } for (size_t i = 0; i < num; i++) { + auto [name, isExplicit] = + getOrMakeName(functionNames, numImports + i, makeName("", i), usedNames); auto index = getU32LEB(); HeapType type = getTypeByIndex(index); functionTypes.push_back(type); // Check that the type is a signature. getSignatureByTypeIndex(index); - wasm.addFunction( - Builder(wasm).makeFunction(makeName("", i), type, {}, nullptr)); + auto func = Builder(wasm).makeFunction(name, type, {}, nullptr); + func->hasExplicitName = isExplicit; + wasm.addFunction(std::move(func)); } } @@ -2779,9 +2901,28 @@ void WasmBinaryReader::readExports() { throwError("duplicate export name"); } curr->kind = (ExternalKind)getU32LEB(); + auto* ex = wasm.addExport(std::move(curr)); auto index = getU32LEB(); - exportIndices[curr.get()] = index; - exportOrder.push_back(std::move(curr)); + switch (ex->kind) { + case ExternalKind::Function: + ex->value = getFunctionName(index); + continue; + case ExternalKind::Table: + ex->value = getTableName(index); + continue; + case ExternalKind::Memory: + ex->value = getMemoryName(index); + continue; + case ExternalKind::Global: + ex->value = getGlobalName(index); + continue; + case ExternalKind::Tag: + ex->value = getTagName(index); + continue; + case ExternalKind::Invalid: + break; + } + throwError("invalid export kind"); } } @@ -3052,18 +3193,28 @@ void WasmBinaryReader::readStrings() { void WasmBinaryReader::readGlobals() { size_t num = getU32LEB(); + auto numImports = wasm.globals.size(); + std::unordered_set usedNames; + for (auto& [index, name] : globalNames) { + if (index >= num + numImports) { + std::cerr << "warning: global index out of bounds in name section: " + << name << " at index " << index << '\n'; + } + usedNames.insert(name); + } for (size_t i = 0; i < num; i++) { + auto [name, isExplicit] = getOrMakeName( + globalNames, numImports + i, makeName("global$", i), usedNames); auto type = getConcreteType(); auto mutable_ = getU32LEB(); if (mutable_ & ~1) { throwError("Global mutability must be 0 or 1"); } auto* init = readExpression(); - wasm.addGlobal( - Builder::makeGlobal(makeName("global$", i), - type, - init, - mutable_ ? Builder::Mutable : Builder::Immutable)); + auto global = Builder::makeGlobal( + name, type, init, mutable_ ? Builder::Mutable : Builder::Immutable); + global->hasExplicitName = isExplicit; + wasm.addGlobal(std::move(global)); } } @@ -3255,77 +3406,22 @@ void WasmBinaryReader::validateBinary() { } } -void WasmBinaryReader::processNames() { - // now that we have names, apply things - - if (startIndex != static_cast(-1)) { - wasm.start = getFunctionName(startIndex); - } - - for (auto& curr : exportOrder) { - auto index = exportIndices[curr.get()]; - switch (curr->kind) { - case ExternalKind::Function: { - curr->value = getFunctionName(index); - break; - } - case ExternalKind::Table: - curr->value = getTableName(index); - break; - case ExternalKind::Memory: - curr->value = getMemoryName(index); - break; - case ExternalKind::Global: - curr->value = getGlobalName(index); - break; - case ExternalKind::Tag: - curr->value = getTagName(index); - break; - default: - throwError("bad export kind"); - } - wasm.addExport(std::move(curr)); - } - - for (auto& [index, refs] : functionRefs) { - for (auto* ref : refs) { - *ref = getFunctionName(index); - } - } - for (auto& [index, refs] : tableRefs) { - for (auto* ref : refs) { - *ref = getTableName(index); - } - } - for (auto& [index, refs] : memoryRefs) { - for (auto ref : refs) { - *ref = getMemoryName(index); - } - } - for (auto& [index, refs] : globalRefs) { - for (auto* ref : refs) { - *ref = getGlobalName(index); - } - } - for (auto& [index, refs] : tagRefs) { - for (auto* ref : refs) { - *ref = getTagName(index); - } - } - for (auto& [index, refs] : dataRefs) { - for (auto* ref : refs) { - *ref = getDataName(index); +void WasmBinaryReader::createDataSegments(Index count) { + std::unordered_set usedNames; + for (auto& [index, name] : dataNames) { + if (index >= count) { + std::cerr << "warning: data index out of bounds in name section: " << name + << " at index " << index << '\n'; } + usedNames.insert(name); } - for (auto& [index, refs] : elemRefs) { - for (auto* ref : refs) { - *ref = getElemName(index); - } + for (size_t i = 0; i < count; ++i) { + auto [name, isExplicit] = + getOrMakeName(dataNames, i, makeName("", i), usedNames); + auto curr = Builder::makeDataSegment(name); + curr->hasExplicitName = isExplicit; + wasm.addDataSegment(std::move(curr)); } - - // Everything now has its proper name. - - wasm.updateMaps(); } void WasmBinaryReader::readDataSegmentCount() { @@ -3333,11 +3429,7 @@ void WasmBinaryReader::readDataSegmentCount() { dataCount = getU32LEB(); // Eagerly create the data segments so they are available during parsing of // the code section. - for (size_t i = 0; i < dataCount; ++i) { - auto curr = Builder::makeDataSegment(); - curr->setName(Name::fromInt(i), false); - wasm.addDataSegment(std::move(curr)); - } + createDataSegments(dataCount); } void WasmBinaryReader::readDataSegments() { @@ -3348,11 +3440,7 @@ void WasmBinaryReader::readDataSegments() { } } else { // We haven't already created the data segments, so create them now. - for (size_t i = 0; i < num; ++i) { - auto curr = Builder::makeDataSegment(); - curr->setName(Name::fromInt(i), false); - wasm.addDataSegment(std::move(curr)); - } + createDataSegments(num); } assert(wasm.dataSegments.size() == num); for (size_t i = 0; i < num; i++) { @@ -3371,7 +3459,7 @@ void WasmBinaryReader::readDataSegments() { if (flags & BinaryConsts::HasIndex) { memIdx = getU32LEB(); } - memoryRefs[memIdx].push_back(&curr->memory); + curr->memory = getMemoryName(memIdx); curr->offset = readExpression(); } auto size = getU32LEB(); @@ -3381,14 +3469,25 @@ void WasmBinaryReader::readDataSegments() { } void WasmBinaryReader::readTableDeclarations() { - auto numTables = getU32LEB(); - - for (size_t i = 0; i < numTables; i++) { + auto num = getU32LEB(); + auto numImports = wasm.tables.size(); + std::unordered_set usedNames; + for (auto& [index, name] : tableNames) { + if (index >= num + numImports) { + std::cerr << "warning: table index out of bounds in name section: " + << name << " at index " << index << '\n'; + } + usedNames.insert(name); + } + for (size_t i = 0; i < num; i++) { + auto [name, isExplicit] = + getOrMakeName(tableNames, numImports + i, makeName("", i), usedNames); auto elemType = getType(); if (!elemType.isRef()) { throwError("Table type must be a reference type"); } - auto table = Builder::makeTable(makeName("", i), elemType); + auto table = Builder::makeTable(name, elemType); + table->hasExplicitName = isExplicit; bool is_shared; getResizableLimits(table->initial, table->max, @@ -3403,11 +3502,21 @@ void WasmBinaryReader::readTableDeclarations() { } void WasmBinaryReader::readElementSegments() { - auto numSegments = getU32LEB(); - if (numSegments >= Table::kMaxSize) { + auto num = getU32LEB(); + if (num >= Table::kMaxSize) { throwError("Too many segments"); } - for (size_t i = 0; i < numSegments; i++) { + std::unordered_set usedNames; + for (auto& [index, name] : elemNames) { + if (index >= num) { + std::cerr << "warning: elem index out of bounds in name section: " << name + << " at index " << index << '\n'; + } + usedNames.insert(name); + } + for (size_t i = 0; i < num; i++) { + auto [name, isExplicit] = + getOrMakeName(elemNames, i, makeName("", i), usedNames); auto flags = getU32LEB(); bool isPassive = (flags & BinaryConsts::IsPassive) != 0; bool hasTableIdx = !isPassive && ((flags & BinaryConsts::HasIndex) != 0); @@ -3431,7 +3540,7 @@ void WasmBinaryReader::readElementSegments() { } auto segment = std::make_unique(); - segment->setName(Name::fromInt(i), false); + segment->setName(name, isExplicit); if (!isPassive) { Index tableIdx = 0; @@ -3468,9 +3577,7 @@ void WasmBinaryReader::readElementSegments() { for (Index j = 0; j < size; j++) { Index index = getU32LEB(); auto sig = getTypeByFunctionIndex(index); - // Use a placeholder name for now - auto* refFunc = Builder(wasm).makeRefFunc(Name::fromInt(index), sig); - functionRefs[index].push_back(&refFunc->func); + auto* refFunc = Builder(wasm).makeRefFunc(getFunctionName(index), sig); segmentData.push_back(refFunc); } } @@ -3480,12 +3587,24 @@ void WasmBinaryReader::readElementSegments() { } void WasmBinaryReader::readTags() { - size_t numTags = getU32LEB(); - for (size_t i = 0; i < numTags; i++) { + size_t num = getU32LEB(); + auto numImports = wasm.tags.size(); + std::unordered_set usedNames; + for (auto& [index, name] : tagNames) { + if (index >= num + numImports) { + std::cerr << "warning: tag index out of bounds in name section: " << name + << " at index " << index << '\n'; + } + usedNames.insert(name); + } + for (size_t i = 0; i < num; i++) { getInt8(); // Reserved 'attribute' field + auto [name, isExplicit] = + getOrMakeName(tagNames, numImports + i, makeName("tag$", i), usedNames); auto typeIndex = getU32LEB(); - wasm.addTag(Builder::makeTag(makeName("tag$", i), - getSignatureByTypeIndex(typeIndex))); + auto tag = Builder::makeTag(name, getSignatureByTypeIndex(typeIndex)); + tag->hasExplicitName = isExplicit; + wasm.addTag(std::move(tag)); } } @@ -3531,19 +3650,6 @@ namespace { // Performs necessary processing of names from the name section before using // them. Specifically it escapes and deduplicates them. -// -// Deduplication is not trivial, since we can't only consider things in the name -// section itself. The issue is that we have already given everything a -// temporary name. Consider if we gave these two temp names: -// -// $foo$0 -// $foo$1 -// -// and imagine that the first appears in the name section, where it is given the -// the name $foo$1, and the second does not appear in the name section. In that -// case, we'd rename the second to the same name as the first. If we left things -// there that would be invalid, so we need to pick another temp name for the -// second item to resolve that. class NameProcessor { public: // Returns a unique, escaped name. Notes that name for the items to follow to @@ -3552,20 +3658,6 @@ class NameProcessor { return deduplicate(WasmBinaryReader::escape(name)); } - // After processing the names section entries, which set explicit names, we - // also handle the remaining items here, which handles the corner case - // described above. - // - // TODO: This handles vectors of Named objects; we should also do this for - // local names and type names etc. - template void deduplicateUnexplicitlyNamed(std::vector& vec) { - for (auto& x : vec) { - if (!x->hasExplicitName) { - x->name = deduplicate(x->name); - } - } - } - private: std::unordered_set usedNames; @@ -3578,8 +3670,33 @@ class NameProcessor { } // anonymous namespace -void WasmBinaryReader::readNames(size_t payloadLen) { - auto sectionPos = pos; +void WasmBinaryReader::findAndReadNames() { + // Find the names section. Skip the magic and version. + assert(pos == 0); + getInt32(); + getInt32(); + Index payloadLen, sectionPos; + bool found = false; + while (more()) { + uint8_t sectionCode = getInt8(); + payloadLen = getU32LEB(); + sectionPos = pos; + if (sectionCode == BinaryConsts::Section::Custom) { + auto sectionName = getInlineString(); + if (sectionName.equals(BinaryConsts::CustomSections::Name)) { + found = true; + break; + } + } + pos = sectionPos + payloadLen; + } + if (!found) { + // No names section to read. + pos = 0; + return; + } + + // Read the names. uint32_t lastType = 0; while (pos < sectionPos + payloadLen) { auto nameType = getU32LEB(); @@ -3600,51 +3717,19 @@ void WasmBinaryReader::readNames(size_t payloadLen) { auto index = getU32LEB(); auto rawName = getInlineString(); auto name = processor.process(rawName); - if (index < wasm.functions.size()) { - wasm.functions[index]->setExplicitName(name); - } else { - std::cerr << "warning: function index out of bounds in name section, " - "function subsection: " - << std::string(rawName.str) << " at index " - << std::to_string(index) << std::endl; - } + functionNames[index] = name; } - processor.deduplicateUnexplicitlyNamed(wasm.functions); } else if (nameType == Subsection::NameLocal) { auto numFuncs = getU32LEB(); for (size_t i = 0; i < numFuncs; i++) { auto funcIndex = getU32LEB(); - Function* func = nullptr; - if (funcIndex < wasm.functions.size()) { - func = wasm.functions[funcIndex].get(); - } else { - std::cerr - << "warning: function index out of bounds in name section, local " - "subsection: " - << std::to_string(funcIndex) << std::endl; - } auto numLocals = getU32LEB(); NameProcessor processor; for (size_t j = 0; j < numLocals; j++) { auto localIndex = getU32LEB(); - auto rawLocalName = getInlineString(); - if (!func) { - continue; // read and discard in case of prior error - } - auto localName = processor.process(rawLocalName); - if (localName.size() == 0) { - std::cerr << "warning: empty local name at index " - << std::to_string(localIndex) << " in function " - << std::string(func->name.str) << std::endl; - } else if (localIndex < func->getNumLocals()) { - func->localNames[localIndex] = localName; - } else { - std::cerr << "warning: local index out of bounds in name " - "section, local subsection: " - << std::string(rawLocalName.str) << " at index " - << std::to_string(localIndex) << " in function " - << std::string(func->name.str) << std::endl; - } + auto rawName = getInlineString(); + auto name = processor.process(rawName); + localNames[funcIndex][localIndex] = name; } } } else if (nameType == Subsection::NameType) { @@ -3654,14 +3739,7 @@ void WasmBinaryReader::readNames(size_t payloadLen) { auto index = getU32LEB(); auto rawName = getInlineString(); auto name = processor.process(rawName); - if (index < types.size()) { - wasm.typeNames[types[index]].name = name; - } else { - std::cerr << "warning: type index out of bounds in name section, " - "type subsection: " - << std::string(rawName.str) << " at index " - << std::to_string(index) << std::endl; - } + typeNames[index] = name; } } else if (nameType == Subsection::NameTable) { auto num = getU32LEB(); @@ -3670,23 +3748,8 @@ void WasmBinaryReader::readNames(size_t payloadLen) { auto index = getU32LEB(); auto rawName = getInlineString(); auto name = processor.process(rawName); - - if (index < wasm.tables.size()) { - auto* table = wasm.tables[index].get(); - for (auto& segment : wasm.elementSegments) { - if (segment->table == table->name) { - segment->table = name; - } - } - table->setExplicitName(name); - } else { - std::cerr << "warning: table index out of bounds in name section, " - "table subsection: " - << std::string(rawName.str) << " at index " - << std::to_string(index) << std::endl; - } + tableNames[index] = name; } - processor.deduplicateUnexplicitlyNamed(wasm.tables); } else if (nameType == Subsection::NameElem) { auto num = getU32LEB(); NameProcessor processor; @@ -3694,17 +3757,8 @@ void WasmBinaryReader::readNames(size_t payloadLen) { auto index = getU32LEB(); auto rawName = getInlineString(); auto name = processor.process(rawName); - - if (index < wasm.elementSegments.size()) { - wasm.elementSegments[index]->setExplicitName(name); - } else { - std::cerr << "warning: elem index out of bounds in name section, " - "elem subsection: " - << std::string(rawName.str) << " at index " - << std::to_string(index) << std::endl; - } + elemNames[index] = name; } - processor.deduplicateUnexplicitlyNamed(wasm.elementSegments); } else if (nameType == Subsection::NameMemory) { auto num = getU32LEB(); NameProcessor processor; @@ -3712,16 +3766,8 @@ void WasmBinaryReader::readNames(size_t payloadLen) { auto index = getU32LEB(); auto rawName = getInlineString(); auto name = processor.process(rawName); - if (index < wasm.memories.size()) { - wasm.memories[index]->setExplicitName(name); - } else { - std::cerr << "warning: memory index out of bounds in name section, " - "memory subsection: " - << std::string(rawName.str) << " at index " - << std::to_string(index) << std::endl; - } + memoryNames[index] = name; } - processor.deduplicateUnexplicitlyNamed(wasm.memories); } else if (nameType == Subsection::NameData) { auto num = getU32LEB(); NameProcessor processor; @@ -3729,16 +3775,8 @@ void WasmBinaryReader::readNames(size_t payloadLen) { auto index = getU32LEB(); auto rawName = getInlineString(); auto name = processor.process(rawName); - if (index < wasm.dataSegments.size()) { - wasm.dataSegments[index]->setExplicitName(name); - } else { - std::cerr << "warning: data index out of bounds in name section, " - "data subsection: " - << std::string(rawName.str) << " at index " - << std::to_string(index) << std::endl; - } + dataNames[index] = name; } - processor.deduplicateUnexplicitlyNamed(wasm.dataSegments); } else if (nameType == Subsection::NameGlobal) { auto num = getU32LEB(); NameProcessor processor; @@ -3746,16 +3784,8 @@ void WasmBinaryReader::readNames(size_t payloadLen) { auto index = getU32LEB(); auto rawName = getInlineString(); auto name = processor.process(rawName); - if (index < wasm.globals.size()) { - wasm.globals[index]->setExplicitName(name); - } else { - std::cerr << "warning: global index out of bounds in name section, " - "global subsection: " - << std::string(rawName.str) << " at index " - << std::to_string(index) << std::endl; - } + globalNames[index] = name; } - processor.deduplicateUnexplicitlyNamed(wasm.globals); } else if (nameType == Subsection::NameField) { auto numTypes = getU32LEB(); for (size_t i = 0; i < numTypes; i++) { @@ -3771,9 +3801,7 @@ void WasmBinaryReader::readNames(size_t payloadLen) { auto fieldIndex = getU32LEB(); auto rawName = getInlineString(); auto name = processor.process(rawName); - if (validType) { - wasm.typeNames[types[typeIndex]].fieldNames[fieldIndex] = name; - } + fieldNames[typeIndex][fieldIndex] = name; } } } else if (nameType == Subsection::NameTag) { @@ -3783,16 +3811,8 @@ void WasmBinaryReader::readNames(size_t payloadLen) { auto index = getU32LEB(); auto rawName = getInlineString(); auto name = processor.process(rawName); - if (index < wasm.tags.size()) { - wasm.tags[index]->setExplicitName(name); - } else { - std::cerr << "warning: tag index out of bounds in name section, " - "tag subsection: " - << std::string(rawName.str) << " at index " - << std::to_string(index) << std::endl; - } + tagNames[index] = name; } - processor.deduplicateUnexplicitlyNamed(wasm.tags); } else { std::cerr << "warning: unknown name subsection with id " << std::to_string(nameType) << " at " << pos << std::endl; @@ -3805,6 +3825,8 @@ void WasmBinaryReader::readNames(size_t payloadLen) { if (pos != sectionPos + payloadLen) { throwError("bad names section position change"); } + + pos = 0; } void WasmBinaryReader::readFeatures(size_t payloadLen) { @@ -4614,8 +4636,7 @@ void WasmBinaryReader::visitCall(Call* curr) { curr->operands[num - i - 1] = popNonVoidExpression(); } curr->type = sig.results; - // We don't know function names yet. - functionRefs[index].push_back(&curr->target); + curr->target = getFunctionName(index); curr->finalize(); } @@ -4630,8 +4651,7 @@ void WasmBinaryReader::visitCallIndirect(CallIndirect* curr) { for (size_t i = 0; i < num; i++) { curr->operands[num - i - 1] = popNonVoidExpression(); } - // Defer setting the table name for later, when we know it. - tableRefs[tableIdx].push_back(&curr->table); + curr->table = getTableName(tableIdx); curr->finalize(); } @@ -4668,7 +4688,6 @@ void WasmBinaryReader::visitGlobalGet(GlobalGet* curr) { auto* global = wasm.globals[index].get(); curr->name = global->name; curr->type = global->type; - globalRefs[index].push_back(&curr->name); // we don't know the final name yet } void WasmBinaryReader::visitGlobalSet(GlobalSet* curr) { @@ -4678,7 +4697,6 @@ void WasmBinaryReader::visitGlobalSet(GlobalSet* curr) { } curr->name = wasm.globals[index]->name; curr->value = popNonVoidExpression(); - globalRefs[index].push_back(&curr->name); // we don't know the final name yet curr->finalize(); } @@ -4853,7 +4871,7 @@ bool WasmBinaryReader::maybeVisitLoad( curr->isAtomic = prefix == BinaryConsts::AtomicPrefix; Index memIdx = readMemoryAccess(curr->align, curr->offset); - memoryRefs[memIdx].push_back(&curr->memory); + curr->memory = getMemoryName(memIdx); curr->ptr = popNonVoidExpression(); curr->finalize(); out = curr; @@ -4971,7 +4989,7 @@ bool WasmBinaryReader::maybeVisitStore( curr->isAtomic = prefix == BinaryConsts::AtomicPrefix; Index memIdx = readMemoryAccess(curr->align, curr->offset); - memoryRefs[memIdx].push_back(&curr->memory); + curr->memory = getMemoryName(memIdx); curr->value = popNonVoidExpression(); curr->ptr = popNonVoidExpression(); curr->finalize(); @@ -5031,7 +5049,7 @@ bool WasmBinaryReader::maybeVisitAtomicRMW(Expression*& out, uint8_t code) { Address readAlign; Index memIdx = readMemoryAccess(readAlign, curr->offset); - memoryRefs[memIdx].push_back(&curr->memory); + curr->memory = getMemoryName(memIdx); if (readAlign != curr->bytes) { throwError("Align of AtomicRMW must match size"); } @@ -5082,7 +5100,7 @@ bool WasmBinaryReader::maybeVisitAtomicCmpxchg(Expression*& out, uint8_t code) { Address readAlign; Index memIdx = readMemoryAccess(readAlign, curr->offset); - memoryRefs[memIdx].push_back(&curr->memory); + curr->memory = getMemoryName(memIdx); if (readAlign != curr->bytes) { throwError("Align of AtomicCpxchg must match size"); } @@ -5117,7 +5135,7 @@ bool WasmBinaryReader::maybeVisitAtomicWait(Expression*& out, uint8_t code) { curr->ptr = popNonVoidExpression(); Address readAlign; Index memIdx = readMemoryAccess(readAlign, curr->offset); - memoryRefs[memIdx].push_back(&curr->memory); + curr->memory = getMemoryName(memIdx); if (readAlign != curr->expectedType.getByteSize()) { throwError("Align of AtomicWait must match size"); } @@ -5137,7 +5155,7 @@ bool WasmBinaryReader::maybeVisitAtomicNotify(Expression*& out, uint8_t code) { curr->ptr = popNonVoidExpression(); Address readAlign; Index memIdx = readMemoryAccess(readAlign, curr->offset); - memoryRefs[memIdx].push_back(&curr->memory); + curr->memory = getMemoryName(memIdx); if (readAlign != curr->type.getByteSize()) { throwError("Align of AtomicNotify must match size"); } @@ -5464,9 +5482,9 @@ bool WasmBinaryReader::maybeVisitMemoryInit(Expression*& out, uint32_t code) { curr->offset = popNonVoidExpression(); curr->dest = popNonVoidExpression(); Index segIdx = getU32LEB(); - dataRefs[segIdx].push_back(&curr->segment); + curr->segment = getDataName(segIdx); Index memIdx = getU32LEB(); - memoryRefs[memIdx].push_back(&curr->memory); + curr->memory = getMemoryName(memIdx); curr->finalize(); out = curr; return true; @@ -5478,7 +5496,7 @@ bool WasmBinaryReader::maybeVisitDataDrop(Expression*& out, uint32_t code) { } auto* curr = allocator.alloc(); Index segIdx = getU32LEB(); - dataRefs[segIdx].push_back(&curr->segment); + curr->segment = getDataName(segIdx); curr->finalize(); out = curr; return true; @@ -5495,8 +5513,8 @@ bool WasmBinaryReader::maybeVisitMemoryCopy(Expression*& out, uint32_t code) { Index destIdx = getU32LEB(); Index sourceIdx = getU32LEB(); curr->finalize(); - memoryRefs[destIdx].push_back(&curr->destMemory); - memoryRefs[sourceIdx].push_back(&curr->sourceMemory); + curr->destMemory = getMemoryName(destIdx); + curr->sourceMemory = getMemoryName(sourceIdx); out = curr; return true; } @@ -5511,7 +5529,7 @@ bool WasmBinaryReader::maybeVisitMemoryFill(Expression*& out, uint32_t code) { curr->dest = popNonVoidExpression(); Index memIdx = getU32LEB(); curr->finalize(); - memoryRefs[memIdx].push_back(&curr->memory); + curr->memory = getMemoryName(memIdx); out = curr; return true; } @@ -5528,9 +5546,8 @@ bool WasmBinaryReader::maybeVisitTableSize(Expression*& out, uint32_t code) { if (getTable(tableIdx)->is64()) { curr->type = Type::i64; } + curr->table = getTableName(tableIdx); curr->finalize(); - // Defer setting the table name for later, when we know it. - tableRefs[tableIdx].push_back(&curr->table); out = curr; return true; } @@ -5549,9 +5566,8 @@ bool WasmBinaryReader::maybeVisitTableGrow(Expression*& out, uint32_t code) { if (getTable(tableIdx)->is64()) { curr->type = Type::i64; } + curr->table = getTableName(tableIdx); curr->finalize(); - // Defer setting the table name for later, when we know it. - tableRefs[tableIdx].push_back(&curr->table); out = curr; return true; } @@ -5568,7 +5584,7 @@ bool WasmBinaryReader::maybeVisitTableFill(Expression*& out, uint32_t code) { auto* value = popNonVoidExpression(); auto* dest = popNonVoidExpression(); auto* ret = Builder(wasm).makeTableFill(Name(), dest, value, size); - tableRefs[tableIdx].push_back(&ret->table); + ret->table = getTableName(tableIdx); out = ret; return true; } @@ -5589,8 +5605,8 @@ bool WasmBinaryReader::maybeVisitTableCopy(Expression*& out, uint32_t code) { auto* source = popNonVoidExpression(); auto* dest = popNonVoidExpression(); auto* ret = Builder(wasm).makeTableCopy(dest, source, size, Name(), Name()); - tableRefs[destTableIdx].push_back(&ret->destTable); - tableRefs[sourceTableIdx].push_back(&ret->sourceTable); + ret->destTable = getTableName(destTableIdx); + ret->sourceTable = getTableName(sourceTableIdx); out = ret; return true; } @@ -5604,9 +5620,9 @@ bool WasmBinaryReader::maybeVisitTableInit(Expression*& out, uint32_t code) { curr->offset = popNonVoidExpression(); curr->dest = popNonVoidExpression(); Index segIdx = getU32LEB(); - elemRefs[segIdx].push_back(&curr->segment); - Index memIdx = getU32LEB(); - tableRefs[memIdx].push_back(&curr->table); + curr->segment = getElemName(segIdx); + Index tableIdx = getU32LEB(); + curr->table = getTableName(tableIdx); curr->finalize(); out = curr; return true; @@ -6620,7 +6636,7 @@ bool WasmBinaryReader::maybeVisitSIMDStore(Expression*& out, uint32_t code) { curr->bytes = 16; curr->valueType = Type::v128; Index memIdx = readMemoryAccess(curr->align, curr->offset); - memoryRefs[memIdx].push_back(&curr->memory); + curr->memory = getMemoryName(memIdx); curr->isAtomic = false; curr->value = popNonVoidExpression(); curr->ptr = popNonVoidExpression(); @@ -6878,7 +6894,7 @@ bool WasmBinaryReader::maybeVisitSIMDLoad(Expression*& out, uint32_t code) { curr->type = Type::v128; curr->bytes = 16; Index memIdx = readMemoryAccess(curr->align, curr->offset); - memoryRefs[memIdx].push_back(&curr->memory); + curr->memory = getMemoryName(memIdx); curr->isAtomic = false; curr->ptr = popNonVoidExpression(); curr->finalize(); @@ -6939,7 +6955,7 @@ bool WasmBinaryReader::maybeVisitSIMDLoad(Expression*& out, uint32_t code) { return false; } Index memIdx = readMemoryAccess(curr->align, curr->offset); - memoryRefs[memIdx].push_back(&curr->memory); + curr->memory = getMemoryName(memIdx); curr->ptr = popNonVoidExpression(); curr->finalize(); out = curr; @@ -6989,7 +7005,7 @@ bool WasmBinaryReader::maybeVisitSIMDLoadStoreLane(Expression*& out, auto* curr = allocator.alloc(); curr->op = op; Index memIdx = readMemoryAccess(curr->align, curr->offset); - memoryRefs[memIdx].push_back(&curr->memory); + curr->memory = getMemoryName(memIdx); curr->index = getLaneIndex(lanes); curr->vec = popNonVoidExpression(); curr->ptr = popNonVoidExpression(); @@ -7035,8 +7051,8 @@ void WasmBinaryReader::visitMemorySize(MemorySize* curr) { if (getMemory(index)->is64()) { curr->type = Type::i64; } + curr->memory = getMemoryName(index); curr->finalize(); - memoryRefs[index].push_back(&curr->memory); } void WasmBinaryReader::visitMemoryGrow(MemoryGrow* curr) { @@ -7045,7 +7061,7 @@ void WasmBinaryReader::visitMemoryGrow(MemoryGrow* curr) { if (getMemory(index)->is64()) { curr->type = Type::i64; } - memoryRefs[index].push_back(&curr->memory); + curr->memory = getMemoryName(index); } void WasmBinaryReader::visitNop(Nop* curr) {} @@ -7068,12 +7084,7 @@ void WasmBinaryReader::visitRefIsNull(RefIsNull* curr) { void WasmBinaryReader::visitRefFunc(RefFunc* curr) { Index index = getU32LEB(); - // We don't know function names yet, so record this use to be updated later. - // Note that we do not need to check that 'index' is in bounds, as that will - // be verified in the next line. (Also, note that functionRefs[index] may - // write to an odd place in the functionRefs map if index is invalid, but that - // is harmless.) - functionRefs[index].push_back(&curr->func); + curr->func = getFunctionName(index); // To support typed function refs, we give the reference not just a general // funcref, but a specific subtype with the actual signature. curr->finalize(Type(getTypeByFunctionIndex(index), NonNullable)); @@ -7092,9 +7103,8 @@ void WasmBinaryReader::visitTableGet(TableGet* curr) { } curr->index = popNonVoidExpression(); curr->type = wasm.tables[tableIdx]->type; + curr->table = getTableName(tableIdx); curr->finalize(); - // Defer setting the table name for later, when we know it. - tableRefs[tableIdx].push_back(&curr->table); } void WasmBinaryReader::visitTableSet(TableSet* curr) { @@ -7104,9 +7114,8 @@ void WasmBinaryReader::visitTableSet(TableSet* curr) { } curr->value = popNonVoidExpression(); curr->index = popNonVoidExpression(); + curr->table = getTableName(tableIdx); curr->finalize(); - // Defer setting the table name for later, when we know it. - tableRefs[tableIdx].push_back(&curr->table); } void WasmBinaryReader::visitTryOrTryInBlock(Expression*& out) { @@ -7169,8 +7178,7 @@ void WasmBinaryReader::visitTryOrTryInBlock(Expression*& out) { breakStack.pop_back(); for (Index i = 0; i < tagIndexes.size(); i++) { - // We don't know the final name yet. - tagRefs[tagIndexes[i]].push_back(&curr->catchTags[i]); + curr->catchTags[i] = getTagName(tagIndexes[i]); } if (lastSeparator == BinaryConsts::Delegate) { @@ -7293,8 +7301,7 @@ void WasmBinaryReader::visitTryTable(TryTable* curr) { for (Index i = 0; i < tagIndexes.size(); i++) { if (curr->catchTags[i]) { - // We don't know the final name yet. - tagRefs[tagIndexes[i]].push_back(&curr->catchTags[i]); + curr->catchTags[i] = getTagName(tagIndexes[i]); } } @@ -7312,7 +7319,6 @@ void WasmBinaryReader::visitThrow(Throw* curr) { } auto* tag = wasm.tags[index].get(); curr->tag = tag->name; - tagRefs[index].push_back(&curr->tag); // we don't know the final name yet size_t num = tag->sig.params.size(); curr->operands.resize(num); for (size_t i = 0; i < num; i++) { @@ -7563,14 +7569,12 @@ bool WasmBinaryReader::maybeVisitArrayNewElem(Expression*& out, uint32_t code) { auto* size = popNonVoidExpression(); auto* offset = popNonVoidExpression(); if (isData) { - auto* curr = - Builder(wasm).makeArrayNewData(heapType, Name(), offset, size); - dataRefs[segIdx].push_back(&curr->segment); + auto* curr = Builder(wasm).makeArrayNewData( + heapType, getDataName(segIdx), offset, size); out = curr; } else { - auto* curr = - Builder(wasm).makeArrayNewElem(heapType, Name(), offset, size); - elemRefs[segIdx].push_back(&curr->segment); + auto* curr = Builder(wasm).makeArrayNewElem( + heapType, getElemName(segIdx), offset, size); out = curr; } return true; @@ -7708,14 +7712,12 @@ bool WasmBinaryReader::maybeVisitArrayInit(Expression*& out, uint32_t code) { auto* ref = popNonVoidExpression(); validateHeapTypeUsingChild(ref, heapType); if (isData) { - auto* curr = - Builder(wasm).makeArrayInitData(Name(), ref, index, offset, size); - dataRefs[segIdx].push_back(&curr->segment); + auto* curr = Builder(wasm).makeArrayInitData( + getDataName(segIdx), ref, index, offset, size); out = curr; } else { - auto* curr = - Builder(wasm).makeArrayInitElem(Name(), ref, index, offset, size); - elemRefs[segIdx].push_back(&curr->segment); + auto* curr = Builder(wasm).makeArrayInitElem( + getElemName(segIdx), ref, index, offset, size); out = curr; } return true; @@ -7941,9 +7943,6 @@ void WasmBinaryReader::visitResume(Resume* curr) { curr->handlerTags[i] = tag; curr->handlerBlocks[i] = handler; - - // We don't know the final name yet - tagRefs[tagIndex].push_back(&curr->handlerTags[i]); } curr->cont = popNonVoidExpression(); @@ -7966,7 +7965,6 @@ void WasmBinaryReader::visitSuspend(Suspend* curr) { } auto* tag = wasm.tags[tagIndex].get(); curr->tag = tag->name; - tagRefs[tagIndex].push_back(&curr->tag); auto numArgs = tag->sig.params.size(); curr->operands.resize(numArgs); diff --git a/test/lit/binary/empty-param-name.test b/test/lit/binary/empty-param-name.test index 2216d0bbb7f..aa89f3afcc1 100644 --- a/test/lit/binary/empty-param-name.test +++ b/test/lit/binary/empty-param-name.test @@ -1,4 +1,5 @@ -;; Test that we show a warning on an empty local name, and do not crash. +;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. +;; Test that we handle an empty local name, and do not crash. ;; ;; The binary contains this, processed by wabt with debug names: ;; @@ -8,7 +9,7 @@ ;; Wabt emits a name for that parameter, but it is the empty string. See ;; https://github.com/WebAssembly/wabt/issues/1799 -;; RUN: wasm-opt %s.wasm 2>&1 | filecheck %s - -;; CHECK: warning: empty local name at index 0 in function foo +;; RUN: wasm-opt %s.wasm -S -o - | filecheck %s +;; CHECK: (type $0 (func (param i32))) +;; CHECK: (import "imports" "foo" (func $foo (param $"" i32))) From 2d1d9147022aff59349357d7a18e2269e6993ea4 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Tue, 12 Nov 2024 17:15:34 -0800 Subject: [PATCH 09/56] address comments --- src/wasm/wasm-binary.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index 7ca9bc4ea3b..57a01bb1ce2 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -2269,7 +2269,7 @@ static std::pair getOrMakeName(const std::unordered_map& nameMap, Index i, Name name, - std::unordered_set usedNames) { + std::unordered_set& usedNames) { if (auto it = nameMap.find(i); it != nameMap.end()) { return {it->second, true}; } else { @@ -3826,6 +3826,7 @@ void WasmBinaryReader::findAndReadNames() { throwError("bad names section position change"); } + // Reset the position; we were just reading ahead. pos = 0; } From 68b5012dd1e2b767a11d3712eae1eee47b983981 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Wed, 13 Nov 2024 14:26:12 -0800 Subject: [PATCH 10/56] Fixup pops when necessary in IRBuilder IRBuilder introduces scratch locals to hoist values from underneath stacky code to the top of the stack for consumption by the next instruction. When it does so, the sequence of instructions from the set to the get of the scratch local is packaged in a block so the entire sequence can be made a child of the next instruction. In cases where the hoisted value comes from a `pop`, this packaging can make the IR invalid, since `pop`s are not allowed to appear inside blocks. Detect when this problem occurs and fix it by running `EHUtils::handleBlockNestedPops` after the function containing the problem has been constructed. --- src/wasm-ir-builder.h | 12 ++++++++++ src/wasm/wasm-ir-builder.cpp | 14 ++++++++++-- test/lit/basic/pop-fixup.wast | 41 +++++++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 test/lit/basic/pop-fixup.wast diff --git a/src/wasm-ir-builder.h b/src/wasm-ir-builder.h index d7a1dde87b9..98bb30cd5ba 100644 --- a/src/wasm-ir-builder.h +++ b/src/wasm-ir-builder.h @@ -259,6 +259,7 @@ class IRBuilder : public UnifiedExpressionVisitor> { struct NoScope {}; struct FuncScope { Function* func; + bool needsPopFixup = false; }; struct BlockScope { Block* block; @@ -369,6 +370,17 @@ class IRBuilder : public UnifiedExpressionVisitor> { } return nullptr; } + void setNeedsPopFixup() { + if (auto* funcScope = std::get_if(&scope)) { + funcScope->needsPopFixup = true; + } + } + bool needsPopFixup() { + if (auto* funcScope = std::get_if(&scope)) { + return funcScope->needsPopFixup; + } + return false; + } Block* getBlock() { if (auto* blockScope = std::get_if(&scope)) { return blockScope->block; diff --git a/src/wasm/wasm-ir-builder.cpp b/src/wasm/wasm-ir-builder.cpp index b238a926c42..7fa58e4b48f 100644 --- a/src/wasm/wasm-ir-builder.cpp +++ b/src/wasm/wasm-ir-builder.cpp @@ -17,6 +17,7 @@ #include #include "ir/child-typer.h" +#include "ir/eh-utils.h" #include "ir/names.h" #include "ir/properties.h" #include "ir/utils.h" @@ -98,7 +99,13 @@ Result<> IRBuilder::packageHoistedValue(const HoistedVal& hoisted, auto packageAsBlock = [&](Type type) { // Create a block containing the producer of the hoisted value, the final - // get of the hoisted value, and everything in between. + // get of the hoisted value, and everything in between. If the hoisted value + // is a `pop`, then we will have to run a fixup to move it out of the block + // later. + assert(hoisted.get); + if (scope.exprStack[hoisted.valIndex]->cast()->value->is()) { + scopeStack[0].setNeedsPopFixup(); + } std::vector exprs(scope.exprStack.begin() + hoisted.valIndex, scope.exprStack.end()); auto* block = builder.makeBlock(exprs, type); @@ -935,7 +942,7 @@ Result<> IRBuilder::visitEnd() { if (scope.isNone()) { return Err{"unexpected end"}; } - if (auto* func = scope.getFunction(); func) { + if (auto* func = scope.getFunction()) { if (auto* loc = std::get_if(&debugLoc)) { func->epilogLocation.insert(*loc); } @@ -970,6 +977,9 @@ Result<> IRBuilder::visitEnd() { if (auto* func = scope.getFunction()) { func->body = maybeWrapForLabel(*expr); labelDepths.clear(); + if (scope.needsPopFixup()) { + EHUtils::handleBlockNestedPops(func, wasm); + } } else if (auto* block = scope.getBlock()) { assert(*expr == block); block->name = scope.label; diff --git a/test/lit/basic/pop-fixup.wast b/test/lit/basic/pop-fixup.wast new file mode 100644 index 00000000000..c6184229fca --- /dev/null +++ b/test/lit/basic/pop-fixup.wast @@ -0,0 +1,41 @@ +;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited. +;; RUN: wasm-opt %s -all -S -o - | filecheck %s + +(module + ;; CHECK: (tag $e (param i32)) + (tag $e (param i32)) + + ;; CHECK: (func $stacky (type $0) (param $0 i32) + ;; CHECK-NEXT: (local $scratch i32) + ;; CHECK-NEXT: (local $2 i32) + ;; CHECK-NEXT: (try + ;; CHECK-NEXT: (do + ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (catch $e + ;; CHECK-NEXT: (local.set $2 + ;; CHECK-NEXT: (pop i32) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $0 + ;; CHECK-NEXT: (block (result i32) + ;; CHECK-NEXT: (local.set $scratch + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (local.get $scratch) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $stacky (param i32) + try + catch $e + ;; The implicit pop is set to a scratch local to be hoisted above the nop. + ;; The sequence is placed in a block, requiring a fixup to move the pop back + ;; out of the block. + nop + local.set 0 + end + ) +) From 69096267fc91a72775c134a388eba14b3316f46e Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Wed, 13 Nov 2024 15:42:25 -0800 Subject: [PATCH 11/56] generalize --- src/wasm-ir-builder.h | 21 +++- src/wasm/wasm-ir-builder.cpp | 16 +-- test/lit/basic/pop-fixup.wast | 188 ++++++++++++++++++++++++++++++++-- 3 files changed, 203 insertions(+), 22 deletions(-) diff --git a/src/wasm-ir-builder.h b/src/wasm-ir-builder.h index 98bb30cd5ba..40689a879e6 100644 --- a/src/wasm-ir-builder.h +++ b/src/wasm-ir-builder.h @@ -259,7 +259,10 @@ class IRBuilder : public UnifiedExpressionVisitor> { struct NoScope {}; struct FuncScope { Function* func; - bool needsPopFixup = false; + // Used to determine whether we need to run a fixup after creating the + // function. + bool hasSyntheticBlock = false; + bool hasPop = false; }; struct BlockScope { Block* block; @@ -370,14 +373,24 @@ class IRBuilder : public UnifiedExpressionVisitor> { } return nullptr; } - void setNeedsPopFixup() { + void noteSyntheticBlock() { if (auto* funcScope = std::get_if(&scope)) { - funcScope->needsPopFixup = true; + funcScope->hasSyntheticBlock = true; + } + } + void notePop() { + if (auto* funcScope = std::get_if(&scope)) { + funcScope->hasPop = true; } } bool needsPopFixup() { + // If the function has a synthetic block and it has a pop, then it's + // possible that the pop is inside the synthetic block and we should run + // the fixup. Determining more precisely that a pop is inside the + // synthetic block when it is created would be complicated and expensive, + // so we are conservative here. if (auto* funcScope = std::get_if(&scope)) { - return funcScope->needsPopFixup; + return funcScope->hasSyntheticBlock && funcScope->hasPop; } return false; } diff --git a/src/wasm/wasm-ir-builder.cpp b/src/wasm/wasm-ir-builder.cpp index 7fa58e4b48f..4cb9514f59e 100644 --- a/src/wasm/wasm-ir-builder.cpp +++ b/src/wasm/wasm-ir-builder.cpp @@ -99,13 +99,10 @@ Result<> IRBuilder::packageHoistedValue(const HoistedVal& hoisted, auto packageAsBlock = [&](Type type) { // Create a block containing the producer of the hoisted value, the final - // get of the hoisted value, and everything in between. If the hoisted value - // is a `pop`, then we will have to run a fixup to move it out of the block - // later. - assert(hoisted.get); - if (scope.exprStack[hoisted.valIndex]->cast()->value->is()) { - scopeStack[0].setNeedsPopFixup(); - } + // get of the hoisted value, and everything in between. Record the fact that + // we are synthesizing a block to help us determine later whether we need to + // run the nested pop fixup. + scopeStack[0].noteSyntheticBlock(); std::vector exprs(scope.exprStack.begin() + hoisted.valIndex, scope.exprStack.end()); auto* block = builder.makeBlock(exprs, type); @@ -872,9 +869,12 @@ Result<> IRBuilder::visitCatch(Name tag) { tryy->catchTags.push_back(tag); pushScope( ScopeCtx::makeCatch(tryy, originalLabel, label, labelUsed, branchLabel)); - // Push a pop for the exception payload. + // Push a pop for the exception payload if necessary. auto params = wasm.getTag(tag)->sig.params; if (params != Type::none) { + // Note that we have a pop to help determine later whether we need to run + // the fixup for pops within blocks. + scopeStack[0].notePop(); push(builder.makePop(params)); } return Ok{}; diff --git a/test/lit/basic/pop-fixup.wast b/test/lit/basic/pop-fixup.wast index c6184229fca..371365a0cc9 100644 --- a/test/lit/basic/pop-fixup.wast +++ b/test/lit/basic/pop-fixup.wast @@ -4,22 +4,57 @@ (module ;; CHECK: (tag $e (param i32)) (tag $e (param i32)) + ;; CHECK: (tag $e2 (param i32 i32)) + (tag $e2 (param i32 i32)) - ;; CHECK: (func $stacky (type $0) (param $0 i32) + ;; CHECK: (func $stacky (type $0) ;; CHECK-NEXT: (local $scratch i32) - ;; CHECK-NEXT: (local $2 i32) + ;; CHECK-NEXT: (local $1 i32) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $e - ;; CHECK-NEXT: (local.set $2 + ;; CHECK-NEXT: (local.set $1 + ;; CHECK-NEXT: (pop i32) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (block (result i32) + ;; CHECK-NEXT: (local.set $scratch + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (local.get $scratch) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $stacky + try + catch $e + nop + drop + end + ) + + ;; CHECK: (func $stacky-later (type $0) + ;; CHECK-NEXT: (local $scratch i32) + ;; CHECK-NEXT: (local $1 i32) + ;; CHECK-NEXT: (try + ;; CHECK-NEXT: (do + ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (catch $e + ;; CHECK-NEXT: (local.set $1 ;; CHECK-NEXT: (pop i32) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.set $0 + ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (block (result i32) ;; CHECK-NEXT: (local.set $scratch - ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: (i32.eqz + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: (local.get $scratch) @@ -28,14 +63,147 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - (func $stacky (param i32) + (func $stacky-later try catch $e - ;; The implicit pop is set to a scratch local to be hoisted above the nop. - ;; The sequence is placed in a block, requiring a fixup to move the pop back - ;; out of the block. + i32.eqz + nop + drop + end + ) + + ;; CHECK: (func $tuple (type $0) + ;; CHECK-NEXT: (local $scratch (tuple i32 i32)) + ;; CHECK-NEXT: (local $scratch_1 i32) + ;; CHECK-NEXT: (local $2 (tuple i32 i32)) + ;; CHECK-NEXT: (try + ;; CHECK-NEXT: (do + ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (catch $e2 + ;; CHECK-NEXT: (local.set $2 + ;; CHECK-NEXT: (pop (tuple i32 i32)) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (block (result i32) + ;; CHECK-NEXT: (local.set $scratch_1 + ;; CHECK-NEXT: (tuple.extract 2 0 + ;; CHECK-NEXT: (local.tee $scratch + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (tuple.extract 2 1 + ;; CHECK-NEXT: (local.get $scratch) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $scratch_1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $tuple + try + catch $e2 + drop + drop + end + ) + + ;; CHECK: (func $stacky-tuple (type $0) + ;; CHECK-NEXT: (local $scratch (tuple i32 i32)) + ;; CHECK-NEXT: (local $scratch_1 i32) + ;; CHECK-NEXT: (local $2 (tuple i32 i32)) + ;; CHECK-NEXT: (try + ;; CHECK-NEXT: (do + ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (catch $e2 + ;; CHECK-NEXT: (local.set $2 + ;; CHECK-NEXT: (pop (tuple i32 i32)) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (block (result i32) + ;; CHECK-NEXT: (local.set $scratch_1 + ;; CHECK-NEXT: (block (result i32) + ;; CHECK-NEXT: (local.set $scratch + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (tuple.extract 2 0 + ;; CHECK-NEXT: (local.get $scratch) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (tuple.extract 2 1 + ;; CHECK-NEXT: (local.get $scratch) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $scratch_1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $stacky-tuple + try + catch $e2 + nop + drop + drop + end + ) + + ;; CHECK: (func $stacky-later-tuple (type $0) + ;; CHECK-NEXT: (local $0 (tuple i32 i32)) + ;; CHECK-NEXT: (local $scratch (tuple i32 i32)) + ;; CHECK-NEXT: (local $scratch_2 i32) + ;; CHECK-NEXT: (local $3 (tuple i32 i32)) + ;; CHECK-NEXT: (try + ;; CHECK-NEXT: (do + ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (catch $e2 + ;; CHECK-NEXT: (local.set $3 + ;; CHECK-NEXT: (pop (tuple i32 i32)) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (block (result i32) + ;; CHECK-NEXT: (local.set $scratch_2 + ;; CHECK-NEXT: (block (result i32) + ;; CHECK-NEXT: (local.set $scratch + ;; CHECK-NEXT: (local.tee $0 + ;; CHECK-NEXT: (local.get $3) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (tuple.extract 2 0 + ;; CHECK-NEXT: (local.get $scratch) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (tuple.extract 2 1 + ;; CHECK-NEXT: (local.get $scratch) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $scratch_2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $stacky-later-tuple + (local (tuple i32 i32)) + try + catch $e2 + local.tee 0 nop - local.set 0 + drop + drop end ) ) From 535bd22ee9745ef9e12ee5e20ff1af94c518a24e Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Wed, 13 Nov 2024 16:00:26 -0800 Subject: [PATCH 12/56] update stacky eh binary tests --- test/lit/binary/stacky-eh-legacy.test | 19 ++- test/lit/binary/stacky-nn-tuple.test | 228 +++++++++++++------------- 2 files changed, 131 insertions(+), 116 deletions(-) diff --git a/test/lit/binary/stacky-eh-legacy.test b/test/lit/binary/stacky-eh-legacy.test index ffaefc3e465..c77435f0b10 100644 --- a/test/lit/binary/stacky-eh-legacy.test +++ b/test/lit/binary/stacky-eh-legacy.test @@ -1,3 +1,4 @@ +;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. ;; Verify stacky EH binary can be parsed correctly. ;; ;; stacky-eh-old.test.wasm contains below: @@ -34,15 +35,21 @@ ;; The fixup will hoist the 'pop' and create another local to store it right ;; after 'catch'. -RUN: wasm-opt -all %s.wasm -S -o - | filecheck %s +;; RUN: wasm-opt -all %s.wasm -S -o - | filecheck %s -;; CHECK: (func $0 +;; CHECK: (type $0 (func (param i32))) + +;; CHECK: (type $1 (func)) + +;; CHECK: (tag $tag$0 (param i32)) + +;; CHECK: (func $0 (type $1) ;; CHECK-NEXT: (local $0 i32) ;; CHECK-NEXT: (local $1 i32) ;; CHECK-NEXT: (local $2 i32) -;; CHECK-NEXT: (local $3 i32) +;; CHECK-NEXT: (local $scratch i32) ;; CHECK-NEXT: (local $4 i32) -;; CHECK-NEXT: (try $label$3 +;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) @@ -52,13 +59,13 @@ RUN: wasm-opt -all %s.wasm -S -o - | filecheck %s ;; CHECK-NEXT: ) ;; CHECK-NEXT: (local.set $2 ;; CHECK-NEXT: (block (result i32) -;; CHECK-NEXT: (local.set $3 +;; CHECK-NEXT: (local.set $scratch ;; CHECK-NEXT: (local.get $4) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (local.set $1 ;; CHECK-NEXT: (i32.const 3) ;; CHECK-NEXT: ) -;; CHECK-NEXT: (local.get $3) +;; CHECK-NEXT: (local.get $scratch) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) diff --git a/test/lit/binary/stacky-nn-tuple.test b/test/lit/binary/stacky-nn-tuple.test index 731114e34f2..1f6b5bb59eb 100644 --- a/test/lit/binary/stacky-nn-tuple.test +++ b/test/lit/binary/stacky-nn-tuple.test @@ -1,112 +1,120 @@ -# Verify stacky non-nullable tuples binary can be parsed correctly. The wasm -# contains code that uses pops to get a tuple and store it in a local, then -# reads those values. The file contains this: -# -# (module -# (type $A (struct (field (mut i32)))) -# (type $B (struct (field (mut i32)) (field (mut i32)))) -# (tag $tag$0 (param (ref $A) (ref $B))) -# (func $foo -# (local $temp ((ref null $A) (ref null $B))) -# (try $label$3 -# (do -# (nop) -# ) -# (catch $tag$0 -# (local.set $temp -# (pop (ref $A) (ref $B)) -# ) -# (drop -# (ref.as_non_null -# (tuple.extract 0 -# (local.get $temp) -# ) -# ) -# ) -# (drop -# (ref.as_non_null -# (tuple.extract 1 -# (local.get $temp) -# ) -# ) -# ) -# (unreachable) -# ) -# ) -# ) -# ) +;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. +;; Verify stacky non-nullable tuples binary can be parsed correctly. The wasm +;; contains code that uses pops to get a tuple and store it in a local, then +;; reads those values. The file contains this: +;; +;; (module +;; (type $A (struct (field (mut i32)))) +;; (type $B (struct (field (mut i32)) (field (mut i32)))) +;; (tag $tag$0 (param (ref $A) (ref $B))) +;; (func $foo +;; (local $temp ((ref null $A) (ref null $B))) +;; (try $label$3 +;; (do +;; (nop) +;; ) +;; (catch $tag$0 +;; (local.set $temp +;; (pop (ref $A) (ref $B)) +;; ) +;; (drop +;; (ref.as_non_null +;; (tuple.extract 0 +;; (local.get $temp) +;; ) +;; ) +;; ) +;; (drop +;; (ref.as_non_null +;; (tuple.extract 1 +;; (local.get $temp) +;; ) +;; ) +;; ) +;; (unreachable) +;; ) +;; ) +;; ) +;; ) -RUN: wasm-opt -all %s.wasm -all -S -o - | filecheck %s +;; RUN: wasm-opt -all %s.wasm -all -S -o - | filecheck %s -# CHECK: (module -# CHECK-NEXT: (type ${mut:i32} (struct (field (mut i32)))) -# CHECK-NEXT: (type ${mut:i32_mut:i32} (struct (field (mut i32)) (field (mut i32)))) -# CHECK-NEXT: (type $ref|{mut:i32}|_ref|{mut:i32_mut:i32}|_=>_none (func (param (ref ${mut:i32}) (ref ${mut:i32_mut:i32})))) -# CHECK-NEXT: (type $none_=>_none (func)) -# CHECK-NEXT: (tag $tag$0 (param (ref ${mut:i32}) (ref ${mut:i32_mut:i32}))) -# CHECK-NEXT: (func $0 -# CHECK-NEXT: (local $0 (ref null ${mut:i32})) -# CHECK-NEXT: (local $1 (ref null ${mut:i32_mut:i32})) -# CHECK-NEXT: (local $2 (ref null ${mut:i32_mut:i32})) -# CHECK-NEXT: (local $3 ((ref ${mut:i32}) (ref ${mut:i32_mut:i32}))) -# CHECK-NEXT: (local $4 (ref ${mut:i32})) -# CHECK-NEXT: (local $5 (ref null ${mut:i32})) -# CHECK-NEXT: (local $6 (ref null ${mut:i32})) -# CHECK-NEXT: (try $label$3 -# CHECK-NEXT: (do -# CHECK-NEXT: (nop) -# CHECK-NEXT: ) -# CHECK-NEXT: (catch $tag$0 -# CHECK-NEXT: (local.set $3 -# CHECK-NEXT: (pop (ref ${mut:i32}) (ref ${mut:i32_mut:i32})) -# CHECK-NEXT: ) -# CHECK-NEXT: (local.set $0 -# CHECK-NEXT: (block (result (ref ${mut:i32})) -# CHECK-NEXT: (local.set $4 -# CHECK-NEXT: (tuple.extract 0 -# CHECK-NEXT: (local.get $3) -# CHECK-NEXT: ) -# CHECK-NEXT: ) -# CHECK-NEXT: (local.set $1 -# CHECK-NEXT: (tuple.extract 1 -# CHECK-NEXT: (local.get $3) -# CHECK-NEXT: ) -# CHECK-NEXT: ) -# CHECK-NEXT: (local.get $4) -# CHECK-NEXT: ) -# CHECK-NEXT: ) -# CHECK-NEXT: (drop -# CHECK-NEXT: (ref.as_non_null -# CHECK-NEXT: (block (result (ref null ${mut:i32})) -# CHECK-NEXT: (local.set $5 -# CHECK-NEXT: (local.get $0) -# CHECK-NEXT: ) -# CHECK-NEXT: (drop -# CHECK-NEXT: (local.get $1) -# CHECK-NEXT: ) -# CHECK-NEXT: (local.get $5) -# CHECK-NEXT: ) -# CHECK-NEXT: ) -# CHECK-NEXT: ) -# CHECK-NEXT: (drop -# CHECK-NEXT: (block (result (ref null ${mut:i32})) -# CHECK-NEXT: (local.set $6 -# CHECK-NEXT: (local.get $0) -# CHECK-NEXT: ) -# CHECK-NEXT: (local.set $2 -# CHECK-NEXT: (local.get $1) -# CHECK-NEXT: ) -# CHECK-NEXT: (local.get $6) -# CHECK-NEXT: ) -# CHECK-NEXT: ) -# CHECK-NEXT: (drop -# CHECK-NEXT: (ref.as_non_null -# CHECK-NEXT: (local.get $2) -# CHECK-NEXT: ) -# CHECK-NEXT: ) -# CHECK-NEXT: (unreachable) -# CHECK-NEXT: ) -# CHECK-NEXT: ) -# CHECK-NEXT: ) -# CHECK-NEXT: ) -# CHECK-NEXT: +;; CHECK: (type $0 (struct (field (mut i32)))) + +;; CHECK: (type $1 (struct (field (mut i32)) (field (mut i32)))) + +;; CHECK: (type $2 (func (param (ref null $0) (ref null $1)))) + +;; CHECK: (type $3 (func)) + +;; CHECK: (tag $tag$0 (param (ref null $0) (ref null $1))) + +;; CHECK: (func $0 (type $3) +;; CHECK-NEXT: (local $0 (ref null $0)) +;; CHECK-NEXT: (local $1 (ref null $1)) +;; CHECK-NEXT: (local $2 (ref null $1)) +;; CHECK-NEXT: (local $scratch (tuple (ref null $0) (ref null $1))) +;; CHECK-NEXT: (local $scratch_4 (ref null $0)) +;; CHECK-NEXT: (local $scratch_5 (ref null $0)) +;; CHECK-NEXT: (local $scratch_6 (ref null $0)) +;; CHECK-NEXT: (local $7 (tuple (ref null $0) (ref null $1))) +;; CHECK-NEXT: (try +;; CHECK-NEXT: (do +;; CHECK-NEXT: (nop) +;; CHECK-NEXT: ) +;; CHECK-NEXT: (catch $tag$0 +;; CHECK-NEXT: (local.set $7 +;; CHECK-NEXT: (pop (tuple (ref null $0) (ref null $1))) +;; CHECK-NEXT: ) +;; CHECK-NEXT: (block +;; CHECK-NEXT: (local.set $0 +;; CHECK-NEXT: (block (result (ref null $0)) +;; CHECK-NEXT: (local.set $scratch_4 +;; CHECK-NEXT: (tuple.extract 2 0 +;; CHECK-NEXT: (local.tee $scratch +;; CHECK-NEXT: (local.get $7) +;; CHECK-NEXT: ) +;; CHECK-NEXT: ) +;; CHECK-NEXT: ) +;; CHECK-NEXT: (local.set $1 +;; CHECK-NEXT: (tuple.extract 2 1 +;; CHECK-NEXT: (local.get $scratch) +;; CHECK-NEXT: ) +;; CHECK-NEXT: ) +;; CHECK-NEXT: (local.get $scratch_4) +;; CHECK-NEXT: ) +;; CHECK-NEXT: ) +;; CHECK-NEXT: (drop +;; CHECK-NEXT: (ref.as_non_null +;; CHECK-NEXT: (block (result (ref null $0)) +;; CHECK-NEXT: (local.set $scratch_5 +;; CHECK-NEXT: (local.get $0) +;; CHECK-NEXT: ) +;; CHECK-NEXT: (drop +;; CHECK-NEXT: (local.get $1) +;; CHECK-NEXT: ) +;; CHECK-NEXT: (local.get $scratch_5) +;; CHECK-NEXT: ) +;; CHECK-NEXT: ) +;; CHECK-NEXT: ) +;; CHECK-NEXT: (drop +;; CHECK-NEXT: (block (result (ref null $0)) +;; CHECK-NEXT: (local.set $scratch_6 +;; CHECK-NEXT: (local.get $0) +;; CHECK-NEXT: ) +;; CHECK-NEXT: (local.set $2 +;; CHECK-NEXT: (local.get $1) +;; CHECK-NEXT: ) +;; CHECK-NEXT: (local.get $scratch_6) +;; CHECK-NEXT: ) +;; CHECK-NEXT: ) +;; CHECK-NEXT: (drop +;; CHECK-NEXT: (ref.as_non_null +;; CHECK-NEXT: (local.get $2) +;; CHECK-NEXT: ) +;; CHECK-NEXT: ) +;; CHECK-NEXT: (unreachable) +;; CHECK-NEXT: ) +;; CHECK-NEXT: ) +;; CHECK-NEXT: ) +;; CHECK-NEXT: ) From 2a75afd41f804d2ca21e21f610fe5e0864d1139a Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Wed, 13 Nov 2024 16:55:20 -0800 Subject: [PATCH 13/56] [NFC] Eagerly set local names in binary reader Instead of setting the local names at the end of binary reading, eagerly set them before parsing function bodies. This is NFC now, but will fix a future bug once the binary reader uses IRBuilder. IRBuilder can introduce new scratch locals, and it gives them the names `$scratch`, `$scratch_1`, etc. If the name section includes locals with the same names and we set those local names after parsing function bodies, then we can end up with multiple locals with the same names. Setting the names before parsing the function bodies ensures that IRBuilder will generate different names for the scratch locals. The alternative fix would be to generate fresh names when setting names from the name section, but it is better to respect the names in the name section and use fresh names for the newly introduced scratch locals instead. --- src/wasm-binary.h | 1 + src/wasm/wasm-binary.cpp | 35 ++++++++++++++++------------------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/wasm-binary.h b/src/wasm-binary.h index 67c1dec968a..59114cdb8a5 100644 --- a/src/wasm-binary.h +++ b/src/wasm-binary.h @@ -1571,6 +1571,7 @@ class WasmBinaryReader { void readFunctions(); void readVars(); + void setLocalNames(Function& func, Index i); void readExports(); diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index 57a01bb1ce2..2b31e271577 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -1876,25 +1876,6 @@ void WasmBinaryReader::read() { } } - // Set local names for imported and declared functions. - for (auto& [index, locals] : localNames) { - if (index >= wasm.functions.size()) { - std::cerr << "warning: function index out of bounds in name section: " - "locals at index " - << index << '\n'; - continue; - } - for (auto& [local, name] : locals) { - if (local >= wasm.functions[index]->getNumLocals()) { - std::cerr << "warning: local index out of bounds in name section: " - << name << " at index " << local << " in function " << index - << '\n'; - continue; - } - wasm.functions[index]->setLocalName(local, name); - } - } - validateBinary(); } @@ -2626,6 +2607,7 @@ void WasmBinaryReader::readImports() { curr->hasExplicitName = isExplicit; curr->module = module; curr->base = base; + setLocalNames(*curr, wasm.functions.size()); wasm.addFunction(std::move(curr)); break; } @@ -2728,6 +2710,20 @@ void WasmBinaryReader::requireFunctionContext(const char* error) { } } +void WasmBinaryReader::setLocalNames(Function& func, Index i) { + if (auto it = localNames.find(i); it != localNames.end()) { + for (auto& [local, name] : it->second) { + if (local >= func.getNumLocals()) { + std::cerr << "warning: local index out of bounds in name section: " + << name << " at index " << local << " in function " << i + << '\n'; + continue; + } + func.setLocalName(local, name); + } + } +} + void WasmBinaryReader::readFunctionSignatures() { size_t num = getU32LEB(); auto numImports = wasm.functions.size(); @@ -2810,6 +2806,7 @@ void WasmBinaryReader::readFunctions() { readNextDebugLocation(); readVars(); + setLocalNames(*func, numFuncImports + i); func->prologLocation = debugLocation; { From aa15420bf87918ea5f526e33d1555902c505de69 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Wed, 13 Nov 2024 17:09:29 -0800 Subject: [PATCH 14/56] update tests --- test/lit/basic/exception-handling-legacy.wast | 68 +++++++++++-------- test/lit/cast-and-recast-tuple.wast | 12 ++-- test/lit/string.as_wtf16.wast | 30 ++++---- 3 files changed, 61 insertions(+), 49 deletions(-) diff --git a/test/lit/basic/exception-handling-legacy.wast b/test/lit/basic/exception-handling-legacy.wast index ba3e6d6d2de..da32fdf49d6 100644 --- a/test/lit/basic/exception-handling-legacy.wast +++ b/test/lit/basic/exception-handling-legacy.wast @@ -130,6 +130,7 @@ ;; CHECK-BIN-NEXT: (local $1 i64) ;; CHECK-BIN-NEXT: (local $scratch (tuple i32 i64)) ;; CHECK-BIN-NEXT: (local $scratch_3 i32) + ;; CHECK-BIN-NEXT: (local $4 (tuple i32 i64)) ;; CHECK-BIN-NEXT: (try ;; CHECK-BIN-NEXT: (do ;; CHECK-BIN-NEXT: (throw $e-i32-i64 @@ -138,25 +139,30 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (catch $e-i32-i64 - ;; CHECK-BIN-NEXT: (local.set $x - ;; CHECK-BIN-NEXT: (block (result i32) - ;; CHECK-BIN-NEXT: (local.set $scratch_3 - ;; CHECK-BIN-NEXT: (tuple.extract 2 0 - ;; CHECK-BIN-NEXT: (local.tee $scratch - ;; CHECK-BIN-NEXT: (pop (tuple i32 i64)) + ;; CHECK-BIN-NEXT: (local.set $4 + ;; CHECK-BIN-NEXT: (pop (tuple i32 i64)) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (block + ;; CHECK-BIN-NEXT: (local.set $x + ;; CHECK-BIN-NEXT: (block (result i32) + ;; CHECK-BIN-NEXT: (local.set $scratch_3 + ;; CHECK-BIN-NEXT: (tuple.extract 2 0 + ;; CHECK-BIN-NEXT: (local.tee $scratch + ;; CHECK-BIN-NEXT: (local.get $4) + ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (local.set $1 - ;; CHECK-BIN-NEXT: (tuple.extract 2 1 - ;; CHECK-BIN-NEXT: (local.get $scratch) + ;; CHECK-BIN-NEXT: (local.set $1 + ;; CHECK-BIN-NEXT: (tuple.extract 2 1 + ;; CHECK-BIN-NEXT: (local.get $scratch) + ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: (local.get $scratch_3) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (local.get $scratch_3) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (local.get $x) + ;; CHECK-BIN-NEXT: (drop + ;; CHECK-BIN-NEXT: (local.get $x) + ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -1374,6 +1380,7 @@ ;; CHECK-BIN-NODEBUG-NEXT: (local $1 i64) ;; CHECK-BIN-NODEBUG-NEXT: (local $scratch (tuple i32 i64)) ;; CHECK-BIN-NODEBUG-NEXT: (local $scratch_3 i32) +;; CHECK-BIN-NODEBUG-NEXT: (local $4 (tuple i32 i64)) ;; CHECK-BIN-NODEBUG-NEXT: (try ;; CHECK-BIN-NODEBUG-NEXT: (do ;; CHECK-BIN-NODEBUG-NEXT: (throw $tag$2 @@ -1382,25 +1389,30 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (catch $tag$2 -;; CHECK-BIN-NODEBUG-NEXT: (local.set $0 -;; CHECK-BIN-NODEBUG-NEXT: (block (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (local.set $scratch_3 -;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 2 0 -;; CHECK-BIN-NODEBUG-NEXT: (local.tee $scratch -;; CHECK-BIN-NODEBUG-NEXT: (pop (tuple i32 i64)) +;; CHECK-BIN-NODEBUG-NEXT: (local.set $4 +;; CHECK-BIN-NODEBUG-NEXT: (pop (tuple i32 i64)) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (block +;; CHECK-BIN-NODEBUG-NEXT: (local.set $0 +;; CHECK-BIN-NODEBUG-NEXT: (block (result i32) +;; CHECK-BIN-NODEBUG-NEXT: (local.set $scratch_3 +;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 2 0 +;; CHECK-BIN-NODEBUG-NEXT: (local.tee $scratch +;; CHECK-BIN-NODEBUG-NEXT: (local.get $4) +;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (local.set $1 -;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 2 1 -;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch) +;; CHECK-BIN-NODEBUG-NEXT: (local.set $1 +;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 2 1 +;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch) +;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch_3) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch_3) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) +;; CHECK-BIN-NODEBUG-NEXT: (drop +;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) +;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) diff --git a/test/lit/cast-and-recast-tuple.wast b/test/lit/cast-and-recast-tuple.wast index aed0a4fc144..6ceefe7d605 100644 --- a/test/lit/cast-and-recast-tuple.wast +++ b/test/lit/cast-and-recast-tuple.wast @@ -241,11 +241,11 @@ ;; CHECK-NEXT: (local $3 (ref $B)) ;; CHECK-NEXT: (local $4 (ref $A)) ;; CHECK-NEXT: (local $5 i32) - ;; CHECK-NEXT: (local $scratch_16 i32) + ;; CHECK-NEXT: (local $scratch i32) ;; CHECK-NEXT: (local $7 i32) ;; CHECK-NEXT: (local $8 i32) ;; CHECK-NEXT: (local $9 i32) - ;; CHECK-NEXT: (local $scratch (tuple i32 (ref $B) i32)) + ;; CHECK-NEXT: (local $scratch_10 (tuple i32 (ref $B) i32)) ;; CHECK-NEXT: (local $scratch_11 (ref $B)) ;; CHECK-NEXT: (local $scratch_12 i32) ;; CHECK-NEXT: (local $scratch_13 (ref $B)) @@ -256,7 +256,7 @@ ;; CHECK-NEXT: (block (result i32) ;; CHECK-NEXT: (local.set $scratch_12 ;; CHECK-NEXT: (tuple.extract 3 0 - ;; CHECK-NEXT: (local.tee $scratch + ;; CHECK-NEXT: (local.tee $scratch_10 ;; CHECK-NEXT: (br_if $block ;; CHECK-NEXT: (tuple.make 3 ;; CHECK-NEXT: (i32.const -3) @@ -272,12 +272,12 @@ ;; CHECK-NEXT: (block (result (ref $B)) ;; CHECK-NEXT: (local.set $scratch_11 ;; CHECK-NEXT: (tuple.extract 3 1 - ;; CHECK-NEXT: (local.get $scratch) + ;; CHECK-NEXT: (local.get $scratch_10) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (local.set $8 ;; CHECK-NEXT: (tuple.extract 3 2 - ;; CHECK-NEXT: (local.get $scratch) + ;; CHECK-NEXT: (local.get $scratch_10) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (local.get $scratch_11) @@ -287,7 +287,7 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (local.tee $scratch_16 + ;; CHECK-NEXT: (local.tee $scratch ;; CHECK-NEXT: (block (result i32) ;; CHECK-NEXT: (local.set $scratch_14 ;; CHECK-NEXT: (local.get $9) diff --git a/test/lit/string.as_wtf16.wast b/test/lit/string.as_wtf16.wast index f2559178d25..760f5744529 100644 --- a/test/lit/string.as_wtf16.wast +++ b/test/lit/string.as_wtf16.wast @@ -45,17 +45,17 @@ ;; RTRIP-NEXT: ) ;; RRTRP: (func $codeunit (type $1) (result i32) ;; RRTRP-NEXT: (local $0 i32) - ;; RRTRP-NEXT: (local $scratch_3 (ref string)) ;; RRTRP-NEXT: (local $scratch (ref string)) + ;; RRTRP-NEXT: (local $scratch_2 (ref string)) ;; RRTRP-NEXT: (stringview_wtf16.get_codeunit ;; RRTRP-NEXT: (block (result (ref string)) - ;; RRTRP-NEXT: (local.set $scratch + ;; RRTRP-NEXT: (local.set $scratch_2 ;; RRTRP-NEXT: (string.const "abc") ;; RRTRP-NEXT: ) ;; RRTRP-NEXT: (local.set $0 ;; RRTRP-NEXT: (i32.const 0) ;; RRTRP-NEXT: ) - ;; RRTRP-NEXT: (local.get $scratch) + ;; RRTRP-NEXT: (local.get $scratch_2) ;; RRTRP-NEXT: ) ;; RRTRP-NEXT: (local.get $0) ;; RRTRP-NEXT: ) @@ -138,9 +138,9 @@ ;; RRTRP: (func $slice (type $0) (result stringref) ;; RRTRP-NEXT: (local $0 i32) ;; RRTRP-NEXT: (local $1 i32) - ;; RRTRP-NEXT: (local $scratch_6 i32) - ;; RRTRP-NEXT: (local $scratch_3 (ref string)) ;; RRTRP-NEXT: (local $scratch i32) + ;; RRTRP-NEXT: (local $scratch_3 (ref string)) + ;; RRTRP-NEXT: (local $scratch_4 i32) ;; RRTRP-NEXT: (local $scratch_5 (ref string)) ;; RRTRP-NEXT: (stringview_wtf16.slice ;; RRTRP-NEXT: (block (result (ref string)) @@ -149,13 +149,13 @@ ;; RRTRP-NEXT: ) ;; RRTRP-NEXT: (local.set $0 ;; RRTRP-NEXT: (block (result i32) - ;; RRTRP-NEXT: (local.set $scratch + ;; RRTRP-NEXT: (local.set $scratch_4 ;; RRTRP-NEXT: (i32.const 1) ;; RRTRP-NEXT: ) ;; RRTRP-NEXT: (local.set $1 ;; RRTRP-NEXT: (i32.const 2) ;; RRTRP-NEXT: ) - ;; RRTRP-NEXT: (local.get $scratch) + ;; RRTRP-NEXT: (local.get $scratch_4) ;; RRTRP-NEXT: ) ;; RRTRP-NEXT: ) ;; RRTRP-NEXT: (local.get $scratch_5) @@ -216,9 +216,9 @@ ;; RRTRP-NEXT: (local $start i32) ;; RRTRP-NEXT: (local $1 i32) ;; RRTRP-NEXT: (local $2 i32) - ;; RRTRP-NEXT: (local $scratch_7 i32) - ;; RRTRP-NEXT: (local $scratch_4 (ref string)) ;; RRTRP-NEXT: (local $scratch i32) + ;; RRTRP-NEXT: (local $scratch_4 (ref string)) + ;; RRTRP-NEXT: (local $scratch_5 i32) ;; RRTRP-NEXT: (local $scratch_6 (ref string)) ;; RRTRP-NEXT: (stringview_wtf16.slice ;; RRTRP-NEXT: (block (result (ref string)) @@ -227,13 +227,13 @@ ;; RRTRP-NEXT: ) ;; RRTRP-NEXT: (local.set $1 ;; RRTRP-NEXT: (block (result i32) - ;; RRTRP-NEXT: (local.set $scratch + ;; RRTRP-NEXT: (local.set $scratch_5 ;; RRTRP-NEXT: (local.get $start) ;; RRTRP-NEXT: ) ;; RRTRP-NEXT: (local.set $2 ;; RRTRP-NEXT: (i32.const 2) ;; RRTRP-NEXT: ) - ;; RRTRP-NEXT: (local.get $scratch) + ;; RRTRP-NEXT: (local.get $scratch_5) ;; RRTRP-NEXT: ) ;; RRTRP-NEXT: ) ;; RRTRP-NEXT: (local.get $scratch_6) @@ -292,9 +292,9 @@ ;; RRTRP-NEXT: (local $end i32) ;; RRTRP-NEXT: (local $1 i32) ;; RRTRP-NEXT: (local $2 i32) - ;; RRTRP-NEXT: (local $scratch_7 i32) - ;; RRTRP-NEXT: (local $scratch_4 (ref string)) ;; RRTRP-NEXT: (local $scratch i32) + ;; RRTRP-NEXT: (local $scratch_4 (ref string)) + ;; RRTRP-NEXT: (local $scratch_5 i32) ;; RRTRP-NEXT: (local $scratch_6 (ref string)) ;; RRTRP-NEXT: (stringview_wtf16.slice ;; RRTRP-NEXT: (block (result (ref string)) @@ -303,13 +303,13 @@ ;; RRTRP-NEXT: ) ;; RRTRP-NEXT: (local.set $1 ;; RRTRP-NEXT: (block (result i32) - ;; RRTRP-NEXT: (local.set $scratch + ;; RRTRP-NEXT: (local.set $scratch_5 ;; RRTRP-NEXT: (i32.const 1) ;; RRTRP-NEXT: ) ;; RRTRP-NEXT: (local.set $2 ;; RRTRP-NEXT: (local.get $end) ;; RRTRP-NEXT: ) - ;; RRTRP-NEXT: (local.get $scratch) + ;; RRTRP-NEXT: (local.get $scratch_5) ;; RRTRP-NEXT: ) ;; RRTRP-NEXT: ) ;; RRTRP-NEXT: (local.get $scratch_6) From e8b6b3738bcd12240ea375e8cc892f2e11d7b89d Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Thu, 14 Nov 2024 11:41:29 -0800 Subject: [PATCH 15/56] wip dwarf with logging --- src/wasm-ir-builder.h | 17 ++++++++++++++ src/wasm/wasm-binary.cpp | 4 ++++ src/wasm/wasm-ir-builder.cpp | 43 ++++++++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+) diff --git a/src/wasm-ir-builder.h b/src/wasm-ir-builder.h index 16e9d7319a9..2dbf915cd1a 100644 --- a/src/wasm-ir-builder.h +++ b/src/wasm-ir-builder.h @@ -64,6 +64,15 @@ class IRBuilder : public UnifiedExpressionVisitor> { // pushed instruction. void setDebugLocation(const std::optional&); + // Give the builder a pointer to the counter tracking the current location in + // the binary. If this pointer is non-null, the builder will record the binary + // locations relative to the given code section offset for all instructions + // and delimiters inside functions. + void setBinaryLocation(size_t* binaryPos, size_t codeSectionOffset) { + this->binaryPos = binaryPos; + this->codeSectionOffset = codeSectionOffset; + } + // Handle the boundaries of control flow structures. Users may choose to use // the corresponding `makeXYZ` function below instead of `visitXYZStart`, but // either way must call `visitEnd` and friends at the appropriate times. @@ -241,6 +250,11 @@ class IRBuilder : public UnifiedExpressionVisitor> { Function* func; Builder builder; + // Used for setting DWARF expression locations. + size_t* binaryPos = nullptr; + size_t lastBinaryPos = 0; + size_t codeSectionOffset = 0; + // The location lacks debug info as it was marked as not having it. struct NoDebug : public std::monostate {}; // The location lacks debug info, but was not marked as not having @@ -536,6 +550,9 @@ class IRBuilder : public UnifiedExpressionVisitor> { labelDepths[label].push_back(scopeStack.size() + 1); } scopeStack.push_back(scope); + if (binaryPos) { + lastBinaryPos = *binaryPos; + } } ScopeCtx& getScope() { diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index b077845ce0a..6806c931943 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -1825,6 +1825,7 @@ void WasmBinaryReader::read() { break; case BinaryConsts::Section::Code: if (DWARF) { + std::cerr << "code section at " << pos << '\n'; codeSectionLocation = pos; } readFunctions(); @@ -2774,6 +2775,9 @@ void WasmBinaryReader::readFunctions() { if (numFuncBodies + numFuncImports != wasm.functions.size()) { throwError("invalid function section size, must equal types"); } + if (DWARF) { + builder.setBinaryLocation(&pos, codeSectionLocation); + } for (size_t i = 0; i < numFuncBodies; i++) { auto sizePos = pos; size_t size = getU32LEB(); diff --git a/src/wasm/wasm-ir-builder.cpp b/src/wasm/wasm-ir-builder.cpp index 4cb9514f59e..5dd218b0a65 100644 --- a/src/wasm/wasm-ir-builder.cpp +++ b/src/wasm/wasm-ir-builder.cpp @@ -150,6 +150,15 @@ void IRBuilder::push(Expression* expr) { scope.exprStack.push_back(expr); applyDebugLoc(expr); + if (binaryPos && func) { + std::cerr << "recording expression " << ShallowExpression{expr} << " at [" + << (lastBinaryPos - codeSectionOffset) << ", " + << (*binaryPos - codeSectionOffset) << "]\n"; + func->expressionLocations[expr] = + BinaryLocations::Span{BinaryLocation(lastBinaryPos - codeSectionOffset), + BinaryLocation(*binaryPos - codeSectionOffset)}; + lastBinaryPos = *binaryPos; + } DBG(std::cerr << "After pushing " << ShallowExpression{expr} << ":\n"); DBG(dump()); @@ -699,6 +708,8 @@ Result<> IRBuilder::visitSwitchWithType(Switch* curr, Type type) { } Result<> IRBuilder::visitFunctionStart(Function* func) { + std::cerr << "visiting function start at " << (binaryPos ? *binaryPos : 666) + << "\n"; if (!scopeStack.empty()) { return Err{"unexpected start of function"}; } @@ -708,6 +719,11 @@ Result<> IRBuilder::visitFunctionStart(Function* func) { debugLoc = CanReceiveDebug(); scopeStack.push_back(ScopeCtx::makeFunc(func)); this->func = func; + + if (binaryPos) { + lastBinaryPos = *binaryPos; + } + return Ok{}; } @@ -840,6 +856,14 @@ Result<> IRBuilder::visitElse() { auto expr = finishScope(); CHECK_ERR(expr); iff->ifTrue = *expr; + + if (binaryPos && func) { + std::cerr << "recording delimiter for " << ShallowExpression{iff} << " at " + << (lastBinaryPos - codeSectionOffset) << '\n'; + func->delimiterLocations[iff][BinaryLocations::Else] = + lastBinaryPos - codeSectionOffset; + } + pushScope(ScopeCtx::makeElse(iff, originalLabel, label, labelUsed)); return Ok{}; } @@ -867,6 +891,14 @@ Result<> IRBuilder::visitCatch(Name tag) { tryy->catchBodies.push_back(*expr); } tryy->catchTags.push_back(tag); + + if (binaryPos && func) { + std::cerr << "recording delimiter for " << ShallowExpression{tryy} << " at " + << (lastBinaryPos - codeSectionOffset) << '\n'; + auto& delimiterLocs = func->delimiterLocations[tryy]; + delimiterLocs[delimiterLocs.size()] = lastBinaryPos - codeSectionOffset; + } + pushScope( ScopeCtx::makeCatch(tryy, originalLabel, label, labelUsed, branchLabel)); // Push a pop for the exception payload if necessary. @@ -877,6 +909,7 @@ Result<> IRBuilder::visitCatch(Name tag) { scopeStack[0].notePop(); push(builder.makePop(params)); } + return Ok{}; } @@ -902,6 +935,14 @@ Result<> IRBuilder::visitCatchAll() { } else { tryy->catchBodies.push_back(*expr); } + + if (binaryPos && func) { + std::cerr << "recording delimiter for " << ShallowExpression{tryy} << " at " + << (lastBinaryPos - codeSectionOffset) << '\n'; + auto& delimiterLocs = func->delimiterLocations[tryy]; + delimiterLocs[delimiterLocs.size()] = lastBinaryPos - codeSectionOffset; + } + pushScope( ScopeCtx::makeCatchAll(tryy, originalLabel, label, labelUsed, branchLabel)); return Ok{}; @@ -938,6 +979,7 @@ Result<> IRBuilder::visitDelegate(Index label) { } Result<> IRBuilder::visitEnd() { + std::cerr << "visiting end\n"; auto scope = getScope(); if (scope.isNone()) { return Err{"unexpected end"}; @@ -980,6 +1022,7 @@ Result<> IRBuilder::visitEnd() { if (scope.needsPopFixup()) { EHUtils::handleBlockNestedPops(func, wasm); } + this->func = nullptr; } else if (auto* block = scope.getBlock()) { assert(*expr == block); block->name = scope.label; From eb430fb7fb58d1663bb868ab41bcd880ee242c73 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Thu, 14 Nov 2024 11:49:47 -0800 Subject: [PATCH 16/56] restore warning about OOB function indices --- src/wasm/wasm-binary.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index 2b31e271577..f5bf11206f9 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -2735,6 +2735,15 @@ void WasmBinaryReader::readFunctionSignatures() { } usedNames.insert(name); } + // Also check that the function indices in the local names subsection are + // in-bounds, even though we don't use them here. + for (auto& [index, locals] : localNames) { + if (index >= num + numImports) { + std::cerr << "warning: function index out of bounds in name section: " + "locals at index " + << index << '\n'; + } + } for (size_t i = 0; i < num; i++) { auto [name, isExplicit] = getOrMakeName(functionNames, numImports + i, makeName("", i), usedNames); From 849c992764cac4acf6ef206703c4e46900f39c54 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Thu, 14 Nov 2024 12:37:23 -0800 Subject: [PATCH 17/56] Update lit test output heap-store-optimization.wast had a test without its accompanying generated output. --- test/lit/passes/heap-store-optimization.wast | 23 ++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/lit/passes/heap-store-optimization.wast b/test/lit/passes/heap-store-optimization.wast index 1c1abba4ae2..d317888be37 100644 --- a/test/lit/passes/heap-store-optimization.wast +++ b/test/lit/passes/heap-store-optimization.wast @@ -967,6 +967,29 @@ ) ) + ;; CHECK: (func $control-flow-in-set-value-safe-return (type $4) (result i32) + ;; CHECK-NEXT: (local $ref (ref null $struct)) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: (local.set $ref + ;; CHECK-NEXT: (struct.new $struct + ;; CHECK-NEXT: (if (result i32) + ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: (then + ;; CHECK-NEXT: (return + ;; CHECK-NEXT: (i32.const 42) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (else + ;; CHECK-NEXT: (i32.const 42) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (struct.get $struct 0 + ;; CHECK-NEXT: (local.get $ref) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) (func $control-flow-in-set-value-safe-return (result i32) ;; As above, but replace the call with a return in an if. We can still ;; optimize (if the return is taken, we go outside of the function anyhow). From 2aa3ca5018b296e725d66ced4bf207bc1f121792 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Thu, 14 Nov 2024 12:32:27 -0800 Subject: [PATCH 18/56] Record binary locations for nested blocks The binary reader has special handling for blocks immediately nested inside other blocks to eliminate recursion while parsing very deep stacks of blocks. This special handling did not record binary locations for the nested blocks, though. Add logic to record binary locations for nested blocks. This binary reading code is about to be replaced with completely different code that uses IRBuilder instead, but this change will eliminate some test differences that we would otherwise see when we make that change. --- src/wasm/wasm-binary.cpp | 20 ++++++++++++++++++++ test/passes/dwarf-local-order.bin.txt | 1 + test/passes/fannkuch0_dwarf.bin.txt | 5 +++++ test/passes/fannkuch3_dwarf.bin.txt | 7 +++++++ test/passes/fannkuch3_manyopts_dwarf.bin.txt | 4 ++++ test/passes/reverse_dwarf_abbrevs.bin.txt | 4 ++++ 6 files changed, 41 insertions(+) diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index f5bf11206f9..73718e636a8 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -4453,13 +4453,21 @@ void WasmBinaryReader::visitBlock(Block* curr) { // special-case Block and de-recurse nested blocks in their first position, as // that is a common pattern that can be very highly nested. std::vector stack; + // Track start positions for all blocks except for the outermost block, which + // is already handled in the caller. + std::vector startPosStack; + size_t startPos = -1; while (1) { curr->type = getType(); curr->name = getNextLabel(); breakStack.push_back({curr->name, curr->type}); stack.push_back(curr); + if (startPos != size_t(-1)) { + startPosStack.push_back(startPos); + } if (more() && input[pos] == BinaryConsts::Block) { // a recursion + startPos = pos; readNextDebugLocation(); curr = allocator.alloc(); startControlFlow(curr); @@ -4478,6 +4486,12 @@ void WasmBinaryReader::visitBlock(Block* curr) { while (stack.size() > 0) { curr = stack.back(); stack.pop_back(); + if (startPosStack.empty()) { + startPos = -1; + } else { + startPos = startPosStack.back(); + startPosStack.pop_back(); + } // everything after this, that is left when we see the marker, is ours size_t start = expressionStack.size(); if (last) { @@ -4497,6 +4511,12 @@ void WasmBinaryReader::visitBlock(Block* curr) { : Block::NoBreak); breakStack.pop_back(); breakTargetNames.erase(curr->name); + + if (DWARF && currFunction && startPos != size_t(-1)) { + currFunction->expressionLocations[curr] = + BinaryLocations::Span{BinaryLocation(startPos - codeSectionLocation), + BinaryLocation(pos - codeSectionLocation)}; + } } } diff --git a/test/passes/dwarf-local-order.bin.txt b/test/passes/dwarf-local-order.bin.txt index f6b827702ba..509db04b1d6 100644 --- a/test/passes/dwarf-local-order.bin.txt +++ b/test/passes/dwarf-local-order.bin.txt @@ -341,6 +341,7 @@ ) ;; code offset: 0xa9 (block $label$1 + ;; code offset: 0xab (block $label$2 ;; code offset: 0xaf (br_if $label$2 diff --git a/test/passes/fannkuch0_dwarf.bin.txt b/test/passes/fannkuch0_dwarf.bin.txt index e761baf7009..bee23dc186c 100644 --- a/test/passes/fannkuch0_dwarf.bin.txt +++ b/test/passes/fannkuch0_dwarf.bin.txt @@ -7740,6 +7740,7 @@ file_names[ 3]: ) ;; code offset: 0xa1f (block $label$17 + ;; code offset: 0xa21 (block $label$18 ;; code offset: 0xa27 (br_if $label$18 @@ -7927,6 +7928,7 @@ file_names[ 3]: ) ;; code offset: 0xaed (block $label$1 + ;; code offset: 0xaef (block $label$2 ;; code offset: 0xaf4 (br_if $label$2 @@ -8041,6 +8043,7 @@ file_names[ 3]: ) ;; code offset: 0xb4a (block $label$3 + ;; code offset: 0xb4c (block $label$4 ;; code offset: 0xb51 (br_if $label$4 @@ -8914,6 +8917,7 @@ file_names[ 3]: ) ;; code offset: 0xefd (block $label$7 + ;; code offset: 0xeff (block $label$8 ;; code offset: 0xf04 (br_if $label$8 @@ -9818,6 +9822,7 @@ file_names[ 3]: ) ;; code offset: 0x1207 (block $label$17 + ;; code offset: 0x1209 (block $label$18 ;; code offset: 0x120f (br_if $label$18 diff --git a/test/passes/fannkuch3_dwarf.bin.txt b/test/passes/fannkuch3_dwarf.bin.txt index f58068ec384..74b6446a5f3 100644 --- a/test/passes/fannkuch3_dwarf.bin.txt +++ b/test/passes/fannkuch3_dwarf.bin.txt @@ -4874,7 +4874,9 @@ file_names[ 4]: ) ;; code offset: 0x47 (block $label$1 + ;; code offset: 0x49 (block $label$2 + ;; code offset: 0x4b (block $label$3 ;; code offset: 0x52 (br_if $label$3 @@ -6022,7 +6024,9 @@ file_names[ 4]: ) ;; code offset: 0x3bd (block $label$1 + ;; code offset: 0x3bf (block $label$2 + ;; code offset: 0x3c1 (block $label$3 ;; code offset: 0x3c8 (br_if $label$3 @@ -6192,8 +6196,11 @@ file_names[ 4]: ) ;; code offset: 0x444 (block $label$6 + ;; code offset: 0x446 (block $label$7 + ;; code offset: 0x448 (block $label$8 + ;; code offset: 0x44a (block $label$9 ;; code offset: 0x451 (br_if $label$9 diff --git a/test/passes/fannkuch3_manyopts_dwarf.bin.txt b/test/passes/fannkuch3_manyopts_dwarf.bin.txt index fb6008541b2..3ffb81efeaf 100644 --- a/test/passes/fannkuch3_manyopts_dwarf.bin.txt +++ b/test/passes/fannkuch3_manyopts_dwarf.bin.txt @@ -4752,6 +4752,7 @@ file_names[ 4]: ) ;; code offset: 0x43 (block $label$1 + ;; code offset: 0x45 (block $label$2 ;; code offset: 0x4c (if @@ -5886,6 +5887,7 @@ file_names[ 4]: ) ;; code offset: 0x39b (block $label$1 + ;; code offset: 0x39d (block $label$2 ;; code offset: 0x3a4 (if @@ -6050,7 +6052,9 @@ file_names[ 4]: ) ;; code offset: 0x41a (block $label$6 + ;; code offset: 0x41c (block $label$7 + ;; code offset: 0x41e (block $label$8 ;; code offset: 0x425 (if diff --git a/test/passes/reverse_dwarf_abbrevs.bin.txt b/test/passes/reverse_dwarf_abbrevs.bin.txt index 2500b625b1b..5427acc6cf0 100644 --- a/test/passes/reverse_dwarf_abbrevs.bin.txt +++ b/test/passes/reverse_dwarf_abbrevs.bin.txt @@ -293,7 +293,9 @@ file_names[ 1]: (local.set $4 ;; code offset: 0x89 (block $label$1 (result i32) + ;; code offset: 0x8b (block $label$2 + ;; code offset: 0x8d (block $label$3 ;; code offset: 0xa5 (if @@ -1387,6 +1389,7 @@ file_names[ 1]: (block $label$1 ;; code offset: 0x43a (if + ;; code offset: 0x412 (block $label$2 (result i32) ;; code offset: 0x41c (if @@ -2102,6 +2105,7 @@ file_names[ 1]: ) ;; code offset: 0x65a (block $label$1 + ;; code offset: 0x65c (block $label$2 ;; code offset: 0x664 (br_if $label$2 From e1270a834156956f0dd4ede4d721f778bae02b0e Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Thu, 14 Nov 2024 15:55:09 -0800 Subject: [PATCH 19/56] wip --- src/passes/Outlining.cpp | 18 +- src/wasm-ir-builder.h | 10 +- src/wasm/wasm-binary.cpp | 7 +- src/wasm/wasm-ir-builder.cpp | 38 +- test/example/module-splitting.txt | 4 - test/lit/basic/complexTextNames.wast | 3 - test/lit/basic/duplicate_types.wast | 3 - test/lit/basic/exception-handling-legacy.wast | 45 - test/lit/basic/exception-handling.wast | 6 - test/lit/basic/multi-table.wast | 6 - test/lit/basic/pop-fixup.wast | 5 - test/lit/basic/print-explicit-typeuse.wast | 4 - test/lit/basic/reference-types.wast | 15 - test/lit/basic/shared-types.wast | 2 - test/lit/basic/types-function-references.wast | 12 - test/lit/if-then-else.wast | 2 - test/lit/merge/chain.wat | 1 - test/lit/merge/names.wat | 6 - test/lit/merge/renamings.wat | 4 - test/lit/merge/table64.wat | 1 - test/lit/non-nullable-locals.wast | 2 - test/lit/passes/abstract-type-refining.wast | 8 - .../passes/asyncify_enable-multivalue.wast | 2 - .../lit/passes/asyncify_optimize-level=1.wast | 1 - ...syncify_pass-arg=asyncify-addlist@foo.wast | 1 - ...foo_pass-arg=asyncify-ignore-indirect.wast | 1 - ...o_pass-arg=asyncify-propagate-addlist.wast | 1 - ...yncify-imports@env.import,env.import2.wast | 2 - .../lit/passes/coalesce-locals-eh-legacy.wast | 1 - test/lit/passes/code-folding-eh-legacy.wast | 2 - test/lit/passes/code-folding-eh.wast | 1 - test/lit/passes/code-pushing-eh-legacy.wast | 4 - test/lit/passes/code-pushing-eh.wast | 1 - test/lit/passes/dae-gc-refine-params.wast | 1 - test/lit/passes/dae-gc.wast | 3 - test/lit/passes/dae_all-features.wast | 8 +- test/lit/passes/dae_tnh.wast | 2 - test/lit/passes/dce-eh-legacy.wast | 4 - test/lit/passes/dce-eh.wast | 1 - test/lit/passes/denan.wast | 5 +- test/lit/passes/flatten-eh-legacy.wast | 1 - .../passes/flatten_i64-to-i32-lowering.wast | 2 - ...g_souperify-single-use_enable-threads.wast | 1 - ...ls-nonesting_souperify_enable-threads.wast | 2 - test/lit/passes/fpcast-emu.wast | 4 - test/lit/passes/global-refining.wast | 4 - test/lit/passes/gto-removals.wast | 8 - test/lit/passes/gufa-refs.wast | 5 - test/lit/passes/heap2local.wast | 1 - test/lit/passes/inlining-eh-legacy.wast | 11 +- test/lit/passes/inlining-gc.wast | 6 +- test/lit/passes/inlining_all-features.wast | 7 +- test/lit/passes/inlining_splitting.wast | 1 - .../passes/instrument-locals-eh-legacy.wast | 1 - test/lit/passes/j2cl-inline.wast | 4 +- test/lit/passes/j2cl-merge-itables.wast | 2 - test/lit/passes/j2cl.wast | 4 +- ...egalize-js-interface-exported-helpers.wast | 1 - test/lit/passes/local-cse_all-features.wast | 1 - test/lit/passes/monomorphize-context.wast | 25 +- test/lit/passes/monomorphize-limits.wast | 8 +- test/lit/passes/name-types.wast | 1 - test/lit/passes/once-reduction.wast | 3 - test/lit/passes/optimize-casts-noeh.wast | 1 - test/lit/passes/optimize-casts.wast | 1 - ...imize-instructions-call_ref-roundtrip.wast | 3 - .../optimize-instructions-call_ref.wast | 1 - .../optimize-instructions-eh-legacy.wast | 3 - .../passes/optimize-instructions-gc-iit.wast | 2 - test/lit/passes/optimize-instructions-gc.wast | 1 - .../optimize-instructions-iit-eh-legacy.wast | 1 - .../lit/passes/optimize-instructions-mvp.wast | 1 - test/lit/passes/remove-unused-brs-eh.wast | 2 - test/lit/passes/remove-unused-brs.wast | 1 - .../remove-unused-brs_all-features.wast | 1 - .../remove-unused-module-elements-refs.wast | 52 - ...e-unused-module-elements_all-features.wast | 4 - .../remove-unused-module-elements_tnh.wast | 6 - .../passes/remove-unused-names-eh-legacy.wast | 1 - test/lit/passes/roundtrip-gc.wast | 2 - test/lit/passes/rse-eh-legacy.wast | 12 - test/lit/passes/rse-eh.wast | 2 - test/lit/passes/rse-gc.wast | 1 - test/lit/passes/signature-pruning.wast | 16 - test/lit/passes/signature-refining.wast | 18 - .../lit/passes/simplify-locals-eh-legacy.wast | 3 - test/lit/passes/simplify-locals-gc.wast | 3 - test/lit/passes/simplify-locals-global.wast | 1 - test/lit/passes/ssa.wast | 1 - .../passes/stack-ir-roundtrip-eh-legacy.wast | 2 - test/lit/passes/string-lowering_types.wast | 1 - test/lit/passes/translate-to-exnref.wast | 15 +- test/lit/passes/type-finalizing.wast | 2 - test/lit/passes/type-generalizing.wast | 1 - test/lit/passes/type-merging-shared.wast | 3 - test/lit/passes/type-merging.wast | 17 - test/lit/passes/type-refining.wast | 1 - test/lit/string.as_wtf16.wast | 3 - test/lit/validation/nn-tuples.wast | 1 - test/lit/wasm-split/passive.wast | 2 - test/lit/wasm-split/ref.func.wast | 2 - test/lit/wat-kitchen-sink.wast | 46 - test/lld/basic_safe_stack.wat.out | 2 - test/lld/duplicate_imports.wat.out | 1 - test/lld/em_asm.wat.out | 1 - test/lld/em_asm64.wat.out | 1 - test/lld/em_asm_O0.wat.out | 1 - test/lld/em_asm_main_thread.wat.out | 1 - test/lld/em_asm_pthread.wasm.out | 4 - test/lld/em_asm_shared.wat.out | 2 - test/lld/hello_world.wat.out | 1 - test/lld/longjmp.wat.out | 1 - test/lld/main_module_table.wat.out | 1 - test/lld/main_module_table_2.wat.out | 1 - test/lld/main_module_table_3.wat.out | 1 - test/lld/main_module_table_4.wat.out | 1 - test/lld/main_module_table_5.wat.out | 3 - test/lld/recursive.wat.out | 1 - test/lld/recursive_safe_stack.wat.out | 1 - test/lld/reserved_func_ptr.wat.out | 3 - test/lld/safe_stack_standalone-wasm.wat.out | 1 - test/lld/shared.wat.out | 1 - test/lld/shared_add_to_table.wasm.out | 1 - test/lld/shared_longjmp.wat.out | 2 - test/metadce/name_collision.wast.dced | 1 - test/metadce/outside.wast.dced | 1 - test/metadce/tag.wast.dced | 1 - ...cate-function-elimination_all-features.txt | 1 - test/passes/dwarf-local-order.bin.txt | 32 +- test/passes/dwarf_with_exceptions.bin.txt | 85 +- test/passes/fannkuch0_dwarf.bin.txt | 200 ++-- test/passes/fannkuch3_dwarf.bin.txt | 232 ++--- test/passes/fannkuch3_manyopts_dwarf.bin.txt | 194 ++-- test/passes/fib2_dwarf.bin.txt | 8 +- test/passes/fib2_emptylocspan_dwarf.bin.txt | 8 +- test/passes/fib_nonzero-low-pc_dwarf.bin.txt | 8 +- test/passes/func-metrics.txt | 5 +- test/passes/licm.txt | 1 - ...inify-imports-and-exports_all-features.txt | 2 - test/passes/minify-imports_all-features.txt | 2 - test/passes/post-emscripten.txt | 3 - test/passes/print-function-map.txt | 2 - test/passes/print_g.bin.txt | 8 +- test/passes/print_g_strip-dwarf.bin.txt | 8 +- .../remove-unused-brs_enable-multivalue.txt | 1 - ...unused-names_merge-blocks_all-features.txt | 1 - ...nfunction-module-elements_all-features.txt | 3 - test/passes/reverse_dwarf_abbrevs.bin.txt | 921 +++++++++--------- test/passes/spill-pointers.txt | 2 - test/reduce/memory_table.wast.txt | 1 - test/try-delegate.wasm.fromBinary | 5 - 151 files changed, 963 insertions(+), 1387 deletions(-) diff --git a/src/passes/Outlining.cpp b/src/passes/Outlining.cpp index 68c3d039707..429511557e1 100644 --- a/src/passes/Outlining.cpp +++ b/src/passes/Outlining.cpp @@ -42,8 +42,8 @@ namespace wasm { struct ReconstructStringifyWalker : public StringifyWalker { - ReconstructStringifyWalker(Module* wasm) - : existingBuilder(*wasm), outlinedBuilder(*wasm) { + ReconstructStringifyWalker(Module* wasm, Function* func) + : existingBuilder(*wasm), outlinedBuilder(*wasm), func(func) { this->setModule(wasm); DBG(std::cerr << "\nexistingBuilder: " << &existingBuilder << " outlinedBuilder: " << &outlinedBuilder << "\n"); @@ -77,6 +77,9 @@ struct ReconstructStringifyWalker // contain repeat sequences found in the program. IRBuilder outlinedBuilder; + // The function we are outlining from. + Function* func; + void addUniqueSymbol(SeparatorReason reason) { if (auto curr = reason.getFuncStart()) { startExistingFunction(curr->func); @@ -108,6 +111,8 @@ struct ReconstructStringifyWalker DBG(desc = "Loop Start at "); } else if (reason.getEnd()) { ASSERT_OK(existingBuilder.visitEnd()); + // Reset the function in case we just ended the function scope. + existingBuilder.setFunction(func); // Outlining performs an unnested walk of the Wasm module, visiting // each scope one at a time. IRBuilder, in contrast, expects to // visit several nested scopes at a time. Thus, calling end() finalizes @@ -346,15 +351,16 @@ struct Outlining : public Pass { void outline(Module* module, Sequences seqByFunc) { // TODO: Make this a function-parallel sub-pass. - ReconstructStringifyWalker reconstruct(module); std::vector keys(seqByFunc.size()); std::transform(seqByFunc.begin(), seqByFunc.end(), keys.begin(), [](auto pair) { return pair.first; }); - for (auto func : keys) { - reconstruct.sequences = std::move(seqByFunc[func]); - reconstruct.doWalkFunction(module->getFunction(func)); + for (auto funcName : keys) { + auto* func = module->getFunction(funcName); + ReconstructStringifyWalker reconstruct(module, func); + reconstruct.sequences = std::move(seqByFunc[funcName]); + reconstruct.doWalkFunction(func); } } diff --git a/src/wasm-ir-builder.h b/src/wasm-ir-builder.h index 2dbf915cd1a..3db97cc1513 100644 --- a/src/wasm-ir-builder.h +++ b/src/wasm-ir-builder.h @@ -73,6 +73,10 @@ class IRBuilder : public UnifiedExpressionVisitor> { this->codeSectionOffset = codeSectionOffset; } + // Set the function used to add scratch locals when constructing an isolated + // sequence of IR. + void setFunction(Function* func) { this->func = func; } + // Handle the boundaries of control flow structures. Users may choose to use // the corresponding `makeXYZ` function below instead of `visitXYZStart`, but // either way must call `visitEnd` and friends at the appropriate times. @@ -339,6 +343,9 @@ class IRBuilder : public UnifiedExpressionVisitor> { // stack-polymorphic unreachable mode. bool unreachable = false; + // The binary location of the start of the scope, used to set debug info. + size_t startPos = 0; + ScopeCtx() : scope(NoScope{}) {} ScopeCtx(Scope scope) : scope(scope) {} ScopeCtx(Scope scope, Name label, bool labelUsed) @@ -549,10 +556,11 @@ class IRBuilder : public UnifiedExpressionVisitor> { // Record the original label to handle references to it correctly. labelDepths[label].push_back(scopeStack.size() + 1); } - scopeStack.push_back(scope); if (binaryPos) { + scope.startPos = lastBinaryPos; lastBinaryPos = *binaryPos; } + scopeStack.push_back(scope); } ScopeCtx& getScope() { diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index e677c0a4598..3ffd7e456c4 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -1825,7 +1825,7 @@ void WasmBinaryReader::read() { break; case BinaryConsts::Section::Code: if (DWARF) { - std::cerr << "code section at " << pos << '\n'; + // std::cerr << "code section at " << pos << '\n'; codeSectionLocation = pos; } readFunctions(); @@ -2799,6 +2799,11 @@ void WasmBinaryReader::readFunctions() { currFunction = func.get(); if (DWARF) { + // std::cerr << "function location " << + // (sizePos - codeSectionLocation) << ", " << + // (pos - codeSectionLocation) << ", " << + // (pos - codeSectionLocation + size) << "\n"; + func->funcLocation = BinaryLocations::FunctionLocations{ BinaryLocation(sizePos - codeSectionLocation), BinaryLocation(pos - codeSectionLocation), diff --git a/src/wasm/wasm-ir-builder.cpp b/src/wasm/wasm-ir-builder.cpp index 5dd218b0a65..a66d872a19b 100644 --- a/src/wasm/wasm-ir-builder.cpp +++ b/src/wasm/wasm-ir-builder.cpp @@ -150,10 +150,11 @@ void IRBuilder::push(Expression* expr) { scope.exprStack.push_back(expr); applyDebugLoc(expr); - if (binaryPos && func) { - std::cerr << "recording expression " << ShallowExpression{expr} << " at [" - << (lastBinaryPos - codeSectionOffset) << ", " - << (*binaryPos - codeSectionOffset) << "]\n"; + if (binaryPos && func && lastBinaryPos != *binaryPos) { + // std::cerr << "recording expression " << ShallowExpression{expr} << " at + // [" + // << (lastBinaryPos - codeSectionOffset) << ", " + // << (*binaryPos - codeSectionOffset) << "]\n"; func->expressionLocations[expr] = BinaryLocations::Span{BinaryLocation(lastBinaryPos - codeSectionOffset), BinaryLocation(*binaryPos - codeSectionOffset)}; @@ -708,8 +709,9 @@ Result<> IRBuilder::visitSwitchWithType(Switch* curr, Type type) { } Result<> IRBuilder::visitFunctionStart(Function* func) { - std::cerr << "visiting function start at " << (binaryPos ? *binaryPos : 666) - << "\n"; + // std::cerr << "visiting function start at " << (binaryPos ? *binaryPos : + // 666) + // << "\n"; if (!scopeStack.empty()) { return Err{"unexpected start of function"}; } @@ -813,7 +815,8 @@ Result IRBuilder::finishScope(Block* block) { block->list.clear(); ret = block; } else { - ret = builder.makeNop(); + // ret = builder.makeNop(); + ret = builder.makeBlock(); } } else if (scope.exprStack.size() == 1) { // We can put our single expression directly into the surrounding scope. @@ -858,8 +861,9 @@ Result<> IRBuilder::visitElse() { iff->ifTrue = *expr; if (binaryPos && func) { - std::cerr << "recording delimiter for " << ShallowExpression{iff} << " at " - << (lastBinaryPos - codeSectionOffset) << '\n'; + // std::cerr << "recording delimiter for " << ShallowExpression{iff} << " at + // " + // << (lastBinaryPos - codeSectionOffset) << '\n'; func->delimiterLocations[iff][BinaryLocations::Else] = lastBinaryPos - codeSectionOffset; } @@ -893,8 +897,9 @@ Result<> IRBuilder::visitCatch(Name tag) { tryy->catchTags.push_back(tag); if (binaryPos && func) { - std::cerr << "recording delimiter for " << ShallowExpression{tryy} << " at " - << (lastBinaryPos - codeSectionOffset) << '\n'; + // std::cerr << "recording delimiter for " << ShallowExpression{tryy} << " + // at " + // << (lastBinaryPos - codeSectionOffset) << '\n'; auto& delimiterLocs = func->delimiterLocations[tryy]; delimiterLocs[delimiterLocs.size()] = lastBinaryPos - codeSectionOffset; } @@ -937,8 +942,9 @@ Result<> IRBuilder::visitCatchAll() { } if (binaryPos && func) { - std::cerr << "recording delimiter for " << ShallowExpression{tryy} << " at " - << (lastBinaryPos - codeSectionOffset) << '\n'; + // std::cerr << "recording delimiter for " << ShallowExpression{tryy} << " + // at " + // << (lastBinaryPos - codeSectionOffset) << '\n'; auto& delimiterLocs = func->delimiterLocations[tryy]; delimiterLocs[delimiterLocs.size()] = lastBinaryPos - codeSectionOffset; } @@ -979,7 +985,7 @@ Result<> IRBuilder::visitDelegate(Index label) { } Result<> IRBuilder::visitEnd() { - std::cerr << "visiting end\n"; + // std::cerr << "visiting end\n"; auto scope = getScope(); if (scope.isNone()) { return Err{"unexpected end"}; @@ -1016,6 +1022,10 @@ Result<> IRBuilder::visitEnd() { return builder.makeBlock(label, {curr}, blockType); }; + // The binary position we record for the block instruction should start at the + // beginning of the block, not at the beginning of the `end`. + lastBinaryPos = scope.startPos; + if (auto* func = scope.getFunction()) { func->body = maybeWrapForLabel(*expr); labelDepths.clear(); diff --git a/test/example/module-splitting.txt b/test/example/module-splitting.txt index fe878d739ab..709ebd4d755 100644 --- a/test/example/module-splitting.txt +++ b/test/example/module-splitting.txt @@ -585,7 +585,6 @@ Before: (elem $0 (global.get $base) $null $foo) (export "foo" (func $foo)) (func $null (type $0) - (nop) ) (func $foo (type $1) (param $0 i32) (result i32) (local.get $0) @@ -607,7 +606,6 @@ After: (export "%table_2" (table $0)) (export "%global" (global $base)) (func $null (type $0) - (nop) ) (func $foo (type $1) (param $0 i32) (result i32) (call_indirect $0 (type $1) @@ -1144,7 +1142,6 @@ Before: (export "foo1" (func $foo)) (export "foo2" (func $foo)) (func $foo (type $0) - (nop) ) ) Keeping: @@ -1169,7 +1166,6 @@ Secondary: (import "primary" "%table" (table $0 1 funcref)) (elem $0 (i32.const 0) $foo) (func $foo (type $0) - (nop) ) ) diff --git a/test/lit/basic/complexTextNames.wast b/test/lit/basic/complexTextNames.wast index 88240e038d8..16c19aadf9a 100644 --- a/test/lit/basic/complexTextNames.wast +++ b/test/lit/basic/complexTextNames.wast @@ -13,12 +13,10 @@ ;; CHECK-TEXT: (type $0 (func)) ;; CHECK-TEXT: (func $foo\20\28.bar\29 (type $0) - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (type $0 (func)) ;; CHECK-BIN: (func $foo\20\28.bar\29 (type $0) - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) (func $foo\20\28.bar\29) @@ -34,7 +32,6 @@ ;; CHECK-BIN-NODEBUG: (type $0 (func)) ;; CHECK-BIN-NODEBUG: (func $0 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $1 (type $0) diff --git a/test/lit/basic/duplicate_types.wast b/test/lit/basic/duplicate_types.wast index 244d97bc9fe..1c1462b3704 100644 --- a/test/lit/basic/duplicate_types.wast +++ b/test/lit/basic/duplicate_types.wast @@ -25,12 +25,10 @@ ;; CHECK-TEXT: (type $1 (func (param i32) (result i32))) ;; CHECK-TEXT: (func $f0 (type $0) (param $0 i32) - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (type $1 (func (param i32) (result i32))) ;; CHECK-BIN: (func $f0 (type $0) (param $0 i32) - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) (func $f0 (param i32)) @@ -47,7 +45,6 @@ ;; CHECK-BIN-NODEBUG: (type $1 (func (param i32) (result i32))) ;; CHECK-BIN-NODEBUG: (func $0 (type $0) (param $0 i32) -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $1 (type $1) (param $0 i32) (result i32) diff --git a/test/lit/basic/exception-handling-legacy.wast b/test/lit/basic/exception-handling-legacy.wast index da32fdf49d6..ca4f9e31f75 100644 --- a/test/lit/basic/exception-handling-legacy.wast +++ b/test/lit/basic/exception-handling-legacy.wast @@ -47,18 +47,14 @@ (tag $e-empty) ;; CHECK-TEXT: (func $foo (type $0) - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $foo (type $0) - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) (func $foo) ;; CHECK-TEXT: (func $bar (type $0) - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $bar (type $0) - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) (func $bar) @@ -229,7 +225,6 @@ ;; CHECK-TEXT: (func $empty-try-body (type $0) ;; CHECK-TEXT-NEXT: (try ;; CHECK-TEXT-NEXT: (do - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (catch $e-i32 ;; CHECK-TEXT-NEXT: (drop @@ -241,7 +236,6 @@ ;; CHECK-BIN: (func $empty-try-body (type $0) ;; CHECK-BIN-NEXT: (try ;; CHECK-BIN-NEXT: (do - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (catch $e-i32 ;; CHECK-BIN-NEXT: (drop @@ -363,7 +357,6 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (catch_all - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) @@ -375,7 +368,6 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (catch_all - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -467,7 +459,6 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (catch_all - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) @@ -489,7 +480,6 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (catch_all - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) @@ -510,7 +500,6 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (catch_all - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -532,7 +521,6 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (catch_all - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -612,7 +600,6 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (catch_all - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) @@ -633,7 +620,6 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (catch_all - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -679,7 +665,6 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (catch_all - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) @@ -706,7 +691,6 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (catch_all - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -781,20 +765,16 @@ ;; CHECK-TEXT: (func $empty-catch-body (type $0) ;; CHECK-TEXT-NEXT: (try ;; CHECK-TEXT-NEXT: (do - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (catch $e-empty - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $empty-catch-body (type $0) ;; CHECK-BIN-NEXT: (try ;; CHECK-BIN-NEXT: (do - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (catch $e-empty - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -1070,7 +1050,6 @@ ;; CHECK-TEXT-NEXT: (rethrow $l0) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (catch_all - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) @@ -1085,7 +1064,6 @@ ;; CHECK-TEXT-NEXT: (rethrow $l00) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (catch_all - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) @@ -1102,7 +1080,6 @@ ;; CHECK-BIN-NEXT: (rethrow $label) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (catch_all - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -1117,7 +1094,6 @@ ;; CHECK-BIN-NEXT: (rethrow $label0) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (catch_all - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -1156,7 +1132,6 @@ ;; CHECK-TEXT: (func $pop-within-if-condition (type $0) ;; CHECK-TEXT-NEXT: (try ;; CHECK-TEXT-NEXT: (do - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (catch $e-i32 ;; CHECK-TEXT-NEXT: (throw $e-i32 @@ -1176,7 +1151,6 @@ ;; CHECK-BIN: (func $pop-within-if-condition (type $0) ;; CHECK-BIN-NEXT: (try ;; CHECK-BIN-NEXT: (do - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (catch $e-i32 ;; CHECK-BIN-NEXT: (throw $e-i32 @@ -1216,7 +1190,6 @@ ;; CHECK-TEXT: (func $pop-can-be-supertype (type $0) ;; CHECK-TEXT-NEXT: (try ;; CHECK-TEXT-NEXT: (do - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (catch $e-eqref ;; CHECK-TEXT-NEXT: (drop @@ -1228,7 +1201,6 @@ ;; CHECK-BIN: (func $pop-can-be-supertype (type $0) ;; CHECK-BIN-NEXT: (try ;; CHECK-BIN-NEXT: (do - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (catch $e-eqref ;; CHECK-BIN-NEXT: (drop @@ -1299,7 +1271,6 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (try ;; CHECK-TEXT-NEXT: (do - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (delegate 1) ;; CHECK-TEXT-NEXT: ) @@ -1312,7 +1283,6 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (try ;; CHECK-BIN-NEXT: (do - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (delegate 1) ;; CHECK-BIN-NEXT: ) @@ -1353,11 +1323,9 @@ ;; CHECK-BIN-NODEBUG: (tag $tag$4) ;; CHECK-BIN-NODEBUG: (func $0 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $1 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $2 (type $0) @@ -1438,7 +1406,6 @@ ;; CHECK-BIN-NODEBUG: (func $5 (type $0) ;; CHECK-BIN-NODEBUG-NEXT: (try ;; CHECK-BIN-NODEBUG-NEXT: (do -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (catch $tag$0 ;; CHECK-BIN-NODEBUG-NEXT: (drop @@ -1492,7 +1459,6 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (catch_all -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -1536,7 +1502,6 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (catch_all -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -1558,7 +1523,6 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (catch_all -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -1593,7 +1557,6 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (catch_all -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -1620,7 +1583,6 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (catch_all -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -1643,10 +1605,8 @@ ;; CHECK-BIN-NODEBUG: (func $15 (type $0) ;; CHECK-BIN-NODEBUG-NEXT: (try ;; CHECK-BIN-NODEBUG-NEXT: (do -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (catch $tag$4 -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -1749,7 +1709,6 @@ ;; CHECK-BIN-NODEBUG-NEXT: (rethrow $label) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (catch_all -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -1764,7 +1723,6 @@ ;; CHECK-BIN-NODEBUG-NEXT: (rethrow $label0) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (catch_all -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -1774,7 +1732,6 @@ ;; CHECK-BIN-NODEBUG: (func $21 (type $0) ;; CHECK-BIN-NODEBUG-NEXT: (try ;; CHECK-BIN-NODEBUG-NEXT: (do -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (catch $tag$0 ;; CHECK-BIN-NODEBUG-NEXT: (throw $tag$0 @@ -1795,7 +1752,6 @@ ;; CHECK-BIN-NODEBUG: (func $22 (type $0) ;; CHECK-BIN-NODEBUG-NEXT: (try ;; CHECK-BIN-NODEBUG-NEXT: (do -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (catch $tag$3 ;; CHECK-BIN-NODEBUG-NEXT: (drop @@ -1828,7 +1784,6 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (try ;; CHECK-BIN-NODEBUG-NEXT: (do -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (delegate 1) ;; CHECK-BIN-NODEBUG-NEXT: ) diff --git a/test/lit/basic/exception-handling.wast b/test/lit/basic/exception-handling.wast index 1aa95c98bfb..ddea0a9135f 100644 --- a/test/lit/basic/exception-handling.wast +++ b/test/lit/basic/exception-handling.wast @@ -67,10 +67,8 @@ (tag $e-empty) ;; CHECK-TEXT: (func $foo (type $0) - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $foo (type $0) - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) (func $foo) @@ -138,7 +136,6 @@ ;; CHECK-TEXT: (func $catchless-try-table (type $0) ;; CHECK-TEXT-NEXT: (try_table - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (try_table ;; CHECK-TEXT-NEXT: (throw $e-empty) @@ -146,7 +143,6 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $catchless-try-table (type $0) ;; CHECK-BIN-NEXT: (try_table - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (try_table ;; CHECK-BIN-NEXT: (throw $e-empty) @@ -755,7 +751,6 @@ ;; CHECK-BIN-NODEBUG: (tag $tag$4) ;; CHECK-BIN-NODEBUG: (func $0 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $1 (type $3) (result exnref) @@ -782,7 +777,6 @@ ;; CHECK-BIN-NODEBUG: (func $2 (type $0) ;; CHECK-BIN-NODEBUG-NEXT: (try_table -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (try_table ;; CHECK-BIN-NODEBUG-NEXT: (throw $tag$4) diff --git a/test/lit/basic/multi-table.wast b/test/lit/basic/multi-table.wast index 71dd275aa72..2d6b436a62d 100644 --- a/test/lit/basic/multi-table.wast +++ b/test/lit/basic/multi-table.wast @@ -97,18 +97,14 @@ (func $f (drop (ref.func $h))) ;; CHECK-TEXT: (func $g (type $none_=>_none) - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $g (type $none_=>_none) - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) (func $g) ;; CHECK-TEXT: (func $h (type $none_=>_none) - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $h (type $none_=>_none) - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) (func $h) ) @@ -155,9 +151,7 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $1 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $2 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) diff --git a/test/lit/basic/pop-fixup.wast b/test/lit/basic/pop-fixup.wast index 371365a0cc9..9ef51dad82d 100644 --- a/test/lit/basic/pop-fixup.wast +++ b/test/lit/basic/pop-fixup.wast @@ -12,7 +12,6 @@ ;; CHECK-NEXT: (local $1 i32) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $e ;; CHECK-NEXT: (local.set $1 @@ -43,7 +42,6 @@ ;; CHECK-NEXT: (local $1 i32) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $e ;; CHECK-NEXT: (local.set $1 @@ -78,7 +76,6 @@ ;; CHECK-NEXT: (local $2 (tuple i32 i32)) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $e2 ;; CHECK-NEXT: (local.set $2 @@ -118,7 +115,6 @@ ;; CHECK-NEXT: (local $2 (tuple i32 i32)) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $e2 ;; CHECK-NEXT: (local.set $2 @@ -164,7 +160,6 @@ ;; CHECK-NEXT: (local $3 (tuple i32 i32)) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $e2 ;; CHECK-NEXT: (local.set $3 diff --git a/test/lit/basic/print-explicit-typeuse.wast b/test/lit/basic/print-explicit-typeuse.wast index d299a3eb430..367159f373d 100644 --- a/test/lit/basic/print-explicit-typeuse.wast +++ b/test/lit/basic/print-explicit-typeuse.wast @@ -33,19 +33,15 @@ (import "" "" (func $rec-import (type $rec))) ;; CHECK: (func $mvp - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $mvp (type $mvp)) ;; CHECK: (func $open (type $open) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $open (type $open)) ;; CHECK: (func $shared (type $shared) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $shared (type $shared)) ;; CHECK: (func $rec (type $rec) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $rec (type $rec)) ) diff --git a/test/lit/basic/reference-types.wast b/test/lit/basic/reference-types.wast index 00793e32e8e..d32662fb325 100644 --- a/test/lit/basic/reference-types.wast +++ b/test/lit/basic/reference-types.wast @@ -80,7 +80,6 @@ ;; CHECK-TEXT: (export "export_global" (global $import_global)) ;; CHECK-TEXT: (func $take_eqref (type $sig_eqref) (param $0 eqref) - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (global $global_eqref (mut eqref) (ref.null none)) @@ -105,31 +104,24 @@ ;; CHECK-BIN: (export "export_global" (global $import_global)) ;; CHECK-BIN: (func $take_eqref (type $sig_eqref) (param $0 eqref) - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) (func $take_eqref (param eqref)) ;; CHECK-TEXT: (func $take_funcref (type $sig_funcref) (param $0 funcref) - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $take_funcref (type $sig_funcref) (param $0 funcref) - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) (func $take_funcref (param funcref)) ;; CHECK-TEXT: (func $take_anyref (type $sig_anyref) (param $0 anyref) - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $take_anyref (type $sig_anyref) (param $0 anyref) - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) (func $take_anyref (param anyref)) ;; CHECK-TEXT: (func $foo (type $5) - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $foo (type $3) - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) (func $foo) @@ -2092,10 +2084,8 @@ ) ;; CHECK-TEXT: (func $ref-taken-but-not-in-table (type $5) - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $ref-taken-but-not-in-table (type $3) - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) (func $ref-taken-but-not-in-table) ) @@ -2106,19 +2096,15 @@ ;; CHECK-BIN-NODEBUG: (export "export_global" (global $gimport$0)) ;; CHECK-BIN-NODEBUG: (func $0 (type $5) (param $0 eqref) -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $1 (type $2) (param $0 funcref) -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $2 (type $1) (param $0 anyref) -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $3 (type $3) -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $4 (type $3) @@ -2817,5 +2803,4 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $23 (type $3) -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) diff --git a/test/lit/basic/shared-types.wast b/test/lit/basic/shared-types.wast index 25e593fd2a7..bcf9f6c54c4 100644 --- a/test/lit/basic/shared-types.wast +++ b/test/lit/basic/shared-types.wast @@ -30,7 +30,6 @@ ;; CHECK-NEXT: (local $3 (ref $bot)) ;; CHECK-NEXT: (local $4 (ref $func)) ;; CHECK-NEXT: (local $5 (ref $array)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $use-types (local (ref $final)) @@ -55,7 +54,6 @@ ;; CHECK-NEXT: (local $10 (ref (shared noextern))) ;; CHECK-NEXT: (local $11 (ref (shared nofunc))) ;; CHECK-NEXT: (local $12 (ref (shared noexn))) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $use-basic-types (local (ref (shared extern))) diff --git a/test/lit/basic/types-function-references.wast b/test/lit/basic/types-function-references.wast index e4c621c3035..8997e1a3af0 100644 --- a/test/lit/basic/types-function-references.wast +++ b/test/lit/basic/types-function-references.wast @@ -174,13 +174,11 @@ ;; CHECK-TEXT: (func $type-only-in-tuple-local (type $void) ;; CHECK-TEXT-NEXT: (local $x (tuple i32 (ref null $=>anyref) f64)) - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $type-only-in-tuple-local (type $void) ;; CHECK-BIN-NEXT: (local $x i32) ;; CHECK-BIN-NEXT: (local $1 f64) ;; CHECK-BIN-NEXT: (local $2 (ref null $=>anyref)) - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) (func $type-only-in-tuple-local (local $x (tuple i32 (ref null $=>anyref) f64)) @@ -245,7 +243,6 @@ ;; CHECK-TEXT-NEXT: (local $i3 i64) ;; CHECK-TEXT-NEXT: (local $r5 anyref) ;; CHECK-TEXT-NEXT: (local $r6 funcref) - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $ref-types-first (type $void) ;; CHECK-BIN-NEXT: (local $r1 (ref null $mixed_results)) @@ -257,7 +254,6 @@ ;; CHECK-BIN-NEXT: (local $i1 i32) ;; CHECK-BIN-NEXT: (local $i2 i64) ;; CHECK-BIN-NEXT: (local $i3 i64) - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) (func $ref-types-first ;; 6 reference types and 3 MVP types. The binary format should emit all the @@ -285,7 +281,6 @@ ;; CHECK-TEXT-NEXT: (local $i3 i64) ;; CHECK-TEXT-NEXT: (local $r5 anyref) ;; CHECK-TEXT-NEXT: (local $r6 funcref) - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $mvp-types-first (type $void) ;; CHECK-BIN-NEXT: (local $i1 i32) @@ -297,7 +292,6 @@ ;; CHECK-BIN-NEXT: (local $r4 anyref) ;; CHECK-BIN-NEXT: (local $r5 anyref) ;; CHECK-BIN-NEXT: (local $r6 funcref) - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) (func $mvp-types-first ;; Reversed from before, now an MVP type appears first, so they should all @@ -323,7 +317,6 @@ ;; CHECK-TEXT-NEXT: (local $i3 i64) ;; CHECK-TEXT-NEXT: (local $r5 anyref) ;; CHECK-TEXT-NEXT: (local $r6 funcref) - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $mvp-types-first-param (type $10) (param $r0 (ref null $mixed_results)) ;; CHECK-BIN-NEXT: (local $i1 i32) @@ -335,7 +328,6 @@ ;; CHECK-BIN-NEXT: (local $r4 anyref) ;; CHECK-BIN-NEXT: (local $r5 anyref) ;; CHECK-BIN-NEXT: (local $r6 funcref) - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) (func $mvp-types-first-param (param $r0 (ref null $mixed_results)) ;; As before, but now there is a reference type *parameter*. We should @@ -427,7 +419,6 @@ ;; CHECK-BIN-NODEBUG-NEXT: (local $0 i32) ;; CHECK-BIN-NODEBUG-NEXT: (local $1 f64) ;; CHECK-BIN-NODEBUG-NEXT: (local $2 (ref null $9)) -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $8 (type $2) @@ -475,7 +466,6 @@ ;; CHECK-BIN-NODEBUG-NEXT: (local $6 i32) ;; CHECK-BIN-NODEBUG-NEXT: (local $7 i64) ;; CHECK-BIN-NODEBUG-NEXT: (local $8 i64) -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $10 (type $2) @@ -488,7 +478,6 @@ ;; CHECK-BIN-NODEBUG-NEXT: (local $6 anyref) ;; CHECK-BIN-NODEBUG-NEXT: (local $7 anyref) ;; CHECK-BIN-NODEBUG-NEXT: (local $8 funcref) -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $11 (type $10) (param $0 (ref null $0)) @@ -501,5 +490,4 @@ ;; CHECK-BIN-NODEBUG-NEXT: (local $7 anyref) ;; CHECK-BIN-NODEBUG-NEXT: (local $8 anyref) ;; CHECK-BIN-NODEBUG-NEXT: (local $9 funcref) -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) diff --git a/test/lit/if-then-else.wast b/test/lit/if-then-else.wast index c1247af96ec..7fa59fad0e5 100644 --- a/test/lit/if-then-else.wast +++ b/test/lit/if-then-else.wast @@ -7,7 +7,6 @@ ;; CHECK-NEXT: (if ;; CHECK-NEXT: (local.get $0) ;; CHECK-NEXT: (then - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (else ;; CHECK-NEXT: (return @@ -23,7 +22,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (else - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (return diff --git a/test/lit/merge/chain.wat b/test/lit/merge/chain.wat index 528b20d0eed..9faca1143a9 100644 --- a/test/lit/merge/chain.wat +++ b/test/lit/merge/chain.wat @@ -16,7 +16,6 @@ ;; CHECK: (export "h" (func $0_2)) ;; CHECK: (func $0 (type $0) -;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK: (func $0_2 (type $0) diff --git a/test/lit/merge/names.wat b/test/lit/merge/names.wat index 504dac102c2..6f51b54cac5 100644 --- a/test/lit/merge/names.wat +++ b/test/lit/merge/names.wat @@ -89,7 +89,6 @@ ;; CHECK: (export "func2" (func $5)) ;; CHECK: (func $func0 (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func0 (export "f0")) (func (export "f1")) @@ -117,21 +116,16 @@ (func (export "func") (param $x (ref $t))) ) ;; CHECK: (func $1 (type $0) -;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK: (func $2 (type $3) (param $x (ref $t)) -;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK: (func $func2 (type $0) -;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK: (func $4 (type $0) -;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK: (func $5 (type $4) (param $0 (ref $u)) -;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) diff --git a/test/lit/merge/renamings.wat b/test/lit/merge/renamings.wat index 9c54f3514ec..e680b276b3e 100644 --- a/test/lit/merge/renamings.wat +++ b/test/lit/merge/renamings.wat @@ -141,7 +141,6 @@ ;; CHECK: (func $uses (type $3) (param $array (ref $array)) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $foo ;; CHECK-NEXT: (drop @@ -151,7 +150,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $bar ;; CHECK-NEXT: (drop @@ -323,7 +321,6 @@ ;; CHECK: (func $uses.second (type $3) (param $array (ref $array)) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do -;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $foo_2 ;; CHECK-NEXT: (drop @@ -333,7 +330,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do -;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $other ;; CHECK-NEXT: (drop diff --git a/test/lit/merge/table64.wat b/test/lit/merge/table64.wat index a313b5bc350..e1e41dca936 100644 --- a/test/lit/merge/table64.wat +++ b/test/lit/merge/table64.wat @@ -15,5 +15,4 @@ ;; CHECK: (export "table" (table $table)) ;; CHECK: (func $second (type $0) -;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) diff --git a/test/lit/non-nullable-locals.wast b/test/lit/non-nullable-locals.wast index 21c12d4ad76..6349a0ed425 100644 --- a/test/lit/non-nullable-locals.wast +++ b/test/lit/non-nullable-locals.wast @@ -15,7 +15,6 @@ ;; CHECK: (func $no-uses (type $0) ;; CHECK-NEXT: (local $x (ref func)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $no-uses ;; A local with no uses validates. @@ -171,7 +170,6 @@ ) ;; CHECK: (func $helper (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $helper) diff --git a/test/lit/passes/abstract-type-refining.wast b/test/lit/passes/abstract-type-refining.wast index e887894ea74..5f6010ca07c 100644 --- a/test/lit/passes/abstract-type-refining.wast +++ b/test/lit/passes/abstract-type-refining.wast @@ -242,7 +242,6 @@ ;; YESTNH-NEXT: (local $C (ref $C)) ;; YESTNH-NEXT: (local $D (ref $E)) ;; YESTNH-NEXT: (local $E (ref $E)) - ;; YESTNH-NEXT: (nop) ;; YESTNH-NEXT: ) ;; NO_TNH: (func $locals (type $6) ;; NO_TNH-NEXT: (local $A (ref $A)) @@ -250,7 +249,6 @@ ;; NO_TNH-NEXT: (local $C (ref $C)) ;; NO_TNH-NEXT: (local $D (ref $D)) ;; NO_TNH-NEXT: (local $E (ref $E)) - ;; NO_TNH-NEXT: (nop) ;; NO_TNH-NEXT: ) (func $locals ;; Local variable types are also updated. @@ -799,14 +797,12 @@ ;; YESTNH-NEXT: (local $B (ref none)) ;; YESTNH-NEXT: (local $C1 (ref none)) ;; YESTNH-NEXT: (local $C2 nullref) - ;; YESTNH-NEXT: (nop) ;; YESTNH-NEXT: ) ;; NO_TNH: (func $locals (type $1) ;; NO_TNH-NEXT: (local $A (ref none)) ;; NO_TNH-NEXT: (local $B (ref none)) ;; NO_TNH-NEXT: (local $C1 (ref none)) ;; NO_TNH-NEXT: (local $C2 nullref) - ;; NO_TNH-NEXT: (nop) ;; NO_TNH-NEXT: ) (func $locals ;; All these locals can become nullable or even non-nullable null types. @@ -1002,21 +998,17 @@ ;; YESTNH: (type $3 (func (param funcref))) ;; YESTNH: (func $A (type $A) - ;; YESTNH-NEXT: (nop) ;; YESTNH-NEXT: ) ;; NO_TNH: (type $3 (func (param funcref))) ;; NO_TNH: (func $A (type $A) - ;; NO_TNH-NEXT: (nop) ;; NO_TNH-NEXT: ) (func $A (type $A) ) ;; YESTNH: (func $C (type $A) - ;; YESTNH-NEXT: (nop) ;; YESTNH-NEXT: ) ;; NO_TNH: (func $C (type $A) - ;; NO_TNH-NEXT: (nop) ;; NO_TNH-NEXT: ) (func $C (type $A) ) diff --git a/test/lit/passes/asyncify_enable-multivalue.wast b/test/lit/passes/asyncify_enable-multivalue.wast index f29edd4a544..86a8bc47e65 100644 --- a/test/lit/passes/asyncify_enable-multivalue.wast +++ b/test/lit/passes/asyncify_enable-multivalue.wast @@ -193,7 +193,6 @@ (call $stuff) ;; do some more work ) ;; CHECK: (func $stuff - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $stuff) ;; the first event called from the main event loop: just call into $work @@ -2484,7 +2483,6 @@ (call $import) ) ;; CHECK: (func $boring - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $boring) ;; CHECK: (func $calls-mix-deep diff --git a/test/lit/passes/asyncify_optimize-level=1.wast b/test/lit/passes/asyncify_optimize-level=1.wast index d7627f40781..4839b08bbae 100644 --- a/test/lit/passes/asyncify_optimize-level=1.wast +++ b/test/lit/passes/asyncify_optimize-level=1.wast @@ -1425,7 +1425,6 @@ (call $import) ) ;; CHECK: (func $boring - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $boring) ;; CHECK: (func $calls-mix-deep diff --git a/test/lit/passes/asyncify_pass-arg=asyncify-addlist@foo.wast b/test/lit/passes/asyncify_pass-arg=asyncify-addlist@foo.wast index 92dbe2bb230..2803d243d06 100644 --- a/test/lit/passes/asyncify_pass-arg=asyncify-addlist@foo.wast +++ b/test/lit/passes/asyncify_pass-arg=asyncify-addlist@foo.wast @@ -114,7 +114,6 @@ (call $nothing) ) ;; CHECK: (func $nothing - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $nothing ) diff --git a/test/lit/passes/asyncify_pass-arg=asyncify-addlist@foo_pass-arg=asyncify-ignore-indirect.wast b/test/lit/passes/asyncify_pass-arg=asyncify-addlist@foo_pass-arg=asyncify-ignore-indirect.wast index 81107cb164c..5f4fb89def7 100644 --- a/test/lit/passes/asyncify_pass-arg=asyncify-addlist@foo_pass-arg=asyncify-ignore-indirect.wast +++ b/test/lit/passes/asyncify_pass-arg=asyncify-addlist@foo_pass-arg=asyncify-ignore-indirect.wast @@ -155,7 +155,6 @@ (call_indirect (type $t) (i32.const 0)) ) ;; CHECK: (func $nothing - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $nothing ) diff --git a/test/lit/passes/asyncify_pass-arg=asyncify-addlist@foo_pass-arg=asyncify-propagate-addlist.wast b/test/lit/passes/asyncify_pass-arg=asyncify-addlist@foo_pass-arg=asyncify-propagate-addlist.wast index b0b758b4921..37075e800a4 100644 --- a/test/lit/passes/asyncify_pass-arg=asyncify-addlist@foo_pass-arg=asyncify-propagate-addlist.wast +++ b/test/lit/passes/asyncify_pass-arg=asyncify-addlist@foo_pass-arg=asyncify-propagate-addlist.wast @@ -113,7 +113,6 @@ (call $nothing) ) ;; CHECK: (func $nothing - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $nothing ) diff --git a/test/lit/passes/asyncify_pass-arg=asyncify-imports@env.import,env.import2.wast b/test/lit/passes/asyncify_pass-arg=asyncify-imports@env.import,env.import2.wast index 801ab5eb954..36e1aa68ca1 100644 --- a/test/lit/passes/asyncify_pass-arg=asyncify-imports@env.import,env.import2.wast +++ b/test/lit/passes/asyncify_pass-arg=asyncify-imports@env.import,env.import2.wast @@ -193,7 +193,6 @@ (call $stuff) ;; do some more work ) ;; CHECK: (func $stuff - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $stuff) ;; the first event called from the main event loop: just call into $work @@ -1610,7 +1609,6 @@ (call $import) ) ;; CHECK: (func $boring - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $boring) ;; CHECK: (func $calls-mix-deep diff --git a/test/lit/passes/coalesce-locals-eh-legacy.wast b/test/lit/passes/coalesce-locals-eh-legacy.wast index 9091fdcb960..b5b41b66154 100644 --- a/test/lit/passes/coalesce-locals-eh-legacy.wast +++ b/test/lit/passes/coalesce-locals-eh-legacy.wast @@ -50,7 +50,6 @@ ;; CHECK-NEXT: (local $0 anyref) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $any ;; CHECK-NEXT: (drop diff --git a/test/lit/passes/code-folding-eh-legacy.wast b/test/lit/passes/code-folding-eh-legacy.wast index 852ec126a92..81180d04463 100644 --- a/test/lit/passes/code-folding-eh-legacy.wast +++ b/test/lit/passes/code-folding-eh-legacy.wast @@ -12,7 +12,6 @@ ;; CHECK-NEXT: (do ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $e-i32 ;; CHECK-NEXT: (drop @@ -112,7 +111,6 @@ ;; CHECK: (func $foo (type $1) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo) diff --git a/test/lit/passes/code-folding-eh.wast b/test/lit/passes/code-folding-eh.wast index 5a7cd68c783..94eb0b38d32 100644 --- a/test/lit/passes/code-folding-eh.wast +++ b/test/lit/passes/code-folding-eh.wast @@ -53,7 +53,6 @@ ;; CHECK: (func $foo (type $1) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo) diff --git a/test/lit/passes/code-pushing-eh-legacy.wast b/test/lit/passes/code-pushing-eh-legacy.wast index 9511d244a41..06b2e3e7140 100644 --- a/test/lit/passes/code-pushing-eh-legacy.wast +++ b/test/lit/passes/code-pushing-eh-legacy.wast @@ -17,7 +17,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop @@ -53,7 +52,6 @@ ) ;; CHECK: (func $foo (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo) @@ -166,7 +164,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop @@ -224,7 +221,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop diff --git a/test/lit/passes/code-pushing-eh.wast b/test/lit/passes/code-pushing-eh.wast index ee2798c4605..3c6d005b123 100644 --- a/test/lit/passes/code-pushing-eh.wast +++ b/test/lit/passes/code-pushing-eh.wast @@ -118,7 +118,6 @@ ) ;; CHECK: (func $foo (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo) diff --git a/test/lit/passes/dae-gc-refine-params.wast b/test/lit/passes/dae-gc-refine-params.wast index f9e9c4651c9..8cefbe88184 100644 --- a/test/lit/passes/dae-gc-refine-params.wast +++ b/test/lit/passes/dae-gc-refine-params.wast @@ -316,7 +316,6 @@ ;; CHECK: (func $unused-and-refinable (type $2) ;; CHECK-NEXT: (local $0 structref) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $unused-and-refinable (param $0 structref) ;; This function does not use $0. It is called with $"{}", so it is also diff --git a/test/lit/passes/dae-gc.wast b/test/lit/passes/dae-gc.wast index 9878230207f..1f39567d146 100644 --- a/test/lit/passes/dae-gc.wast +++ b/test/lit/passes/dae-gc.wast @@ -155,15 +155,12 @@ ;; Helper functions so we have something to take the reference of. ;; CHECK: (func $a (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $a) ;; CHECK: (func $b (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $b) ;; CHECK: (func $c (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $c) ) diff --git a/test/lit/passes/dae_all-features.wast b/test/lit/passes/dae_all-features.wast index da9558dd8e0..145ae1ff032 100644 --- a/test/lit/passes/dae_all-features.wast +++ b/test/lit/passes/dae_all-features.wast @@ -33,7 +33,8 @@ ;; CHECK-NEXT: (local.set $0 ;; CHECK-NEXT: (i32.const 1) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $a (param $x i32)) ;; CHECK: (func $b (type $0) @@ -114,7 +115,8 @@ ;; CHECK-NEXT: (local.set $0 ;; CHECK-NEXT: (i32.const 4) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $a4 (param $x i32) ;; This function is called with one constant and one unreachable. We can @@ -219,7 +221,6 @@ (call $a7 (i32.const 1) (call $get-f64)) ) ;; CHECK: (func $a8 (type $1) (param $x i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $a8 (param $x i32)) ;; exported, do not optimize ;; CHECK: (func $b8 (type $0) @@ -231,7 +232,6 @@ (call $a8 (i32.const 1)) ) ;; CHECK: (func $a9 (type $1) (param $x i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $a9 (param $x i32)) ;; tabled, do not optimize ;; CHECK: (func $b9 (type $0) diff --git a/test/lit/passes/dae_tnh.wast b/test/lit/passes/dae_tnh.wast index 2bba6570b7c..6e78283fdce 100644 --- a/test/lit/passes/dae_tnh.wast +++ b/test/lit/passes/dae_tnh.wast @@ -57,7 +57,6 @@ ) ;; CHECK: (func $target (type $1) (param $0 i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $target (param i32) ) @@ -105,7 +104,6 @@ ) ;; CHECK: (func $target (type $1) (param $0 i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $target (param i32) ) diff --git a/test/lit/passes/dce-eh-legacy.wast b/test/lit/passes/dce-eh-legacy.wast index 107c35609cd..31ba4fac2de 100644 --- a/test/lit/passes/dce-eh-legacy.wast +++ b/test/lit/passes/dce-eh-legacy.wast @@ -25,7 +25,6 @@ (tag $e-eqref (param (ref null eq))) ;; CHECK: (func $foo (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo) @@ -35,7 +34,6 @@ ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (call $foo) @@ -53,7 +51,6 @@ ;; CHECK: (func $catch_unreachable (type $0) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all ;; CHECK-NEXT: (unreachable) @@ -96,7 +93,6 @@ ;; CHECK: (func $rethrow (type $0) ;; CHECK-NEXT: (try $l0 ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $e ;; CHECK-NEXT: (drop diff --git a/test/lit/passes/dce-eh.wast b/test/lit/passes/dce-eh.wast index 413a278d0b8..b2742913b54 100644 --- a/test/lit/passes/dce-eh.wast +++ b/test/lit/passes/dce-eh.wast @@ -11,7 +11,6 @@ (tag $e-i32 (param i32)) ;; CHECK: (func $foo (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo) diff --git a/test/lit/passes/denan.wast b/test/lit/passes/denan.wast index bc42ab04e57..9f167b15d91 100644 --- a/test/lit/passes/denan.wast +++ b/test/lit/passes/denan.wast @@ -59,7 +59,8 @@ ;; CHECK-NEXT: (local.get $w) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $various (param $x i32) (param $y f32) (param $z i64) (param $w f64) ) @@ -251,11 +252,9 @@ ;; CHECK: (type $2 (func (param f64) (result f64))) ;; CHECK: (func $deNan32 - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $deNan32) ;; CHECK: (func $deNan64 - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $deNan64) ;; CHECK: (func $foo32 (param $x f32) (result f32) diff --git a/test/lit/passes/flatten-eh-legacy.wast b/test/lit/passes/flatten-eh-legacy.wast index 56057b7798e..34b5cf08b82 100644 --- a/test/lit/passes/flatten-eh-legacy.wast +++ b/test/lit/passes/flatten-eh-legacy.wast @@ -61,7 +61,6 @@ ;; CHECK-NEXT: (block $l0 ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $e-i32 ;; CHECK-NEXT: (local.set $1 diff --git a/test/lit/passes/flatten_i64-to-i32-lowering.wast b/test/lit/passes/flatten_i64-to-i32-lowering.wast index 5a185cc0aeb..e5e556c79ab 100644 --- a/test/lit/passes/flatten_i64-to-i32-lowering.wast +++ b/test/lit/passes/flatten_i64-to-i32-lowering.wast @@ -480,7 +480,6 @@ ;; CHECK: (export "unreach" (func $unreach)) ;; CHECK: (func $call (type $1) (param $0 i32) (param $0$hi i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $call (param i64)) ;; CHECK: (func $exp (type $0) @@ -586,7 +585,6 @@ ;; CHECK: (export "exp" (func $exp)) ;; CHECK: (func $call (type $0) (param $0 i32) (param $0$hi i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $call (param i64)) ;; CHECK: (func $exp (type $1) diff --git a/test/lit/passes/flatten_simplify-locals-nonesting_souperify-single-use_enable-threads.wast b/test/lit/passes/flatten_simplify-locals-nonesting_souperify-single-use_enable-threads.wast index 76b4e6e51f0..f71970035af 100644 --- a/test/lit/passes/flatten_simplify-locals-nonesting_souperify-single-use_enable-threads.wast +++ b/test/lit/passes/flatten_simplify-locals-nonesting_souperify-single-use_enable-threads.wast @@ -2477,7 +2477,6 @@ ;; CHECK-NEXT: (i32.const 2) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (loop $loopy - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: (nop) diff --git a/test/lit/passes/flatten_simplify-locals-nonesting_souperify_enable-threads.wast b/test/lit/passes/flatten_simplify-locals-nonesting_souperify_enable-threads.wast index 5c11e34e364..d57df657913 100644 --- a/test/lit/passes/flatten_simplify-locals-nonesting_souperify_enable-threads.wast +++ b/test/lit/passes/flatten_simplify-locals-nonesting_souperify_enable-threads.wast @@ -318,7 +318,6 @@ ) ) ;; CHECK: (func $send-i32 (param $0 i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $send-i32 (param i32)) ;; flipping of greater than/or equals ops, which are not in Souper IR @@ -2545,7 +2544,6 @@ ;; CHECK-NEXT: (i32.const 2) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (loop $loopy - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: (nop) diff --git a/test/lit/passes/fpcast-emu.wast b/test/lit/passes/fpcast-emu.wast index 8ded8264724..9da081c4ac5 100644 --- a/test/lit/passes/fpcast-emu.wast +++ b/test/lit/passes/fpcast-emu.wast @@ -370,19 +370,15 @@ ;; CHECK: (export "dynCall_vd" (func $min_vd)) (export "dynCall_vd" (func $min_vd)) ;; CHECK: (func $a (param $0 f32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $a (param $0 f32)) ;; CHECK: (func $b (param $0 f64) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $b (param $0 f64)) ;; CHECK: (func $dynCall_vf (param $0 f32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $dynCall_vf (param $0 f32)) ;; CHECK: (func $min_vd (param $0 f32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $min_vd (param $0 f32)) ) diff --git a/test/lit/passes/global-refining.wast b/test/lit/passes/global-refining.wast index 1ede2009eb9..927dfd1f26c 100644 --- a/test/lit/passes/global-refining.wast +++ b/test/lit/passes/global-refining.wast @@ -18,10 +18,8 @@ ;; CLOSD: (global $func-func-init (mut (ref $foo_t)) (ref.func $foo)) (global $func-func-init (mut funcref) (ref.func $foo)) ;; CHECK: (func $foo (type $foo_t) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CLOSD: (func $foo (type $foo_t) - ;; CLOSD-NEXT: (nop) ;; CLOSD-NEXT: ) (func $foo (type $foo_t)) ) @@ -188,10 +186,8 @@ (global $b (ref $super) (global.get $a)) ;; CHECK: (func $func (type $sub) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CLOSD: (func $func (type $sub) - ;; CLOSD-NEXT: (nop) ;; CLOSD-NEXT: ) (func $func (type $sub) ) diff --git a/test/lit/passes/gto-removals.wast b/test/lit/passes/gto-removals.wast index 99579f8ab1d..a6fd9c22857 100644 --- a/test/lit/passes/gto-removals.wast +++ b/test/lit/passes/gto-removals.wast @@ -12,7 +12,6 @@ ;; CHECK: (type $1 (func (param (ref $struct)))) ;; CHECK: (func $func (type $1) (param $x (ref $struct)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func (param $x (ref $struct)) ) @@ -328,23 +327,18 @@ ) ;; CHECK: (func $func-0 (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func-0) ;; CHECK: (func $func-1 (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func-1) ;; CHECK: (func $func-2 (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func-2) ;; CHECK: (func $func-3 (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func-3) ;; CHECK: (func $func-4 (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func-4) ) @@ -1254,7 +1248,6 @@ ;; CHECK: (type $2 (func (param (ref $B)))) ;; CHECK: (func $func (type $2) (param $x (ref $B)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func (param $x (ref $B)) ;; Use $B in a param to keep it alive, and lead us to process it and $A. @@ -1273,7 +1266,6 @@ ;; CHECK: (type $2 (func (param (ref $B)))) ;; CHECK: (func $func (type $2) (param $x (ref $B)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func (param $x (ref $B)) ) diff --git a/test/lit/passes/gufa-refs.wast b/test/lit/passes/gufa-refs.wast index 6722d0ed452..9772745bc28 100644 --- a/test/lit/passes/gufa-refs.wast +++ b/test/lit/passes/gufa-refs.wast @@ -1917,7 +1917,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $nothing ;; CHECK-NEXT: (local.set $0 @@ -1943,7 +1942,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $something ;; CHECK-NEXT: (drop @@ -2146,7 +2144,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $tag ;; CHECK-NEXT: (local.set $0 @@ -2164,7 +2161,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $tag ;; CHECK-NEXT: (drop @@ -2393,7 +2389,6 @@ ) ;; CHECK: (func $foo (type $1) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo) ) diff --git a/test/lit/passes/heap2local.wast b/test/lit/passes/heap2local.wast index 179437c3874..bad4a33bf30 100644 --- a/test/lit/passes/heap2local.wast +++ b/test/lit/passes/heap2local.wast @@ -485,7 +485,6 @@ ) ;; CHECK: (func $send-ref (type $5) (param $0 (ref null $struct.A)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $send-ref (param (ref null $struct.A)) ) diff --git a/test/lit/passes/inlining-eh-legacy.wast b/test/lit/passes/inlining-eh-legacy.wast index 9135f786ed0..4d9d3a7aa94 100644 --- a/test/lit/passes/inlining-eh-legacy.wast +++ b/test/lit/passes/inlining-eh-legacy.wast @@ -25,7 +25,6 @@ ;; CHECK-NEXT: (block $__inlined_func$callee-with-label ;; CHECK-NEXT: (try $label0 ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $tag$0 ;; CHECK-NEXT: (drop @@ -52,7 +51,6 @@ ;; CHECK: (func $callee-with-try-delegate (type $0) ;; CHECK-NEXT: (try $label$3 ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (delegate 0) ;; CHECK-NEXT: ) @@ -83,7 +81,6 @@ ;; CHECK: (func $caller-with-try-delegate (type $2) (result i32) ;; CHECK-NEXT: (try $label$3 ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (delegate 0) ;; CHECK-NEXT: ) @@ -107,14 +104,14 @@ ;; CHECK-NEXT: (local $0 i32) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $tag$0 ;; CHECK-NEXT: (block $__inlined_func$callee-b$2 ;; CHECK-NEXT: (local.set $0 ;; CHECK-NEXT: (pop i32) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -144,7 +141,6 @@ ;; CHECK-NEXT: (local $2 i32) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $tag$0 ;; CHECK-NEXT: (local.set $2 @@ -159,7 +155,8 @@ ;; CHECK-NEXT: (local.get $0) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) diff --git a/test/lit/passes/inlining-gc.wast b/test/lit/passes/inlining-gc.wast index 8da522e1d15..445cbf04208 100644 --- a/test/lit/passes/inlining-gc.wast +++ b/test/lit/passes/inlining-gc.wast @@ -8,7 +8,8 @@ ;; CHECK-NEXT: (local.set $0 ;; CHECK-NEXT: (ref.null nofunc) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $caller-nullable @@ -27,7 +28,8 @@ ;; CHECK: (func $caller-non-nullable (type $0) ;; CHECK-NEXT: (local $0 (ref func)) ;; CHECK-NEXT: (block $__inlined_func$target-non-nullable$1 - ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $caller-non-nullable diff --git a/test/lit/passes/inlining_all-features.wast b/test/lit/passes/inlining_all-features.wast index 38d24ab72bb..860f5b8f75f 100644 --- a/test/lit/passes/inlining_all-features.wast +++ b/test/lit/passes/inlining_all-features.wast @@ -15,13 +15,13 @@ ;; $foo should not be removed after being inlined, because there is 'ref.func' ;; instruction that refers to it ;; CHECK: (func $foo (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo) ;; CHECK: (func $ref_func_test (type $1) (result funcref) ;; CHECK-NEXT: (block $__inlined_func$foo - ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (ref.func $foo) ;; CHECK-NEXT: ) @@ -160,7 +160,8 @@ ;; CHECK-NEXT: (local.get $0) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $caller-with-pop-twice diff --git a/test/lit/passes/inlining_splitting.wast b/test/lit/passes/inlining_splitting.wast index 84c0b9832a3..f3d7f44a4d2 100644 --- a/test/lit/passes/inlining_splitting.wast +++ b/test/lit/passes/inlining_splitting.wast @@ -856,7 +856,6 @@ ) ;; CHECK: (func $byn-split-outlined-A$colliding-name (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $byn-split-outlined-A$colliding-name ;; This function's name might collide with the split function we create for diff --git a/test/lit/passes/instrument-locals-eh-legacy.wast b/test/lit/passes/instrument-locals-eh-legacy.wast index 8ee5535544f..23d944a0cff 100644 --- a/test/lit/passes/instrument-locals-eh-legacy.wast +++ b/test/lit/passes/instrument-locals-eh-legacy.wast @@ -9,7 +9,6 @@ ;; CHECK-NEXT: (local $x i32) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $e ;; CHECK-NEXT: (local.set $x diff --git a/test/lit/passes/j2cl-inline.wast b/test/lit/passes/j2cl-inline.wast index 88485f999dc..7d8f52c525a 100644 --- a/test/lit/passes/j2cl-inline.wast +++ b/test/lit/passes/j2cl-inline.wast @@ -17,7 +17,7 @@ ;; A once function that just calls another ;; CHECK: (func $clinit-trivial-2__@Bar (type $0) - ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (call $clinit-trivial-1__@Foo) ;; CHECK-NEXT: ) (func $clinit-trivial-2__@Bar (call $clinit-trivial-1__@Foo) @@ -47,6 +47,8 @@ ) ;; CHECK: (func $main (type $0) + ;; CHECK-NEXT: (call $clinit-trivial-1__@Foo) + ;; CHECK-NEXT: (call $clinit-trivial-1__@Foo) ;; CHECK-NEXT: (call $clinit-non-trivial__@Zoo) ;; CHECK-NEXT: ) (func $main diff --git a/test/lit/passes/j2cl-merge-itables.wast b/test/lit/passes/j2cl-merge-itables.wast index 499f598e127..8506724fd1a 100644 --- a/test/lit/passes/j2cl-merge-itables.wast +++ b/test/lit/passes/j2cl-merge-itables.wast @@ -65,7 +65,6 @@ (struct.new $Object.vtable)) ;; CHECK: (func $SubObject.f (type $function) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $SubObject.f (type $function) @@ -180,7 +179,6 @@ (struct.new_default $Object.itable)) ;; CHECK: (func $SubObject.f (type $function) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $SubObject.f (type $function) diff --git a/test/lit/passes/j2cl.wast b/test/lit/passes/j2cl.wast index 4fe661e5c96..8317f660075 100644 --- a/test/lit/passes/j2cl.wast +++ b/test/lit/passes/j2cl.wast @@ -212,7 +212,6 @@ ;; CHECK: (func $notOnceFunction@Zoo (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $notOnceFunction@Zoo ) @@ -225,7 +224,6 @@ ) ;; CHECK: (func $empty__@Zoo (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $empty__@Zoo ) @@ -255,7 +253,7 @@ ;; CHECK: (func $caller_@Zoo (type $1) (result i32) ;; CHECK-NEXT: (nop) - ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (call $empty__@Zoo) ;; CHECK-NEXT: (call $notOnceFunction@Zoo) ;; CHECK-NEXT: (global.set $$var2@Zoo ;; CHECK-NEXT: (i32.const 3) diff --git a/test/lit/passes/legalize-js-interface-exported-helpers.wast b/test/lit/passes/legalize-js-interface-exported-helpers.wast index 707cbe5c9b1..bed768f1a0d 100644 --- a/test/lit/passes/legalize-js-interface-exported-helpers.wast +++ b/test/lit/passes/legalize-js-interface-exported-helpers.wast @@ -31,7 +31,6 @@ (i64.const 0) ) ;; CHECK: (func $__set_temp_ret (param $0 i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $__set_temp_ret (param i32)) ;; CHECK: (func $__get_temp_ret (result i32) diff --git a/test/lit/passes/local-cse_all-features.wast b/test/lit/passes/local-cse_all-features.wast index 8878d595fe9..e8d7da4c7f5 100644 --- a/test/lit/passes/local-cse_all-features.wast +++ b/test/lit/passes/local-cse_all-features.wast @@ -509,7 +509,6 @@ ) ;; CHECK: (func $callee (type $2) (param $x i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $callee (param $x i32) ) diff --git a/test/lit/passes/monomorphize-context.wast b/test/lit/passes/monomorphize-context.wast index cc4bdfc9d2e..7f9cb2f566e 100644 --- a/test/lit/passes/monomorphize-context.wast +++ b/test/lit/passes/monomorphize-context.wast @@ -177,7 +177,6 @@ ) ;; ALWAYS: (func $target (type $1) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (param $5 i32) (param $6 i32) (param $7 i32) (param $8 i32) (param $9 i32) (param $10 anyref) (param $11 funcref) (param $12 i32) (param $13 f64) (param $14 i32) (param $15 anyref) (param $16 anyref) - ;; ALWAYS-NEXT: (nop) ;; ALWAYS-NEXT: ) ;; CAREFUL: (func $target (type $1) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (param $5 i32) (param $6 i32) (param $7 i32) (param $8 i32) (param $9 i32) (param $10 anyref) (param $11 funcref) (param $12 i32) (param $13 f64) (param $14 i32) (param $15 anyref) (param $16 anyref) ;; CAREFUL-NEXT: (nop) @@ -285,7 +284,8 @@ ;; ALWAYS-NEXT: (local.set $22 ;; ALWAYS-NEXT: (struct.new_default $struct) ;; ALWAYS-NEXT: ) -;; ALWAYS-NEXT: (nop) +;; ALWAYS-NEXT: (block +;; ALWAYS-NEXT: ) ;; ALWAYS-NEXT: ) ;; CAREFUL: (func $target_2 (type $2) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (param $5 i32) @@ -1333,7 +1333,6 @@ ) ;; ALWAYS: (func $target (type $1) (param $0 i32) (param $1 i32) - ;; ALWAYS-NEXT: (nop) ;; ALWAYS-NEXT: ) ;; CAREFUL: (func $target (type $1) (param $0 i32) (param $1 i32) ;; CAREFUL-NEXT: (nop) @@ -1353,7 +1352,8 @@ ;; ALWAYS-NEXT: (i32.const 0) ;; ALWAYS-NEXT: ) ;; ALWAYS-NEXT: ) -;; ALWAYS-NEXT: (nop) +;; ALWAYS-NEXT: (block +;; ALWAYS-NEXT: ) ;; ALWAYS-NEXT: ) (module (memory 10 20) @@ -1414,7 +1414,6 @@ ) ;; ALWAYS: (func $target (type $0) (param $0 i32) - ;; ALWAYS-NEXT: (nop) ;; ALWAYS-NEXT: ) ;; CAREFUL: (func $target (type $1) (param $0 i32) ;; CAREFUL-NEXT: (nop) @@ -1432,7 +1431,8 @@ ;; ALWAYS-NEXT: (i32.const 1) ;; ALWAYS-NEXT: ) ;; ALWAYS-NEXT: ) -;; ALWAYS-NEXT: (nop) +;; ALWAYS-NEXT: (block +;; ALWAYS-NEXT: ) ;; ALWAYS-NEXT: ) (module ;; ALWAYS: (type $0 (func)) @@ -1551,7 +1551,6 @@ ) ;; ALWAYS: (func $target (type $2) (param $0 anyref) - ;; ALWAYS-NEXT: (nop) ;; ALWAYS-NEXT: ) ;; CAREFUL: (func $target (type $1) (param $0 anyref) ;; CAREFUL-NEXT: (nop) @@ -1569,7 +1568,8 @@ ;; ALWAYS-NEXT: (local.get $1) ;; ALWAYS-NEXT: ) ;; ALWAYS-NEXT: ) -;; ALWAYS-NEXT: (nop) +;; ALWAYS-NEXT: (block +;; ALWAYS-NEXT: ) ;; ALWAYS-NEXT: ) ;; ALWAYS: (func $target_4 (type $4) (param $0 i32) @@ -1582,7 +1582,8 @@ ;; ALWAYS-NEXT: ) ;; ALWAYS-NEXT: ) ;; ALWAYS-NEXT: ) -;; ALWAYS-NEXT: (nop) +;; ALWAYS-NEXT: (block +;; ALWAYS-NEXT: ) ;; ALWAYS-NEXT: ) ;; CAREFUL: (func $target_3 (type $2) (param $0 i32) (param $1 i32) @@ -1719,7 +1720,6 @@ ) ;; ALWAYS: (func $target (type $1) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (param $5 i32) - ;; ALWAYS-NEXT: (nop) ;; ALWAYS-NEXT: ) ;; CAREFUL: (func $target (type $1) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (param $5 i32) ;; CAREFUL-NEXT: (nop) @@ -1756,7 +1756,8 @@ ;; ALWAYS-NEXT: (i32.const 0) ;; ALWAYS-NEXT: ) ;; ALWAYS-NEXT: ) -;; ALWAYS-NEXT: (nop) +;; ALWAYS-NEXT: (block +;; ALWAYS-NEXT: ) ;; ALWAYS-NEXT: ) (module ;; ALWAYS: (type $0 (func)) @@ -1795,10 +1796,8 @@ ) ;; ALWAYS: (func $target (type $1) (param $0 f32) - ;; ALWAYS-NEXT: (nop) ;; ALWAYS-NEXT: ) ;; CAREFUL: (func $target (type $1) (param $0 f32) - ;; CAREFUL-NEXT: (nop) ;; CAREFUL-NEXT: ) (func $target (param $0 f32) ) diff --git a/test/lit/passes/monomorphize-limits.wast b/test/lit/passes/monomorphize-limits.wast index 344f55b51a0..29dd9de20d5 100644 --- a/test/lit/passes/monomorphize-limits.wast +++ b/test/lit/passes/monomorphize-limits.wast @@ -112,7 +112,6 @@ ) ;; ALWAYS: (func $many-params (type $1) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (param $5 i32) (param $6 i32) (param $7 i32) (param $8 i32) (param $9 i32) (param $10 i32) (param $11 i32) (param $12 i32) (param $13 i32) (param $14 i32) (param $15 i32) (param $16 i32) (param $17 i32) (param $18 i32) (param $19 i32) (param $20 i32) (param $21 i32) (param $22 i32) (param $23 i32) (param $24 i32) - ;; ALWAYS-NEXT: (nop) ;; ALWAYS-NEXT: ) ;; CAREFUL: (func $many-params (type $1) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (param $5 i32) (param $6 i32) (param $7 i32) (param $8 i32) (param $9 i32) (param $10 i32) (param $11 i32) (param $12 i32) (param $13 i32) (param $14 i32) (param $15 i32) (param $16 i32) (param $17 i32) (param $18 i32) (param $19 i32) (param $20 i32) (param $21 i32) (param $22 i32) (param $23 i32) (param $24 i32) ;; CAREFUL-NEXT: (nop) @@ -227,7 +226,8 @@ ;; ALWAYS-NEXT: (local.set $24 ;; ALWAYS-NEXT: (i32.const 25) ;; ALWAYS-NEXT: ) -;; ALWAYS-NEXT: (nop) +;; ALWAYS-NEXT: (block +;; ALWAYS-NEXT: ) ;; ALWAYS-NEXT: ) ;; CAREFUL: (func $many-params_3 (type $0) @@ -353,7 +353,6 @@ ) ;; ALWAYS: (func $target (type $3) (param $array (ref $array)) - ;; ALWAYS-NEXT: (nop) ;; ALWAYS-NEXT: ) ;; CAREFUL: (func $target (type $3) (param $0 (ref $array)) ;; CAREFUL-NEXT: (nop) @@ -392,7 +391,8 @@ ;; ALWAYS-NEXT: (i32.const 25) ;; ALWAYS-NEXT: ) ;; ALWAYS-NEXT: ) -;; ALWAYS-NEXT: (nop) +;; ALWAYS-NEXT: (block +;; ALWAYS-NEXT: ) ;; ALWAYS-NEXT: ) ;; CAREFUL: (func $target_3 (type $1) diff --git a/test/lit/passes/name-types.wast b/test/lit/passes/name-types.wast index bb31ffc8230..bde56309f70 100644 --- a/test/lit/passes/name-types.wast +++ b/test/lit/passes/name-types.wast @@ -34,7 +34,6 @@ ;; CHECK: (type $type (func (param (ref $type_1) (ref $reasonable-name) (ref $lintable-name) (ref $unlintable-name_7) (ref $unlintable-name) (ref $onelintable-name) (ref $onelintable-name_8)))) ;; CHECK: (func $foo (type $type) (param $x (ref $type_1)) (param $y (ref $reasonable-name)) (param $z (ref $lintable-name)) (param $w (ref $unlintable-name_7)) (param $t (ref $unlintable-name)) (param $a (ref $onelintable-name)) (param $b (ref $onelintable-name_8)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo ;; Use the types to keep them alive. diff --git a/test/lit/passes/once-reduction.wast b/test/lit/passes/once-reduction.wast index af9f4f113ed..640d14461f1 100644 --- a/test/lit/passes/once-reduction.wast +++ b/test/lit/passes/once-reduction.wast @@ -201,7 +201,6 @@ ) ;; CHECK: (func $caller-empty (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $caller-empty ;; A tiny function with nothing at all, just to verify we do not crash on @@ -1481,7 +1480,6 @@ ) ;; CHECK: (func $bad-B (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $bad-B ) @@ -2022,7 +2020,6 @@ ) ;; CHECK: (func $other (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $other ) diff --git a/test/lit/passes/optimize-casts-noeh.wast b/test/lit/passes/optimize-casts-noeh.wast index 3cee5f3d441..3c3b5f8c504 100644 --- a/test/lit/passes/optimize-casts-noeh.wast +++ b/test/lit/passes/optimize-casts-noeh.wast @@ -63,7 +63,6 @@ ) ;; CHECK: (func $none (type $2) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $none ;; Helper for the above. diff --git a/test/lit/passes/optimize-casts.wast b/test/lit/passes/optimize-casts.wast index acf8fc7b425..0719cbd91f9 100644 --- a/test/lit/passes/optimize-casts.wast +++ b/test/lit/passes/optimize-casts.wast @@ -1398,7 +1398,6 @@ ) ;; CHECK: (func $void (type $void) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $void ;; Helper for the above. diff --git a/test/lit/passes/optimize-instructions-call_ref-roundtrip.wast b/test/lit/passes/optimize-instructions-call_ref-roundtrip.wast index 05f03110c40..c3e51d04984 100644 --- a/test/lit/passes/optimize-instructions-call_ref-roundtrip.wast +++ b/test/lit/passes/optimize-instructions-call_ref-roundtrip.wast @@ -46,15 +46,12 @@ (ref.func $helper-3)) ;; CHECK: (func $helper-1 (type $v1) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $helper-1 (type $v1)) ;; CHECK: (func $helper-2 (type $v2) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $helper-2 (type $v2)) ;; CHECK: (func $helper-3 (type $v3) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $helper-3 (type $v3)) diff --git a/test/lit/passes/optimize-instructions-call_ref.wast b/test/lit/passes/optimize-instructions-call_ref.wast index 937fbe6a766..66e651a0694 100644 --- a/test/lit/passes/optimize-instructions-call_ref.wast +++ b/test/lit/passes/optimize-instructions-call_ref.wast @@ -189,7 +189,6 @@ ;; Helper function for the above test. ;; CHECK: (func $return-nothing (type $none_=>_none) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $return-nothing) diff --git a/test/lit/passes/optimize-instructions-eh-legacy.wast b/test/lit/passes/optimize-instructions-eh-legacy.wast index a6c65018380..dd51d6c1753 100644 --- a/test/lit/passes/optimize-instructions-eh-legacy.wast +++ b/test/lit/passes/optimize-instructions-eh-legacy.wast @@ -6,7 +6,6 @@ ;; CHECK: (tag $e (param i32)) ;; CHECK: (func $dummy (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $dummy) (tag $e (param i32)) @@ -164,7 +163,6 @@ ;; CHECK-NEXT: (call $dummy) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (i32.const 1) @@ -209,7 +207,6 @@ ;; CHECK-NEXT: (do ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all ;; CHECK-NEXT: (call $dummy) diff --git a/test/lit/passes/optimize-instructions-gc-iit.wast b/test/lit/passes/optimize-instructions-gc-iit.wast index ab3005af531..224e53d4050 100644 --- a/test/lit/passes/optimize-instructions-gc-iit.wast +++ b/test/lit/passes/optimize-instructions-gc-iit.wast @@ -19,10 +19,8 @@ (type $other (struct (field i64) (field f32))) ;; CHECK: (func $foo (type $3) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; TNH: (func $foo (type $3) - ;; TNH-NEXT: (nop) ;; TNH-NEXT: ) (func $foo) diff --git a/test/lit/passes/optimize-instructions-gc.wast b/test/lit/passes/optimize-instructions-gc.wast index 21d6291a921..4b88507ffc7 100644 --- a/test/lit/passes/optimize-instructions-gc.wast +++ b/test/lit/passes/optimize-instructions-gc.wast @@ -472,7 +472,6 @@ ) ;; CHECK: (func $nothing (type $5) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $nothing) diff --git a/test/lit/passes/optimize-instructions-iit-eh-legacy.wast b/test/lit/passes/optimize-instructions-iit-eh-legacy.wast index c0e4a05da92..79cb6f6f1c8 100644 --- a/test/lit/passes/optimize-instructions-iit-eh-legacy.wast +++ b/test/lit/passes/optimize-instructions-iit-eh-legacy.wast @@ -11,7 +11,6 @@ ;; CHECK: (func $ref-cast-statically-removed (type $2) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $e ;; CHECK-NEXT: (throw $e diff --git a/test/lit/passes/optimize-instructions-mvp.wast b/test/lit/passes/optimize-instructions-mvp.wast index 8b1afa76aa8..f18c94c5c05 100644 --- a/test/lit/passes/optimize-instructions-mvp.wast +++ b/test/lit/passes/optimize-instructions-mvp.wast @@ -15688,7 +15688,6 @@ ) ) ;; CHECK: (func $send-i32 (param $0 i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $send-i32 (param i32)) ;; CHECK: (func $ternary-identical-arms-call (param $x i32) (param $y i32) (param $z i32) diff --git a/test/lit/passes/remove-unused-brs-eh.wast b/test/lit/passes/remove-unused-brs-eh.wast index 8ce578101c3..336b3b5a807 100644 --- a/test/lit/passes/remove-unused-brs-eh.wast +++ b/test/lit/passes/remove-unused-brs-eh.wast @@ -313,7 +313,6 @@ ;; CHECK-NEXT: (block $middle ;; CHECK-NEXT: (block $inner ;; CHECK-NEXT: (try_table (catch $e $outer) (catch $f $outer) (catch_all $outer) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -340,7 +339,6 @@ ;; CHECK-NEXT: (block $middle ;; CHECK-NEXT: (block $inner ;; CHECK-NEXT: (try_table (catch $e $outer) (catch $f $middle) (catch_all $outer) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (br $outer) diff --git a/test/lit/passes/remove-unused-brs.wast b/test/lit/passes/remove-unused-brs.wast index 6fcc5b066a3..3380db6b70b 100644 --- a/test/lit/passes/remove-unused-brs.wast +++ b/test/lit/passes/remove-unused-brs.wast @@ -105,7 +105,6 @@ ) ;; CHECK: (func $nothing (type $1) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $nothing) diff --git a/test/lit/passes/remove-unused-brs_all-features.wast b/test/lit/passes/remove-unused-brs_all-features.wast index 98f0202745c..4e722a04380 100644 --- a/test/lit/passes/remove-unused-brs_all-features.wast +++ b/test/lit/passes/remove-unused-brs_all-features.wast @@ -115,7 +115,6 @@ (unreachable) ) ;; CHECK: (func $i32_=>_none (type $2) (param $0 i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $i32_=>_none (param i32) ) diff --git a/test/lit/passes/remove-unused-module-elements-refs.wast b/test/lit/passes/remove-unused-module-elements-refs.wast index 146a25ea608..bd4940037c8 100644 --- a/test/lit/passes/remove-unused-module-elements-refs.wast +++ b/test/lit/passes/remove-unused-module-elements-refs.wast @@ -113,10 +113,8 @@ ) ;; CHECK: (func $target-A (type $A) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $target-A (type $A) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $target-A (type $A) ;; This function is reachable from the export "foo": there is a RefFunc and @@ -129,10 +127,8 @@ ) ;; CHECK: (func $target-A-sub (type $A-sub) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $target-A-sub (type $A-sub) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $target-A-sub (type $A-sub) ;; This function is reachable because we have a CallRef of a supertype ($A). @@ -142,7 +138,6 @@ ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $target-A-super (type $A-super) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $target-A-super (type $A-super) ;; This function is not reachable. We have a CallRef of a subtype ($A), but @@ -153,7 +148,6 @@ ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $target-B (type $B) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $target-B (type $B) ;; This function is not reachable. We have a RefFunc in "foo" but no @@ -213,10 +207,8 @@ ) ;; CHECK: (func $target-A (type $A) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $target-A (type $A) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $target-A (type $A) ;; This function is reachable. @@ -290,20 +282,16 @@ ;; WORLD_OPEN-NEXT: ) ;; CHECK: (func $target-A-1 (type $A) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $target-A-1 (type $A) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $target-A-1 (type $A) ;; This function is reachable. ) ;; CHECK: (func $target-A-2 (type $A) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $target-A-2 (type $A) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $target-A-2 (type $A) ;; This function is reachable. @@ -377,20 +365,16 @@ ) ;; CHECK: (func $target-A-1 (type $A) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $target-A-1 (type $A) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $target-A-1 (type $A) ;; This function is reachable. ) ;; CHECK: (func $target-A-2 (type $A) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $target-A-2 (type $A) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $target-A-2 (type $A) ;; This function is reachable. @@ -524,10 +508,8 @@ ) ;; CHECK: (func $target-keep (type $A) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $target-keep (type $A) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $target-keep (type $A) ) @@ -536,7 +518,6 @@ ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $target-drop (type $A) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $target-drop (type $A) ;; In a closed world we can turn this body into unreachable. @@ -617,19 +598,15 @@ ) ;; CHECK: (func $target-keep (type $A) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $target-keep (type $A) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $target-keep (type $A) ) ;; CHECK: (func $target-keep-2 (type $A) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $target-keep-2 (type $A) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $target-keep-2 (type $A) ) @@ -974,10 +951,8 @@ ) ;; CHECK: (func $void (type $void) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $void (type $void) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $void (type $void) ;; Helper function. This is reached via a call_ref. @@ -987,7 +962,6 @@ ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $a (type $void) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $a (type $void) ;; This is unreachable (in closed world) since a reference to it only exists @@ -995,10 +969,8 @@ ) ;; CHECK: (func $b (type $void) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $b (type $void) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $b (type $void) ;; This is reachable. It is in field #1, which is read, and the global @@ -1009,7 +981,6 @@ ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $c (type $void) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $c (type $void) ;; Like $a, this is unreachable. That it is in a nested struct.new, and not @@ -1017,10 +988,8 @@ ) ;; CHECK: (func $d (type $void) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $d (type $void) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $d (type $void) ;; Like $b, this is reachable. That it is in a nested struct.new, and not @@ -1031,7 +1000,6 @@ ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $e (type $void) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $e (type $void) ;; Side effects on the struct field are not enough to make this reachable: @@ -1040,10 +1008,8 @@ ) ;; CHECK: (func $f (type $void) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $f (type $void) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $f (type $void) ;; Like $b, this is reachable (the tee does not matter). @@ -1053,7 +1019,6 @@ ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $g (type $void) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $g (type $void) ;; This is in a struct written to a field that is never read in $struct, so @@ -1064,7 +1029,6 @@ ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $h (type $void) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $h (type $void) ;; This is in a struct written to a field that is never read in $struct, so @@ -1141,10 +1105,8 @@ ) ;; CHECK: (func $void (type $void) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $void (type $void) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $void (type $void) ;; Helper function. This is reached via a call_ref. @@ -1154,7 +1116,6 @@ ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $a (type $void) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $a (type $void) ;; This is unreachable (in closed world) because we have no reads from the @@ -1162,10 +1123,8 @@ ) ;; CHECK: (func $b (type $void) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $b (type $void) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $b (type $void) ;; The local.tee makes this reachable: the value is not known to only reside @@ -1503,7 +1462,6 @@ ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $f (type $void) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $f (type $void) ;; This is unreachable in closed world. The global it is in has a reference @@ -1511,20 +1469,16 @@ ) ;; CHECK: (func $subf (type $void) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $subf (type $void) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $subf (type $void) ;; There is a read of $substruct's field, which makes this reachable. ) ;; CHECK: (func $subsubf (type $void) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $subsubf (type $void) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $subsubf (type $void) ;; There is a read of $substruct's field, which may read from any subtype, @@ -1607,10 +1561,8 @@ ) ;; CHECK: (func $f1 (type $void) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $f1 (type $void) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $f1 (type $void) ;; The global containing this function's reference is used. @@ -1620,7 +1572,6 @@ ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $f2 (type $void) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $f2 (type $void) ;; This is unreachable in closed world as the global is referred to from a @@ -1727,7 +1678,6 @@ ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $f (type $void) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $f (type $void) ;; This is unreachable in closed world since $B's field is not read, so the @@ -1851,10 +1801,8 @@ ) ;; CHECK: (func $f (type $void) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $f (type $void) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $f (type $void) ) diff --git a/test/lit/passes/remove-unused-module-elements_all-features.wast b/test/lit/passes/remove-unused-module-elements_all-features.wast index 7c2ad11d801..8b4d7f18638 100644 --- a/test/lit/passes/remove-unused-module-elements_all-features.wast +++ b/test/lit/passes/remove-unused-module-elements_all-features.wast @@ -186,7 +186,6 @@ ;; CHECK: (elem $1 (i32.const 0) $f) ;; CHECK: (func $f (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $f) ) @@ -227,7 +226,6 @@ ;; CHECK: (elem $0 (i32.const 0) $waka) ;; CHECK: (func $waka (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $waka) ) @@ -459,7 +457,6 @@ ;; CHECK: (elem $0 (global.get $tableBase) $waka) ;; CHECK: (func $waka (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $waka) ;; used in table ) @@ -819,7 +816,6 @@ ) ;; CHECK: (func $internal (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $internal ) diff --git a/test/lit/passes/remove-unused-module-elements_tnh.wast b/test/lit/passes/remove-unused-module-elements_tnh.wast index 22c09740dfc..5378431912e 100644 --- a/test/lit/passes/remove-unused-module-elements_tnh.wast +++ b/test/lit/passes/remove-unused-module-elements_tnh.wast @@ -162,12 +162,10 @@ (elem $bad (i32.const 10) $func) ;; CHECK: (func $func (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; T_N_H: (type $0 (func)) ;; T_N_H: (func $func (type $0) - ;; T_N_H-NEXT: (nop) ;; T_N_H-NEXT: ) (func $func) ) @@ -190,12 +188,10 @@ (elem $bad (i32.const 9) $func $func) ;; CHECK: (func $func (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; T_N_H: (type $0 (func)) ;; T_N_H: (func $func (type $0) - ;; T_N_H-NEXT: (nop) ;; T_N_H-NEXT: ) (func $func) ) @@ -211,12 +207,10 @@ ;; CHECK: (type $0 (func)) ;; CHECK: (func $func (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; T_N_H: (type $0 (func)) ;; T_N_H: (func $func (type $0) - ;; T_N_H-NEXT: (nop) ;; T_N_H-NEXT: ) (func $func) ) diff --git a/test/lit/passes/remove-unused-names-eh-legacy.wast b/test/lit/passes/remove-unused-names-eh-legacy.wast index 729e50addb6..797dabb55cd 100644 --- a/test/lit/passes/remove-unused-names-eh-legacy.wast +++ b/test/lit/passes/remove-unused-names-eh-legacy.wast @@ -8,7 +8,6 @@ ;; CHECK: (func $func0 (type $0) ;; CHECK-NEXT: (try $label$9 ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all ;; CHECK-NEXT: (try $label$8 diff --git a/test/lit/passes/roundtrip-gc.wast b/test/lit/passes/roundtrip-gc.wast index e8c36631f06..d2c32542c58 100644 --- a/test/lit/passes/roundtrip-gc.wast +++ b/test/lit/passes/roundtrip-gc.wast @@ -32,14 +32,12 @@ ) ) ;; CHECK: (func $help (type $2) (param $3 (ref $\7bi32\7d)) (param $4 i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $help (param $3 (ref $"{i32}")) (param $4 i32) (nop) ) ;; CHECK: (func $other (type $1) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $other ) diff --git a/test/lit/passes/rse-eh-legacy.wast b/test/lit/passes/rse-eh-legacy.wast index 7cdb2bccf7f..95a1459c3ba 100644 --- a/test/lit/passes/rse-eh-legacy.wast +++ b/test/lit/passes/rse-eh-legacy.wast @@ -11,7 +11,6 @@ ;; CHECK-NEXT: (local $x i32) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all ;; CHECK-NEXT: (local.set $x @@ -47,7 +46,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (local.set $x @@ -102,7 +100,6 @@ ) ;; CHECK: (func $foo (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo) @@ -116,7 +113,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (local.set $x @@ -147,7 +143,6 @@ ;; CHECK-NEXT: (call $foo) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop @@ -235,7 +230,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop @@ -285,7 +279,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (local.set $x @@ -498,7 +491,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -560,7 +552,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (local.set $x @@ -690,7 +681,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (local.set $x @@ -754,7 +744,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -762,7 +751,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) diff --git a/test/lit/passes/rse-eh.wast b/test/lit/passes/rse-eh.wast index 100543ae980..8c26946b1ac 100644 --- a/test/lit/passes/rse-eh.wast +++ b/test/lit/passes/rse-eh.wast @@ -14,7 +14,6 @@ (tag $e-empty) ;; CHECK: (func $foo (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo) @@ -23,7 +22,6 @@ ;; CHECK-NEXT: (block $outer ;; CHECK-NEXT: (block $catch_all ;; CHECK-NEXT: (try_table (catch_all $catch_all) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (br $outer) ;; CHECK-NEXT: ) diff --git a/test/lit/passes/rse-gc.wast b/test/lit/passes/rse-gc.wast index 26a973da099..d00f6d3c434 100644 --- a/test/lit/passes/rse-gc.wast +++ b/test/lit/passes/rse-gc.wast @@ -13,7 +13,6 @@ ;; CHECK: (func $test (type $3) ;; CHECK-NEXT: (local $single (ref func)) ;; CHECK-NEXT: (local $tuple (tuple (ref any) (ref any))) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $test ;; A non-nullable local. The pass should ignore it (as we cannot optimize diff --git a/test/lit/passes/signature-pruning.wast b/test/lit/passes/signature-pruning.wast index b5c5b26e28d..6a20d281551 100644 --- a/test/lit/passes/signature-pruning.wast +++ b/test/lit/passes/signature-pruning.wast @@ -308,7 +308,6 @@ ;; CHECK-NEXT: (local $1 f32) ;; CHECK-NEXT: (local $2 i64) ;; CHECK-NEXT: (local $3 i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo (type $sig) (param $i32 i32) (param $i64 i64) (param $f32 f32) (param $f64 f64) ;; Use nothing at all: all params can be removed. @@ -394,7 +393,6 @@ ;; CHECK: (func $foo (type $sig) ;; CHECK-NEXT: (local $0 i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo (type $sig) (param $i32 i32) ;; This function does not use the parameter. It also has no calls, but that @@ -416,7 +414,6 @@ ;; CHECK: (memory $0 1 1) ;; CHECK: (func $foo (type $sig) (param $i32 i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo (type $sig) (param $i32 i32) ) @@ -431,7 +428,6 @@ ;; CHECK: (memory $0 1 1) ;; CHECK: (func $foo (type $sig) (param $i32 i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo (type $sig) (param $i32 i32) ) @@ -469,7 +465,6 @@ ;; CHECK: (func $foo (type $sig) ;; CHECK-NEXT: (local $0 i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo (type $sig) (param $i32 i32) ) @@ -505,14 +500,12 @@ ;; CHECK: (func $foo (type $sig) ;; CHECK-NEXT: (local $0 i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo (type $sig) (param $i32 i32) ) ;; CHECK: (func $bar (type $sig) ;; CHECK-NEXT: (local $0 i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $bar (type $sig) (param $i32 i32) ;; As above, but the second function also does not use the parameter, and @@ -574,7 +567,6 @@ ;; CHECK: (table $0 1 1 anyref) ;; CHECK: (func $foo (type $sig) (param $i32 i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo (type $sig) (param $i32 i32) ) @@ -593,13 +585,11 @@ ;; CHECK: (export "bar" (func $bar)) ;; CHECK: (func $foo (type $sig) (param $i32 i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo (export "foo") (type $sig) (param $i32 i32) ) ;; CHECK: (func $bar (type $sig) (param $i32 i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $bar (export "bar") (type $sig) (param $i32 i32) ) @@ -632,14 +622,12 @@ ;; CHECK: (func $foo1 (type $sig1) ;; CHECK-NEXT: (local $0 i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo1 (type $sig1) (param $i32 i32) ) ;; CHECK: (func $foo2 (type $sig2) ;; CHECK-NEXT: (local $0 f64) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo2 (type $sig2) (param $f64 f64) ) @@ -1174,13 +1162,11 @@ ;; CHECK: (export "exported" (func $exported)) ;; CHECK: (func $exported (type $none) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $exported (export "exported") (type $none) ) ;; CHECK: (func $unused-param (type $much) (param $param i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $unused-param (type $much) (param $param i32) ) @@ -1219,14 +1205,12 @@ ;; CHECK: (export "exported" (func $exported)) ;; CHECK: (func $exported (type $none) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $exported (export "exported") (type $none) ;; This makes the rec group public. ) ;; CHECK: (func $unused-param (type $much) (param $param i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $unused-param (type $much) (param $param i32) ) diff --git a/test/lit/passes/signature-refining.wast b/test/lit/passes/signature-refining.wast index f6f88940847..b401237b8a7 100644 --- a/test/lit/passes/signature-refining.wast +++ b/test/lit/passes/signature-refining.wast @@ -17,7 +17,6 @@ (type $sig (sub (func (param anyref)))) ;; CHECK: (func $func (type $sig) (param $x (ref $struct)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func (type $sig) (param $x anyref) ) @@ -49,7 +48,6 @@ ;; CHECK: (elem declare func $func) ;; CHECK: (func $func (type $sig) (param $x (ref $struct)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func (type $sig) (param $x anyref) ) @@ -85,7 +83,6 @@ ;; CHECK: (elem declare func $func) ;; CHECK: (func $func (type $sig) (param $x eqref) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func (type $sig) (param $x anyref) ) @@ -140,13 +137,11 @@ ) ;; CHECK: (func $func-1 (type $sig) (param $x (ref $struct)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func-1 (type $sig) (param $x anyref) ) ;; CHECK: (func $func-2 (type $sig) (param $x (ref $struct)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func-2 (type $sig) (param $x anyref) ) @@ -184,13 +179,11 @@ (type $struct (struct)) ;; CHECK: (func $func-1 (type $sig) (param $x (ref $struct)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func-1 (type $sig) (param $x anyref) ) ;; CHECK: (func $func-2 (type $sig) (param $x (ref $struct)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func-2 (type $sig) (param $x anyref) ) @@ -288,7 +281,6 @@ ;; CHECK: (elem declare func $func) ;; CHECK: (func $func (type $sig) (param $x (ref $struct)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func (type $sig) (param $x anyref) ) @@ -327,7 +319,6 @@ ;; CHECK: (elem declare func $func) ;; CHECK: (func $func (type $sig) (param $x anyref) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func (type $sig) (param $x anyref) ) @@ -356,7 +347,6 @@ (type $sig (sub (func (param anyref)))) ;; CHECK: (func $func (type $sig) (param $x anyref) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func (type $sig) (param $x anyref) ) @@ -381,13 +371,11 @@ ;; CHECK: (elem declare func $func-2) ;; CHECK: (func $func-1 (type $sig-1) (param $x structref) (param $y anyref) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func-1 (type $sig-1) (param $x anyref) (param $y anyref) ) ;; CHECK: (func $func-2 (type $sig-2) (param $x eqref) (param $y (ref $struct)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func-2 (type $sig-2) (param $x anyref) (param $y anyref) ) @@ -455,7 +443,6 @@ ;; CHECK: (table $0 1 1 anyref) ;; CHECK: (func $func (type $sig) (param $x anyref) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func (type $sig) (param $x anyref) ) @@ -487,7 +474,6 @@ (type $struct (struct)) ;; CHECK: (func $func (type $sig) (param $x (ref null $struct)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func (type $sig) (param $x anyref) ) @@ -692,7 +678,6 @@ ;; CHECK: (export "prevent-opts" (func $func)) ;; CHECK: (func $func (type $sig) (param $x anyref) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func (export "prevent-opts") (type $sig) (param $x anyref) ) @@ -1057,7 +1042,6 @@ ) ;; CHECK: (func $target (type $5) (param $x (ref $A)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $target (param $x (ref $A)) ;; Because of the two calls above, this cannot be refined. @@ -1109,7 +1093,6 @@ ) ;; CHECK: (func $target (type $1) (param $x (ref $B)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $target (param $x (ref $A)) ;; The two calls above both send $B, so we can refine the parameter to $B. @@ -1142,7 +1125,6 @@ (export "struct" (global $struct)) ;; CHECK: (func $func (type $sig) (param $x anyref) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func (type $sig) (param $x anyref) ) diff --git a/test/lit/passes/simplify-locals-eh-legacy.wast b/test/lit/passes/simplify-locals-eh-legacy.wast index d7fb757769c..f9ab2f8c197 100644 --- a/test/lit/passes/simplify-locals-eh-legacy.wast +++ b/test/lit/passes/simplify-locals-eh-legacy.wast @@ -5,14 +5,12 @@ ;; CHECK: (tag $e-i32 (param i32)) (tag $e-i32 (param i32)) ;; CHECK: (func $foo (type $3) (param $0 i32) (param $1 i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo (param i32 i32)) ;; CHECK: (func $pop-cannot-be-sinked (type $0) ;; CHECK-NEXT: (local $0 i32) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $e-i32 ;; CHECK-NEXT: (local.set $0 @@ -44,7 +42,6 @@ ;; CHECK-NEXT: (local $0 i32) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all ;; CHECK-NEXT: (nop) diff --git a/test/lit/passes/simplify-locals-gc.wast b/test/lit/passes/simplify-locals-gc.wast index b3f6ac2fc26..85ec16d99ca 100644 --- a/test/lit/passes/simplify-locals-gc.wast +++ b/test/lit/passes/simplify-locals-gc.wast @@ -262,7 +262,6 @@ ) ;; CHECK: (func $helper (type $8) (param $ref (ref func)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $helper (param $ref (ref func)) ) @@ -491,14 +490,12 @@ ) ;; CHECK: (func $use-nn-any (type $15) (param $nn-any (ref any)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $use-nn-any (param $nn-any (ref any)) ;; Helper function for the above. ) ;; CHECK: (func $use-any (type $7) (param $any anyref) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $use-any (param $any anyref) ;; Helper function for the above. diff --git a/test/lit/passes/simplify-locals-global.wast b/test/lit/passes/simplify-locals-global.wast index 215b32a3c25..a471225d9b8 100644 --- a/test/lit/passes/simplify-locals-global.wast +++ b/test/lit/passes/simplify-locals-global.wast @@ -45,7 +45,6 @@ ) ;; CHECK: (func $helper - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $helper) ) diff --git a/test/lit/passes/ssa.wast b/test/lit/passes/ssa.wast index 68b85360719..b082cd88884 100644 --- a/test/lit/passes/ssa.wast +++ b/test/lit/passes/ssa.wast @@ -6,7 +6,6 @@ (type $A (struct )) ;; CHECK: (func $foo (type $1) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo) diff --git a/test/lit/passes/stack-ir-roundtrip-eh-legacy.wast b/test/lit/passes/stack-ir-roundtrip-eh-legacy.wast index 0fd68f73ff1..dbaa2c6015c 100644 --- a/test/lit/passes/stack-ir-roundtrip-eh-legacy.wast +++ b/test/lit/passes/stack-ir-roundtrip-eh-legacy.wast @@ -9,7 +9,6 @@ ;; CHECK-NEXT: (do ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $tag ;; CHECK-NEXT: (drop @@ -17,7 +16,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (delegate 2) ;; CHECK-NEXT: ) diff --git a/test/lit/passes/string-lowering_types.wast b/test/lit/passes/string-lowering_types.wast index cab84a1b8c9..2274fcaf9f5 100644 --- a/test/lit/passes/string-lowering_types.wast +++ b/test/lit/passes/string-lowering_types.wast @@ -65,7 +65,6 @@ ;; CHECK: (func $export (type $4) ;; CHECK-NEXT: (local $0 (ref $private)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $export (export "export") ;; Keep the private type alive. diff --git a/test/lit/passes/translate-to-exnref.wast b/test/lit/passes/translate-to-exnref.wast index 8bac0dc39fa..388bcf8bda8 100644 --- a/test/lit/passes/translate-to-exnref.wast +++ b/test/lit/passes/translate-to-exnref.wast @@ -43,19 +43,16 @@ (tag $e-i32-i64 (param i32 i64)) ;; CHECK: (func $foo (type $1) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; STACKIR-OPT: (func $foo (type $1) ;; STACKIR-OPT-NEXT: ) (func $foo) ;; CHECK: (func $bar (type $1) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; STACKIR-OPT: (func $bar (type $1) ;; STACKIR-OPT-NEXT: ) (func $bar) ;; CHECK: (func $baz (type $1) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; STACKIR-OPT: (func $baz (type $1) ;; STACKIR-OPT-NEXT: ) @@ -1621,7 +1618,8 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; STACKIR-OPT: (func $delegate-target-outer-try-none (type $1) @@ -1678,7 +1676,8 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; STACKIR-OPT: (func $multiple-delegates-target-outer-try-none (type $1) @@ -1963,14 +1962,16 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: (br $outer1) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (br $outer3) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; STACKIR-OPT: (func $delegate-nested-more (type $1) diff --git a/test/lit/passes/type-finalizing.wast b/test/lit/passes/type-finalizing.wast index 6897c6abf82..f1511246b0b 100644 --- a/test/lit/passes/type-finalizing.wast +++ b/test/lit/passes/type-finalizing.wast @@ -78,7 +78,6 @@ ;; UNFINAL-NEXT: (local $parent (ref $parent)) ;; UNFINAL-NEXT: (local $child-final (ref $child-final)) ;; UNFINAL-NEXT: (local $child-open (ref $child-open)) - ;; UNFINAL-NEXT: (nop) ;; UNFINAL-NEXT: ) ;; DOFINAL: (type $3 (func)) @@ -86,7 +85,6 @@ ;; DOFINAL-NEXT: (local $parent (ref $parent)) ;; DOFINAL-NEXT: (local $child-final (ref $child-final)) ;; DOFINAL-NEXT: (local $child-open (ref $child-open)) - ;; DOFINAL-NEXT: (nop) ;; DOFINAL-NEXT: ) (func $keepalive (local $parent (ref $parent)) diff --git a/test/lit/passes/type-generalizing.wast b/test/lit/passes/type-generalizing.wast index 00a809648d5..66e3520056d 100644 --- a/test/lit/passes/type-generalizing.wast +++ b/test/lit/passes/type-generalizing.wast @@ -54,7 +54,6 @@ ;; CHECK-NEXT: (local $x i32) ;; CHECK-NEXT: (local $y anyref) ;; CHECK-NEXT: (local $z (tuple anyref i32)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $unconstrained ;; This non-ref local should be unmodified diff --git a/test/lit/passes/type-merging-shared.wast b/test/lit/passes/type-merging-shared.wast index fb7fa89b7a5..99b030f016a 100644 --- a/test/lit/passes/type-merging-shared.wast +++ b/test/lit/passes/type-merging-shared.wast @@ -28,7 +28,6 @@ ;; CHECK-NEXT: (local $b' (ref null $B')) ;; CHECK-NEXT: (local $c (ref null $C)) ;; CHECK-NEXT: (local $c' (ref null $C')) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo (local $a (ref null $A)) @@ -64,7 +63,6 @@ ;; CHECK-NEXT: (local $b' (ref null $B)) ;; CHECK-NEXT: (local $c (ref null $C)) ;; CHECK-NEXT: (local $c' (ref null $C)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo (local $a (ref null $A)) @@ -90,7 +88,6 @@ ;; CHECK: (func $foo (type $2) ;; CHECK-NEXT: (local $a (ref null $A)) ;; CHECK-NEXT: (local $a' (ref null $A')) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo (local $a (ref null $A)) diff --git a/test/lit/passes/type-merging.wast b/test/lit/passes/type-merging.wast index 5d0c4bc5e7b..942e15b021a 100644 --- a/test/lit/passes/type-merging.wast +++ b/test/lit/passes/type-merging.wast @@ -95,7 +95,6 @@ ;; CHECK-NEXT: (local $e (ref null $D)) ;; CHECK-NEXT: (local $f (ref null $D)) ;; CHECK-NEXT: (local $g (ref null $D)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo (local $a (ref null $A)) @@ -139,7 +138,6 @@ ;; CHECK-NEXT: (local $e (ref null $D)) ;; CHECK-NEXT: (local $f (ref null $D)) ;; CHECK-NEXT: (local $g (ref null $D)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo (local $a (ref null $A)) @@ -169,7 +167,6 @@ ;; CHECK-NEXT: (local $a (ref null $A)) ;; CHECK-NEXT: (local $b (ref null $A)) ;; CHECK-NEXT: (local $c (ref null $C)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo ;; B can be merged into A even though it refines A's field because that @@ -192,7 +189,6 @@ ;; CHECK: (func $foo (type $1) ;; CHECK-NEXT: (local $a (ref null $A)) ;; CHECK-NEXT: (local $b (ref null $A)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo ;; A recursive subtype can be merged even though its field is a refinement @@ -220,7 +216,6 @@ ;; CHECK-NEXT: (local $b (ref null $A)) ;; CHECK-NEXT: (local $x (ref null $X)) ;; CHECK-NEXT: (local $y (ref null $X)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo ;; Two mutually referential chains, A->B and X->Y, can be merged into a pair @@ -249,7 +244,6 @@ ;; CHECK-NEXT: (local $b (ref null $X)) ;; CHECK-NEXT: (local $x (ref null $X)) ;; CHECK-NEXT: (local $y (ref null $X)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo ;; As above, but now the A->B and X->Y chains are not differentiated by the @@ -278,7 +272,6 @@ ;; CHECK-NEXT: (local $b (ref null $A)) ;; CHECK-NEXT: (local $x (ref null $X)) ;; CHECK-NEXT: (local $y (ref null $X)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo ;; As above with the differentiated chains, but now the types are top-level @@ -306,7 +299,6 @@ ;; CHECK-NEXT: (local $b (ref null $X)) ;; CHECK-NEXT: (local $x (ref null $X)) ;; CHECK-NEXT: (local $y (ref null $X)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo ;; As above, but with all the types merging into a single type. @@ -429,7 +421,6 @@ ;; CHECK-NEXT: (local $l' (ref null $L)) ;; CHECK-NEXT: (local $m (ref null $M)) ;; CHECK-NEXT: (local $m' (ref null $M)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo (local $a (ref null $A)) @@ -479,7 +470,6 @@ ;; CHECK-NEXT: (local $a (ref null $A)) ;; CHECK-NEXT: (local $b (ref null $B)) ;; CHECK-NEXT: (local $c (ref null $B)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo ;; B and C cannot be merged into A because they refine A's field, but B and @@ -506,7 +496,6 @@ ;; CHECK-NEXT: (local $a (ref null $A)) ;; CHECK-NEXT: (local $b (ref null $B)) ;; CHECK-NEXT: (local $c (ref null $B)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo ;; This is the same as above, but now B and C refine A such that they have a @@ -537,7 +526,6 @@ ;; CHECK-NEXT: (local $c (ref null $A)) ;; CHECK-NEXT: (local $d (ref null $D)) ;; CHECK-NEXT: (local $e (ref null $D)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo ;; D and E should be mergeable because they have identical shapes and will @@ -587,7 +575,6 @@ ;; CHECK-NEXT: (local $c' (ref null $C)) ;; CHECK-NEXT: (local $d (ref null $D)) ;; CHECK-NEXT: (local $d' (ref null $D)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo (local $a (ref null $A)) @@ -696,7 +683,6 @@ ;; CHECK: (func $foo (type $3) ;; CHECK-NEXT: (local $a (ref null $intarray)) ;; CHECK-NEXT: (local $b (ref null $intarray)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo ;; $A will remain the same. @@ -709,7 +695,6 @@ ;; CHECK-NEXT: (local $a (ref null $refarray)) ;; CHECK-NEXT: (local $b (ref null $refarray)) ;; CHECK-NEXT: (local $c (ref null $sub-refarray-nn)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $bar (local $a (ref null $refarray)) @@ -735,7 +720,6 @@ ;; CHECK-NEXT: (local $a (ref null $func)) ;; CHECK-NEXT: (local $b (ref null $func)) ;; CHECK-NEXT: (local $c (ref null $sub-func-refined)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo ;; $func will remain the same. @@ -830,7 +814,6 @@ ;; CHECK: (func $foo (type $3) ;; CHECK-NEXT: (local $b (ref null $A')) ;; CHECK-NEXT: (local $x (ref null $X)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo (local $b (ref null $A')) diff --git a/test/lit/passes/type-refining.wast b/test/lit/passes/type-refining.wast index 8e8ccf24ccd..d045dbc1a62 100644 --- a/test/lit/passes/type-refining.wast +++ b/test/lit/passes/type-refining.wast @@ -168,7 +168,6 @@ ;; CHECK: (func $keepalive (type $4) ;; CHECK-NEXT: (local $temp (ref null $child-B)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $keepalive ;; Add a reference to $child-B just to keep it alive in the output for easier diff --git a/test/lit/string.as_wtf16.wast b/test/lit/string.as_wtf16.wast index 760f5744529..74bbc97eaff 100644 --- a/test/lit/string.as_wtf16.wast +++ b/test/lit/string.as_wtf16.wast @@ -9,13 +9,10 @@ (module ;; CHECK: (func $empty (type $2) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; RTRIP: (func $empty (type $2) - ;; RTRIP-NEXT: (nop) ;; RTRIP-NEXT: ) ;; RRTRP: (func $empty (type $2) - ;; RRTRP-NEXT: (nop) ;; RRTRP-NEXT: ) (func $empty (string.as_wtf16) diff --git a/test/lit/validation/nn-tuples.wast b/test/lit/validation/nn-tuples.wast index a673ec9003d..c3c5e4e4f63 100644 --- a/test/lit/validation/nn-tuples.wast +++ b/test/lit/validation/nn-tuples.wast @@ -8,7 +8,6 @@ (module ;; CHECK: (func $foo (type $0) ;; CHECK-NEXT: (local $tuple (tuple (ref any) (ref any))) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo (local $tuple (tuple (ref any) (ref any))) diff --git a/test/lit/wasm-split/passive.wast b/test/lit/wasm-split/passive.wast index 743d7d14e0c..d335d79a831 100644 --- a/test/lit/wasm-split/passive.wast +++ b/test/lit/wasm-split/passive.wast @@ -26,7 +26,6 @@ ;; PRIMARY: (export "table_1" (table $1)) ;; PRIMARY: (func $in-table (type $0) - ;; PRIMARY-NEXT: (nop) ;; PRIMARY-NEXT: ) (func $in-table ;; This is in a passive segment, but it is in the main module so we need no @@ -40,7 +39,6 @@ ;; SECONDARY: (elem $0 (i32.const 0) $second-in-table) ;; SECONDARY: (func $second-in-table (type $0) - ;; SECONDARY-NEXT: (nop) ;; SECONDARY-NEXT: ) (func $second-in-table ;; This is in a passive segment, and it is in the secondary module, so we will diff --git a/test/lit/wasm-split/ref.func.wast b/test/lit/wasm-split/ref.func.wast index d9a30890ac5..f97f790ff36 100644 --- a/test/lit/wasm-split/ref.func.wast +++ b/test/lit/wasm-split/ref.func.wast @@ -89,7 +89,6 @@ ) ;; PRIMARY: (func $in-table (type $0) - ;; PRIMARY-NEXT: (nop) ;; PRIMARY-NEXT: ) (func $in-table ;; This empty function is in the table. Just being present in the table is not @@ -98,7 +97,6 @@ ) ;; SECONDARY: (func $second-in-table (type $0) - ;; SECONDARY-NEXT: (nop) ;; SECONDARY-NEXT: ) (func $second-in-table ;; As above, but in the secondary module. We still don't need a trampoline diff --git a/test/lit/wat-kitchen-sink.wast b/test/lit/wat-kitchen-sink.wast index 3936354a15b..97d9f57e835 100644 --- a/test/lit/wat-kitchen-sink.wast +++ b/test/lit/wat-kitchen-sink.wast @@ -475,15 +475,12 @@ (func) ;; CHECK: (func $2 (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK: (func $f1 (type $18) (param $0 i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $f1 (param i32)) ;; CHECK: (func $f2 (type $18) (param $x i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $f2 (param $x i32)) ;; CHECK: (func $f3 (type $1) (result i32) @@ -496,12 +493,10 @@ ;; CHECK-NEXT: (local $0 i32) ;; CHECK-NEXT: (local $1 i64) ;; CHECK-NEXT: (local $l f32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $f4 (type 18) (local i32 i64) (local $l f32)) ;; CHECK: (func $"[quoted_name]" (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $"[quoted_name]") @@ -1138,10 +1133,8 @@ ;; CHECK-NEXT: (if ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: (then - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (else - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -1336,10 +1329,8 @@ ;; CHECK-NEXT: (if ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: (then - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (else - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -1507,10 +1498,8 @@ ;; CHECK-NEXT: (if ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: (then -;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (else -;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (if @@ -1518,10 +1507,8 @@ ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (then -;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (else -;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -1659,7 +1646,6 @@ ;; CHECK: (func $loop-empty (type $0) ;; CHECK-NEXT: (loop - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $loop-empty @@ -1755,7 +1741,6 @@ ;; CHECK: (func $loop-folded-empty (type $0) ;; CHECK-NEXT: (loop - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $loop-folded-empty @@ -1839,10 +1824,8 @@ ;; CHECK: (func $try-catch (type $0) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $empty - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -1898,10 +1881,8 @@ ;; CHECK: (func $try-catch_all (type $0) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -1914,16 +1895,12 @@ ;; CHECK: (func $try-catch-catch_all (type $0) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $empty - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $eimport$0 - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -1938,7 +1915,6 @@ ;; CHECK: (func $try-delegate (type $0) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (delegate 0) ;; CHECK-NEXT: ) @@ -1952,7 +1928,6 @@ ;; CHECK-NEXT: (block $l ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (delegate 1) ;; CHECK-NEXT: ) @@ -1969,7 +1944,6 @@ ;; CHECK-NEXT: (block $l ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (delegate 1) ;; CHECK-NEXT: ) @@ -1986,7 +1960,6 @@ ;; CHECK-NEXT: (block $l ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (delegate 1) ;; CHECK-NEXT: ) @@ -2004,7 +1977,6 @@ ;; CHECK-NEXT: (do ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (delegate $label) ;; CHECK-NEXT: ) @@ -2025,7 +1997,6 @@ ;; CHECK-NEXT: (do ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (delegate $l) ;; CHECK-NEXT: ) @@ -2046,7 +2017,6 @@ ;; CHECK-NEXT: (do ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (delegate $label) ;; CHECK-NEXT: ) @@ -2068,7 +2038,6 @@ ;; CHECK-NEXT: (block $l ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (delegate $label) ;; CHECK-NEXT: ) @@ -2091,7 +2060,6 @@ ;; CHECK-NEXT: (block $l0 ;; CHECK-NEXT: (try $l1 ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (delegate $l) ;; CHECK-NEXT: ) @@ -2113,12 +2081,10 @@ ;; CHECK-NEXT: (do ;; CHECK-NEXT: (try $l0 ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $empty ;; CHECK-NEXT: (try $l1 ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (delegate $l) ;; CHECK-NEXT: ) @@ -2143,12 +2109,10 @@ ;; CHECK-NEXT: (do ;; CHECK-NEXT: (try $l0 ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all ;; CHECK-NEXT: (try $l1 ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (delegate $l) ;; CHECK-NEXT: ) @@ -2262,7 +2226,6 @@ ;; CHECK: (func $try-delegate-folded (type $0) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (delegate 0) ;; CHECK-NEXT: ) @@ -2277,7 +2240,6 @@ ;; CHECK: (func $rethrow (type $0) ;; CHECK-NEXT: (try $label ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $empty ;; CHECK-NEXT: (rethrow $label) @@ -2294,7 +2256,6 @@ ;; CHECK: (func $rethrow-named (type $0) ;; CHECK-NEXT: (try $l ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $empty ;; CHECK-NEXT: (rethrow $l) @@ -2311,12 +2272,10 @@ ;; CHECK: (func $rethrow-nested (type $0) ;; CHECK-NEXT: (try $label ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $empty ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $empty ;; CHECK-NEXT: (rethrow $label) @@ -2340,12 +2299,10 @@ ;; CHECK: (func $rethrow-nested-named (type $0) ;; CHECK-NEXT: (try $l ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $empty ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $empty ;; CHECK-NEXT: (rethrow $l) @@ -2369,7 +2326,6 @@ ;; CHECK: (func $rethrow-try-nested (type $0) ;; CHECK-NEXT: (try $label ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $empty ;; CHECK-NEXT: (try @@ -2396,7 +2352,6 @@ ;; CHECK: (func $rethrow-try-nested-named (type $0) ;; CHECK-NEXT: (try $l ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $empty ;; CHECK-NEXT: (try @@ -5035,7 +4990,6 @@ ) ;; CHECK: (func $use-types (type $96) (param $0 (ref $s0)) (param $1 (ref $s1)) (param $2 (ref $s2)) (param $3 (ref $s3)) (param $4 (ref $s4)) (param $5 (ref $s5)) (param $6 (ref $s6)) (param $7 (ref $s7)) (param $8 (ref $s8)) (param $9 (ref $a0)) (param $10 (ref $a1)) (param $11 (ref $a2)) (param $12 (ref $a3)) (param $13 (ref $subvoid)) (param $14 (ref $submany)) (param $15 (ref $all-types)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $use-types (param (ref $s0)) diff --git a/test/lld/basic_safe_stack.wat.out b/test/lld/basic_safe_stack.wat.out index 7d554cc8839..b92a3048c5a 100644 --- a/test/lld/basic_safe_stack.wat.out +++ b/test/lld/basic_safe_stack.wat.out @@ -15,7 +15,6 @@ (export "main" (func $main)) (export "__set_stack_limits" (func $__set_stack_limits)) (func $__wasm_call_ctors - (nop) ) (func $stackRestore (param $0 i32) (local $1 i32) @@ -81,7 +80,6 @@ (local.get $1) ) (func $main - (nop) ) (func $__set_stack_limits (param $0 i32) (param $1 i32) (global.set $__stack_base diff --git a/test/lld/duplicate_imports.wat.out b/test/lld/duplicate_imports.wat.out index 7e49b393cc4..e2d822f0da6 100644 --- a/test/lld/duplicate_imports.wat.out +++ b/test/lld/duplicate_imports.wat.out @@ -34,7 +34,6 @@ (i32.const 0) ) (func $__wasm_call_ctors - (nop) ) (func $dynCall_ffd (param $fptr i32) (param $0 f32) (param $1 f64) (result f32) (call_indirect (type $8) diff --git a/test/lld/em_asm.wat.out b/test/lld/em_asm.wat.out index 8ed3d72ba0b..3165aa75a62 100644 --- a/test/lld/em_asm.wat.out +++ b/test/lld/em_asm.wat.out @@ -17,7 +17,6 @@ (export "__start_em_asm" (global $global$1)) (export "__stop_em_asm" (global $global$2)) (func $__wasm_call_ctors - (nop) ) (func $__original_main (result i32) (local $0 i32) diff --git a/test/lld/em_asm64.wat.out b/test/lld/em_asm64.wat.out index 33e5bb1768b..297933163e4 100644 --- a/test/lld/em_asm64.wat.out +++ b/test/lld/em_asm64.wat.out @@ -17,7 +17,6 @@ (export "__start_em_asm" (global $global$1)) (export "__stop_em_asm" (global $global$2)) (func $__wasm_call_ctors - (nop) ) (func $__original_main (result i32) (local $0 i64) diff --git a/test/lld/em_asm_O0.wat.out b/test/lld/em_asm_O0.wat.out index fb2495476eb..6635354bfb2 100644 --- a/test/lld/em_asm_O0.wat.out +++ b/test/lld/em_asm_O0.wat.out @@ -16,7 +16,6 @@ (export "__start_em_asm" (global $global$1)) (export "__stop_em_asm" (global $global$2)) (func $__wasm_call_ctors - (nop) ) (func $__original_main (result i32) (local $0 i32) diff --git a/test/lld/em_asm_main_thread.wat.out b/test/lld/em_asm_main_thread.wat.out index 5d817ca8677..8ee66c6225b 100644 --- a/test/lld/em_asm_main_thread.wat.out +++ b/test/lld/em_asm_main_thread.wat.out @@ -23,7 +23,6 @@ (export "__data_end" (global $global$2)) (export "main" (func $main)) (func $__wasm_call_ctors - (nop) ) (func $__original_main (result i32) (local $0 i32) diff --git a/test/lld/em_asm_pthread.wasm.out b/test/lld/em_asm_pthread.wasm.out index 7a497b86770..e1cbcfde4c0 100644 --- a/test/lld/em_asm_pthread.wasm.out +++ b/test/lld/em_asm_pthread.wasm.out @@ -126,7 +126,6 @@ (call $5) ) (func $1 (param $0 i32) - (nop) ) (func $2 (if @@ -12103,10 +12102,8 @@ (i32.const -1) ) (func $67 (param $0 i32) - (nop) ) (func $68 (param $0 i32) - (nop) ) (func $69 (result i32) (call $67 @@ -12412,7 +12409,6 @@ (i32.const 1) ) (func $76 (param $0 i32) - (nop) ) (func $77 (result i32) (global.get $global$0) diff --git a/test/lld/em_asm_shared.wat.out b/test/lld/em_asm_shared.wat.out index 0962d350408..5b72ac8abee 100644 --- a/test/lld/em_asm_shared.wat.out +++ b/test/lld/em_asm_shared.wat.out @@ -28,10 +28,8 @@ (export "__start_em_asm" (global $global$3)) (export "__stop_em_asm" (global $global$4)) (func $__wasm_call_ctors - (nop) ) (func $__wasm_apply_data_relocs - (nop) ) (func $__original_main (result i32) (local $0 i32) diff --git a/test/lld/hello_world.wat.out b/test/lld/hello_world.wat.out index 8081048d867..0e105c4c024 100644 --- a/test/lld/hello_world.wat.out +++ b/test/lld/hello_world.wat.out @@ -12,7 +12,6 @@ (export "__wasm_call_ctors" (func $__wasm_call_ctors)) (export "main" (func $main)) (func $__wasm_call_ctors - (nop) ) (func $__original_main (result i32) (drop diff --git a/test/lld/longjmp.wat.out b/test/lld/longjmp.wat.out index a9a5ac76394..508ded29330 100644 --- a/test/lld/longjmp.wat.out +++ b/test/lld/longjmp.wat.out @@ -25,7 +25,6 @@ (export "main" (func $main)) (export "dynCall_vii" (func $dynCall_vii)) (func $__wasm_call_ctors - (nop) ) (func $__original_main (result i32) (local $0 i32) diff --git a/test/lld/main_module_table.wat.out b/test/lld/main_module_table.wat.out index 05675c911c1..b926e05e0a6 100644 --- a/test/lld/main_module_table.wat.out +++ b/test/lld/main_module_table.wat.out @@ -6,6 +6,5 @@ (export "__stdio_write" (func $__stdio_write)) (export "__data_end" (global $global)) (func $__stdio_write - (nop) ) ) diff --git a/test/lld/main_module_table_2.wat.out b/test/lld/main_module_table_2.wat.out index de7e5542a59..819ca321639 100644 --- a/test/lld/main_module_table_2.wat.out +++ b/test/lld/main_module_table_2.wat.out @@ -7,6 +7,5 @@ (export "__stdio_write" (func $__stdio_write)) (export "__data_end" (global $global)) (func $__stdio_write - (nop) ) ) diff --git a/test/lld/main_module_table_3.wat.out b/test/lld/main_module_table_3.wat.out index 0bd9dcd2ac1..06201f383dd 100644 --- a/test/lld/main_module_table_3.wat.out +++ b/test/lld/main_module_table_3.wat.out @@ -8,6 +8,5 @@ (export "__stdio_write" (func $__stdio_write)) (export "__data_end" (global $global)) (func $__stdio_write - (nop) ) ) diff --git a/test/lld/main_module_table_4.wat.out b/test/lld/main_module_table_4.wat.out index d144e688e2d..966ac588d2c 100644 --- a/test/lld/main_module_table_4.wat.out +++ b/test/lld/main_module_table_4.wat.out @@ -9,6 +9,5 @@ (export "__stdio_write" (func $__stdio_write)) (export "__data_end" (global $global)) (func $__stdio_write - (nop) ) ) diff --git a/test/lld/main_module_table_5.wat.out b/test/lld/main_module_table_5.wat.out index 04167c9b34a..38e4be98b87 100644 --- a/test/lld/main_module_table_5.wat.out +++ b/test/lld/main_module_table_5.wat.out @@ -11,13 +11,10 @@ (export "__data_end" (global $global)) (export "dynCall_v" (func $dynCall_v)) (func $__stdio_write - (nop) ) (func $other - (nop) ) (func $stuff - (nop) ) (func $dynCall_v (param $fptr i32) (call_indirect (type $0) diff --git a/test/lld/recursive.wat.out b/test/lld/recursive.wat.out index ae7945a2aae..47035fe7a06 100644 --- a/test/lld/recursive.wat.out +++ b/test/lld/recursive.wat.out @@ -11,7 +11,6 @@ (export "__wasm_call_ctors" (func $__wasm_call_ctors)) (export "main" (func $main)) (func $__wasm_call_ctors - (nop) ) (func $foo (param $0 i32) (param $1 i32) (result i32) (local $2 i32) diff --git a/test/lld/recursive_safe_stack.wat.out b/test/lld/recursive_safe_stack.wat.out index ad30dc776aa..f042d8e1522 100644 --- a/test/lld/recursive_safe_stack.wat.out +++ b/test/lld/recursive_safe_stack.wat.out @@ -21,7 +21,6 @@ (export "main" (func $main)) (export "__set_stack_limits" (func $__set_stack_limits)) (func $__wasm_call_ctors - (nop) ) (func $foo (param $0 i32) (param $1 i32) (result i32) (local $2 i32) diff --git a/test/lld/reserved_func_ptr.wat.out b/test/lld/reserved_func_ptr.wat.out index 5239ce510bb..554d6aa0606 100644 --- a/test/lld/reserved_func_ptr.wat.out +++ b/test/lld/reserved_func_ptr.wat.out @@ -17,13 +17,10 @@ (export "__main_argc_argv" (func $main)) (export "dynCall_viii" (func $dynCall_viii)) (func $__wasm_call_ctors - (nop) ) (func $address_taken_func\28int\2c\20int\2c\20int\29 (param $0 i32) (param $1 i32) (param $2 i32) - (nop) ) (func $address_taken_func2\28int\2c\20int\2c\20int\29 (param $0 i32) (param $1 i32) (param $2 i32) - (nop) ) (func $main (param $0 i32) (param $1 i32) (result i32) (local $2 i32) diff --git a/test/lld/safe_stack_standalone-wasm.wat.out b/test/lld/safe_stack_standalone-wasm.wat.out index 63d6c09d492..2820566b3ee 100644 --- a/test/lld/safe_stack_standalone-wasm.wat.out +++ b/test/lld/safe_stack_standalone-wasm.wat.out @@ -19,7 +19,6 @@ (export "main" (func $main)) (export "__set_stack_limits" (func $__set_stack_limits)) (func $__wasm_call_ctors - (nop) ) (func $foo (param $0 i32) (param $1 i32) (result i32) (local $2 i32) diff --git a/test/lld/shared.wat.out b/test/lld/shared.wat.out index 1a496e43650..6ce5b208e86 100644 --- a/test/lld/shared.wat.out +++ b/test/lld/shared.wat.out @@ -19,7 +19,6 @@ (export "ptr_puts" (global $global$0)) (export "ptr_local_func" (global $global$1)) (func $__wasm_call_ctors - (nop) ) (func $__wasm_apply_data_relocs (i32.store diff --git a/test/lld/shared_add_to_table.wasm.out b/test/lld/shared_add_to_table.wasm.out index a3b9977847e..556c162285f 100644 --- a/test/lld/shared_add_to_table.wasm.out +++ b/test/lld/shared_add_to_table.wasm.out @@ -27,7 +27,6 @@ (call $__wasm_apply_relocs) ) (func $__wasm_apply_relocs - (nop) ) (func $waka_func_mine\28int\29 (param $0 i32) (result i32) (i32.add diff --git a/test/lld/shared_longjmp.wat.out b/test/lld/shared_longjmp.wat.out index 449714270ea..96ef571f779 100644 --- a/test/lld/shared_longjmp.wat.out +++ b/test/lld/shared_longjmp.wat.out @@ -32,10 +32,8 @@ (export "__threwValue" (global $global$1)) (export "dynCall_vii" (func $dynCall_vii)) (func $__wasm_call_ctors - (nop) ) (func $__wasm_apply_data_relocs - (nop) ) (func $_start (local $0 i32) diff --git a/test/metadce/name_collision.wast.dced b/test/metadce/name_collision.wast.dced index 50e7010dc45..6be2d6ecfab 100644 --- a/test/metadce/name_collision.wast.dced +++ b/test/metadce/name_collision.wast.dced @@ -2,6 +2,5 @@ (type $0 (func)) (export "test" (func $test)) (func $test (type $0) - (nop) ) ) diff --git a/test/metadce/outside.wast.dced b/test/metadce/outside.wast.dced index 6cc8b71d601..f5dc4e1e0b4 100644 --- a/test/metadce/outside.wast.dced +++ b/test/metadce/outside.wast.dced @@ -11,7 +11,6 @@ (elem $0 (global.get $from_segment_2) $table_func) (export "wasm_func" (func $a_wasm_func)) (func $table_func (type $0) - (nop) ) (func $a_wasm_func (type $0) (call $a_js_func) diff --git a/test/metadce/tag.wast.dced b/test/metadce/tag.wast.dced index 6f07a4e7571..f2d5cf6250b 100644 --- a/test/metadce/tag.wast.dced +++ b/test/metadce/tag.wast.dced @@ -9,7 +9,6 @@ (throw $t0) ) (catch $t1 - (nop) ) ) ) diff --git a/test/passes/duplicate-function-elimination_all-features.txt b/test/passes/duplicate-function-elimination_all-features.txt index 6867002bf0b..d46f4ed416f 100644 --- a/test/passes/duplicate-function-elimination_all-features.txt +++ b/test/passes/duplicate-function-elimination_all-features.txt @@ -16,7 +16,6 @@ (export "memory" (memory $foo)) (export "global" (global $bar)) (func $bar (type $0) - (nop) ) ) (module diff --git a/test/passes/dwarf-local-order.bin.txt b/test/passes/dwarf-local-order.bin.txt index 509db04b1d6..accf478e6a8 100644 --- a/test/passes/dwarf-local-order.bin.txt +++ b/test/passes/dwarf-local-order.bin.txt @@ -122,9 +122,9 @@ (local.get $15) ) ) - (block $label$1 - (block $label$2 - (br_if $label$2 + (block $block0 + (block $block + (br_if $block (local.get $16) ) (local.set $17 @@ -135,7 +135,7 @@ (local.set $18 (local.get $17) ) - (br $label$1) + (br $block0) ) (local.set $19 (i32.const -2147483648) @@ -340,11 +340,11 @@ ) ) ;; code offset: 0xa9 - (block $label$1 + (block $block0 ;; code offset: 0xab - (block $label$2 + (block $block ;; code offset: 0xaf - (br_if $label$2 + (br_if $block ;; code offset: 0xad (local.get $16) ) @@ -362,7 +362,7 @@ (local.get $17) ) ;; code offset: 0xba - (br $label$1) + (br $block0) ) ;; code offset: 0xc3 (local.set $19 @@ -516,9 +516,9 @@ (local.get $7) ) ) - (block $label$1 - (block $label$2 - (br_if $label$2 + (block $block0 + (block $block + (br_if $block (local.get $8) ) (local.set $9 @@ -529,7 +529,7 @@ (local.set $10 (local.get $9) ) - (br $label$1) + (br $block0) ) (local.set $11 (i32.const -2147483648) @@ -671,9 +671,9 @@ (local.get $7) ) ) - (block $label$1 - (block $label$2 - (br_if $label$2 + (block $block0 + (block $block + (br_if $block (local.get $8) ) (local.set $9 @@ -684,7 +684,7 @@ (local.set $10 (local.get $9) ) - (br $label$1) + (br $block0) ) (local.set $11 (i32.const -2147483648) diff --git a/test/passes/dwarf_with_exceptions.bin.txt b/test/passes/dwarf_with_exceptions.bin.txt index 8a70d511a33..a4e3b5e614d 100644 --- a/test/passes/dwarf_with_exceptions.bin.txt +++ b/test/passes/dwarf_with_exceptions.bin.txt @@ -20,8 +20,8 @@ ;; code offset: 0x8 (global.get $__stack_pointer) ) - ;; code offset: 0x10 - (try $label$9 + ;; code offset: 0x18 + (try (do ;; code offset: 0x12 (call $foo\28\29) @@ -45,8 +45,8 @@ (local.get $1) ) ) - ;; code offset: 0x31 - (try $label$8 + ;; code offset: 0x41 + (try $label (do ;; code offset: 0x33 (call $foo\28\29) @@ -58,8 +58,8 @@ ) ;; code offset: 0x41 (catch_all - ;; code offset: 0x42 - (try $label$7 + ;; code offset: 0x63 + (try (do ;; code offset: 0x44 (call $__cxa_end_catch) @@ -92,7 +92,7 @@ ) ) ;; code offset: 0x6c - (rethrow $label$8) + (rethrow $label) ) ) ;; code offset: 0x6f @@ -274,7 +274,7 @@ DWARF debug info Contains section .debug_info (63 bytes) Contains section .debug_abbrev (41 bytes) -Contains section .debug_line (162 bytes) +Contains section .debug_line (136 bytes) Contains section .debug_str (178 bytes) .debug_abbrev contents: @@ -326,7 +326,7 @@ Abbrev table for offset: 0x00000000 .debug_line contents: debug_line[0x00000000] Line table prologue: - total_length: 0x0000009e + total_length: 0x00000084 version: 4 prologue_length: 0x00000031 min_inst_length: 1 @@ -366,51 +366,36 @@ file_names[ 1]: 0x000000000000000e 4 5 1 0 0 is_stmt prologue_end -0x00000052: 00 DW_LNE_set_address (0x0000000000000012) -0x00000059: 03 DW_LNS_advance_line (5) -0x0000005b: 05 DW_LNS_set_column (3) -0x0000005d: 01 DW_LNS_copy - 0x0000000000000012 5 3 1 0 0 is_stmt - - -0x0000005e: 00 DW_LNE_set_address (0x000000000000001f) -0x00000065: 03 DW_LNS_advance_line (6) -0x00000067: 05 DW_LNS_set_column (5) -0x00000069: 01 DW_LNS_copy +0x00000052: 00 DW_LNE_set_address (0x000000000000001f) +0x00000059: 03 DW_LNS_advance_line (6) +0x0000005b: 01 DW_LNS_copy 0x000000000000001f 6 5 1 0 0 is_stmt -0x0000006a: 00 DW_LNE_set_address (0x000000000000003e) -0x00000071: 03 DW_LNS_advance_line (7) -0x00000073: 05 DW_LNS_set_column (3) -0x00000075: 06 DW_LNS_negate_stmt -0x00000076: 01 DW_LNS_copy +0x0000005c: 00 DW_LNE_set_address (0x000000000000003e) +0x00000063: 03 DW_LNS_advance_line (7) +0x00000065: 05 DW_LNS_set_column (3) +0x00000067: 06 DW_LNS_negate_stmt +0x00000068: 01 DW_LNS_copy 0x000000000000003e 7 3 1 0 0 -0x00000077: 00 DW_LNE_set_address (0x0000000000000041) -0x0000007e: 01 DW_LNS_copy +0x00000069: 00 DW_LNE_set_address (0x0000000000000041) +0x00000070: 01 DW_LNS_copy 0x0000000000000041 7 3 1 0 0 -0x0000007f: 00 DW_LNE_set_address (0x0000000000000044) -0x00000086: 03 DW_LNS_advance_line (8) -0x00000088: 05 DW_LNS_set_column (1) -0x0000008a: 06 DW_LNS_negate_stmt -0x0000008b: 01 DW_LNS_copy +0x00000071: 00 DW_LNE_set_address (0x0000000000000044) +0x00000078: 03 DW_LNS_advance_line (8) +0x0000007a: 05 DW_LNS_set_column (1) +0x0000007c: 06 DW_LNS_negate_stmt +0x0000007d: 01 DW_LNS_copy 0x0000000000000044 8 1 1 0 0 is_stmt -0x0000008c: 00 DW_LNE_set_address (0x0000000000000045) -0x00000093: 01 DW_LNS_copy - 0x0000000000000045 8 1 1 0 0 is_stmt - - -0x00000094: 00 DW_LNE_set_address (0x00000000ffffff64) -0x0000009b: 03 DW_LNS_advance_line (7) -0x0000009d: 05 DW_LNS_set_column (3) -0x0000009f: 00 DW_LNE_end_sequence - 0x00000000ffffff64 7 3 1 0 0 is_stmt end_sequence +0x0000007e: 00 DW_LNE_set_address (0x0000000000000045) +0x00000085: 00 DW_LNE_end_sequence + 0x0000000000000045 8 1 1 0 0 is_stmt end_sequence .debug_str contents: @@ -441,8 +426,8 @@ file_names[ 1]: ;; code offset: 0xa (global.get $__stack_pointer) ) - ;; code offset: 0xe - (try $label$9 + ;; code offset: 0x12 + (try (do ;; code offset: 0x10 (call $foo\28\29) @@ -466,8 +451,8 @@ file_names[ 1]: (local.get $1) ) ) - ;; code offset: 0x1f - (try $label$8 + ;; code offset: 0x27 + (try $label (do ;; code offset: 0x21 (call $foo\28\29) @@ -479,8 +464,8 @@ file_names[ 1]: ) ;; code offset: 0x27 (catch_all - ;; code offset: 0x28 - (try $label$7 + ;; code offset: 0x39 + (try (do ;; code offset: 0x2a (call $__cxa_end_catch) @@ -513,7 +498,7 @@ file_names[ 1]: ) ) ;; code offset: 0x3e - (rethrow $label$8) + (rethrow $label) ) ) ;; code offset: 0x41 @@ -537,7 +522,7 @@ file_names[ 1]: ) ;; custom section ".debug_info", size 63 ;; custom section ".debug_abbrev", size 41 - ;; custom section ".debug_line", size 162 + ;; custom section ".debug_line", size 136 ;; custom section ".debug_str", size 178 ;; custom section "producers", size 134 ;; features section: mutable-globals, sign-ext, exception-handling diff --git a/test/passes/fannkuch0_dwarf.bin.txt b/test/passes/fannkuch0_dwarf.bin.txt index bee23dc186c..f44a706a9fb 100644 --- a/test/passes/fannkuch0_dwarf.bin.txt +++ b/test/passes/fannkuch0_dwarf.bin.txt @@ -5658,9 +5658,9 @@ file_names[ 3]: (local.get $4) ) ;; code offset: 0x29d - (block $label$1 + (block $block ;; code offset: 0x29f - (loop $label$2 + (loop $label ;; code offset: 0x2a6 (local.set $20 ;; code offset: 0x2a3 @@ -5713,7 +5713,7 @@ file_names[ 3]: ) ) ;; code offset: 0x2cc - (br_if $label$1 + (br_if $block ;; code offset: 0x2cb (i32.eqz ;; code offset: 0x2c9 @@ -5807,8 +5807,10 @@ file_names[ 3]: (local.get $35) ) ;; code offset: 0x315 - (br $label$2) + (br $label) ) + ;; code offset: 0x318 + (unreachable) ) ;; code offset: 0x31f (local.set $36 @@ -5984,11 +5986,11 @@ file_names[ 3]: (local.get $54) ) ;; code offset: 0x3a8 - (loop $label$3 (result i32) + (loop $label6 (result i32) ;; code offset: 0x3aa - (block $label$4 + (block $block0 ;; code offset: 0x3ac - (loop $label$5 + (loop $label0 ;; code offset: 0x3b0 (local.set $55 ;; code offset: 0x3ae @@ -6038,7 +6040,7 @@ file_names[ 3]: ) ) ;; code offset: 0x3d6 - (br_if $label$4 + (br_if $block0 ;; code offset: 0x3d5 (i32.eqz ;; code offset: 0x3d3 @@ -6147,8 +6149,10 @@ file_names[ 3]: (local.get $72) ) ;; code offset: 0x42a - (br $label$5) + (br $label0) ) + ;; code offset: 0x42d + (unreachable) ) ;; code offset: 0x434 (local.set $73 @@ -6167,9 +6171,9 @@ file_names[ 3]: ) ) ;; code offset: 0x43d - (block $label$6 + (block $block1 ;; code offset: 0x442 - (br_if $label$6 + (br_if $block1 ;; code offset: 0x441 (i32.eqz ;; code offset: 0x43f @@ -6299,7 +6303,7 @@ file_names[ 3]: ) ) ;; code offset: 0x4a5 - (br_if $label$6 + (br_if $block1 ;; code offset: 0x4a4 (i32.eqz ;; code offset: 0x4a2 @@ -6319,9 +6323,9 @@ file_names[ 3]: (local.get $91) ) ;; code offset: 0x4b2 - (block $label$7 + (block $block2 ;; code offset: 0x4b4 - (loop $label$8 + (loop $label1 ;; code offset: 0x4bb (local.set $92 ;; code offset: 0x4b8 @@ -6374,7 +6378,7 @@ file_names[ 3]: ) ) ;; code offset: 0x4e1 - (br_if $label$7 + (br_if $block2 ;; code offset: 0x4e0 (i32.eqz ;; code offset: 0x4de @@ -6509,8 +6513,10 @@ file_names[ 3]: (local.get $112) ) ;; code offset: 0x54a - (br $label$8) + (br $label1) ) + ;; code offset: 0x54d + (unreachable) ) ;; code offset: 0x551 (local.set $113 @@ -6548,7 +6554,7 @@ file_names[ 3]: (local.get $115) ) ;; code offset: 0x56f - (loop $label$9 + (loop $label3 ;; code offset: 0x573 (local.set $116 ;; code offset: 0x571 @@ -6592,9 +6598,9 @@ file_names[ 3]: (local.get $119) ) ;; code offset: 0x595 - (block $label$10 + (block $block3 ;; code offset: 0x597 - (loop $label$11 + (loop $label2 ;; code offset: 0x59e (local.set $120 ;; code offset: 0x59b @@ -6647,7 +6653,7 @@ file_names[ 3]: ) ) ;; code offset: 0x5c4 - (br_if $label$10 + (br_if $block3 ;; code offset: 0x5c3 (i32.eqz ;; code offset: 0x5c1 @@ -6924,8 +6930,10 @@ file_names[ 3]: (local.get $155) ) ;; code offset: 0x6da - (br $label$11) + (br $label2) ) + ;; code offset: 0x6dd + (unreachable) ) ;; code offset: 0x6e4 (local.set $156 @@ -7093,7 +7101,7 @@ file_names[ 3]: ) ) ;; code offset: 0x78d - (br_if $label$9 + (br_if $label3 ;; code offset: 0x78a (local.get $172) ) @@ -7150,9 +7158,9 @@ file_names[ 3]: ) ) ;; code offset: 0x7c5 - (block $label$12 + (block $block4 ;; code offset: 0x7cb - (br_if $label$12 + (br_if $block4 ;; code offset: 0x7ca (i32.eqz ;; code offset: 0x7c7 @@ -7177,7 +7185,7 @@ file_names[ 3]: ) ) ;; code offset: 0x7df - (loop $label$13 + (loop $label5 ;; code offset: 0x7e6 (local.set $181 ;; code offset: 0x7e3 @@ -7245,9 +7253,9 @@ file_names[ 3]: ) ) ;; code offset: 0x825 - (block $label$14 + (block $block5 ;; code offset: 0x82b - (br_if $label$14 + (br_if $block5 ;; code offset: 0x82a (i32.eqz ;; code offset: 0x827 @@ -7363,9 +7371,9 @@ file_names[ 3]: (local.get $196) ) ;; code offset: 0x89b - (block $label$15 + (block $block6 ;; code offset: 0x89d - (loop $label$16 + (loop $label4 ;; code offset: 0x8a4 (local.set $199 ;; code offset: 0x8a1 @@ -7418,7 +7426,7 @@ file_names[ 3]: ) ) ;; code offset: 0x8d8 - (br_if $label$15 + (br_if $block6 ;; code offset: 0x8d7 (i32.eqz ;; code offset: 0x8d4 @@ -7568,8 +7576,10 @@ file_names[ 3]: (local.get $221) ) ;; code offset: 0x96c - (br $label$16) + (br $label4) ) + ;; code offset: 0x96f + (unreachable) ) ;; code offset: 0x973 (local.set $222 @@ -7739,11 +7749,11 @@ file_names[ 3]: ) ) ;; code offset: 0xa1f - (block $label$17 + (block $block8 ;; code offset: 0xa21 - (block $label$18 + (block $block7 ;; code offset: 0xa27 - (br_if $label$18 + (br_if $block7 ;; code offset: 0xa26 (i32.eqz ;; code offset: 0xa23 @@ -7751,7 +7761,7 @@ file_names[ 3]: ) ) ;; code offset: 0xa29 - (br $label$17) + (br $block8) ) ;; code offset: 0xa31 (local.set $242 @@ -7784,11 +7794,11 @@ file_names[ 3]: (local.get $244) ) ;; code offset: 0xa4b - (br $label$13) + (br $label5) ) ) ;; code offset: 0xa4f - (br $label$3) + (br $label6) ) ) (func $main (param $0 i32) (param $1 i32) (result i32) @@ -7927,11 +7937,11 @@ file_names[ 3]: ) ) ;; code offset: 0xaed - (block $label$1 + (block $block0 ;; code offset: 0xaef - (block $label$2 + (block $block ;; code offset: 0xaf4 - (br_if $label$2 + (br_if $block ;; code offset: 0xaf3 (i32.eqz ;; code offset: 0xaf1 @@ -7968,7 +7978,7 @@ file_names[ 3]: (local.get $15) ) ;; code offset: 0xb0e - (br $label$1) + (br $block0) ) ;; code offset: 0xb13 (local.set $17 @@ -8042,11 +8052,11 @@ file_names[ 3]: ) ) ;; code offset: 0xb4a - (block $label$3 + (block $block2 ;; code offset: 0xb4c - (block $label$4 + (block $block1 ;; code offset: 0xb51 - (br_if $label$4 + (br_if $block1 ;; code offset: 0xb50 (i32.eqz ;; code offset: 0xb4e @@ -8086,7 +8096,7 @@ file_names[ 3]: (local.get $28) ) ;; code offset: 0xb6e - (br $label$3) + (br $block2) ) ;; code offset: 0xb76 (local.set $29 @@ -8432,9 +8442,9 @@ file_names[ 3]: (local.get $4) ) ;; code offset: 0xd66 - (block $label$1 + (block $block ;; code offset: 0xd68 - (loop $label$2 + (loop $label ;; code offset: 0xd6f (local.set $6 ;; code offset: 0xd6c @@ -8502,7 +8512,7 @@ file_names[ 3]: ) ) ;; code offset: 0xda0 - (br_if $label$1 + (br_if $block ;; code offset: 0xd9f (i32.eqz ;; code offset: 0xd9d @@ -8644,8 +8654,10 @@ file_names[ 3]: (local.get $26) ) ;; code offset: 0xe19 - (br $label$2) + (br $label) ) + ;; code offset: 0xe1c + (unreachable) ) ;; code offset: 0xe20 (local.set $27 @@ -8736,9 +8748,9 @@ file_names[ 3]: (local.get $27) ) ;; code offset: 0xe67 - (block $label$3 + (block $block0 ;; code offset: 0xe69 - (loop $label$4 + (loop $label0 ;; code offset: 0xe70 (local.set $36 ;; code offset: 0xe6d @@ -8791,7 +8803,7 @@ file_names[ 3]: ) ) ;; code offset: 0xe96 - (br_if $label$3 + (br_if $block0 ;; code offset: 0xe95 (i32.eqz ;; code offset: 0xe93 @@ -8885,8 +8897,10 @@ file_names[ 3]: (local.get $51) ) ;; code offset: 0xedf - (br $label$4) + (br $label0) ) + ;; code offset: 0xee2 + (unreachable) ) ;; code offset: 0xee9 (local.set $52 @@ -8904,9 +8918,9 @@ file_names[ 3]: (local.get $52) ) ;; code offset: 0xef2 - (block $label$5 + (block $block4 ;; code offset: 0xef4 - (loop $label$6 + (loop $label5 ;; code offset: 0xefb (local.set $53 ;; code offset: 0xef8 @@ -8916,11 +8930,11 @@ file_names[ 3]: ) ) ;; code offset: 0xefd - (block $label$7 + (block $block3 ;; code offset: 0xeff - (block $label$8 + (block $block1 ;; code offset: 0xf04 - (br_if $label$8 + (br_if $block1 ;; code offset: 0xf03 (i32.eqz ;; code offset: 0xf01 @@ -8940,9 +8954,9 @@ file_names[ 3]: (local.get $54) ) ;; code offset: 0xf11 - (block $label$9 + (block $block2 ;; code offset: 0xf13 - (loop $label$10 + (loop $label1 ;; code offset: 0xf1a (local.set $55 ;; code offset: 0xf17 @@ -8995,7 +9009,7 @@ file_names[ 3]: ) ) ;; code offset: 0xf40 - (br_if $label$9 + (br_if $block2 ;; code offset: 0xf3f (i32.eqz ;; code offset: 0xf3d @@ -9119,8 +9133,10 @@ file_names[ 3]: (local.get $73) ) ;; code offset: 0xfa0 - (br $label$10) + (br $label1) ) + ;; code offset: 0xfa3 + (unreachable) ) ;; code offset: 0xfa8 (local.set $74 @@ -9173,15 +9189,15 @@ file_names[ 3]: (local.get $78) ) ;; code offset: 0xfce - (br $label$7) + (br $block3) ) ;; code offset: 0xfd1 - (br $label$5) + (br $block4) ) ;; code offset: 0xfd4 - (block $label$11 + (block $block5 ;; code offset: 0xfd6 - (loop $label$12 + (loop $label2 ;; code offset: 0xfda (local.set $79 ;; code offset: 0xfd8 @@ -9231,7 +9247,7 @@ file_names[ 3]: ) ) ;; code offset: 0x1000 - (br_if $label$11 + (br_if $block5 ;; code offset: 0xfff (i32.eqz ;; code offset: 0xffd @@ -9340,11 +9356,13 @@ file_names[ 3]: (local.get $96) ) ;; code offset: 0x1054 - (br $label$12) + (br $label2) ) + ;; code offset: 0x1057 + (unreachable) ) ;; code offset: 0x1059 - (loop $label$13 + (loop $label4 ;; code offset: 0x1060 (local.set $97 ;; code offset: 0x105d @@ -9397,9 +9415,9 @@ file_names[ 3]: ) ) ;; code offset: 0x1083 - (block $label$14 + (block $block6 ;; code offset: 0x1088 - (br_if $label$14 + (br_if $block6 ;; code offset: 0x1087 (i32.eqz ;; code offset: 0x1085 @@ -9407,7 +9425,7 @@ file_names[ 3]: ) ) ;; code offset: 0x108a - (br $label$5) + (br $block4) ) ;; code offset: 0x108f (local.set $104 @@ -9445,9 +9463,9 @@ file_names[ 3]: (local.get $104) ) ;; code offset: 0x10ad - (block $label$15 + (block $block7 ;; code offset: 0x10af - (loop $label$16 + (loop $label3 ;; code offset: 0x10b6 (local.set $107 ;; code offset: 0x10b3 @@ -9500,7 +9518,7 @@ file_names[ 3]: ) ) ;; code offset: 0x10dc - (br_if $label$15 + (br_if $block7 ;; code offset: 0x10db (i32.eqz ;; code offset: 0x10d9 @@ -9650,8 +9668,10 @@ file_names[ 3]: (local.get $129) ) ;; code offset: 0x1154 - (br $label$16) + (br $label3) ) + ;; code offset: 0x1157 + (unreachable) ) ;; code offset: 0x115b (local.set $130 @@ -9821,11 +9841,11 @@ file_names[ 3]: ) ) ;; code offset: 0x1207 - (block $label$17 + (block $block9 ;; code offset: 0x1209 - (block $label$18 + (block $block8 ;; code offset: 0x120f - (br_if $label$18 + (br_if $block8 ;; code offset: 0x120e (i32.eqz ;; code offset: 0x120b @@ -9833,7 +9853,7 @@ file_names[ 3]: ) ) ;; code offset: 0x1211 - (br $label$17) + (br $block9) ) ;; code offset: 0x1219 (local.set $150 @@ -9866,12 +9886,14 @@ file_names[ 3]: (local.get $152) ) ;; code offset: 0x1233 - (br $label$13) + (br $label4) ) ) ;; code offset: 0x1237 - (br $label$6) + (br $label5) ) + ;; code offset: 0x123a + (unreachable) ) ;; code offset: 0x123e (local.set $153 @@ -9912,9 +9934,9 @@ file_names[ 3]: (local.get $153) ) ;; code offset: 0x1263 - (block $label$19 + (block $block10 ;; code offset: 0x1265 - (loop $label$20 + (loop $label6 ;; code offset: 0x1269 (local.set $156 ;; code offset: 0x1267 @@ -9964,7 +9986,7 @@ file_names[ 3]: ) ) ;; code offset: 0x129d - (br_if $label$19 + (br_if $block10 ;; code offset: 0x129c (i32.eqz ;; code offset: 0x1299 @@ -10046,9 +10068,9 @@ file_names[ 3]: ) ) ;; code offset: 0x12ec - (block $label$21 + (block $block11 ;; code offset: 0x12f2 - (br_if $label$21 + (br_if $block11 ;; code offset: 0x12f1 (i32.eqz ;; code offset: 0x12ee @@ -10123,8 +10145,10 @@ file_names[ 3]: (local.get $176) ) ;; code offset: 0x133b - (br $label$20) + (br $label6) ) + ;; code offset: 0x133e + (unreachable) ) ;; code offset: 0x1345 (local.set $177 diff --git a/test/passes/fannkuch3_dwarf.bin.txt b/test/passes/fannkuch3_dwarf.bin.txt index 74b6446a5f3..2917c4e781a 100644 --- a/test/passes/fannkuch3_dwarf.bin.txt +++ b/test/passes/fannkuch3_dwarf.bin.txt @@ -4873,13 +4873,13 @@ file_names[ 4]: ) ) ;; code offset: 0x47 - (block $label$1 + (block $block4 ;; code offset: 0x49 - (block $label$2 + (block $block0 ;; code offset: 0x4b - (block $label$3 + (block $block ;; code offset: 0x52 - (br_if $label$3 + (br_if $block ;; code offset: 0x51 (i32.le_s ;; code offset: 0x4d @@ -4889,7 +4889,7 @@ file_names[ 4]: ) ) ;; code offset: 0x54 - (loop $label$4 + (loop $label ;; code offset: 0x60 (i32.store ;; code offset: 0x5d @@ -4908,7 +4908,7 @@ file_names[ 4]: (local.get $1) ) ;; code offset: 0x6d - (br_if $label$4 + (br_if $label ;; code offset: 0x6c (i32.ne ;; code offset: 0x68 @@ -4983,7 +4983,7 @@ file_names[ 4]: (i32.const 0) ) ;; code offset: 0x9f - (br_if $label$2 + (br_if $block0 ;; code offset: 0x9e (i32.le_s ;; code offset: 0x9a @@ -4993,11 +4993,11 @@ file_names[ 4]: ) ) ;; code offset: 0xa1 - (loop $label$5 + (loop $label4 ;; code offset: 0xa3 - (block $label$6 + (block $block1 ;; code offset: 0xaa - (br_if $label$6 + (br_if $block1 ;; code offset: 0xa9 (i32.le_s ;; code offset: 0xa5 @@ -5007,7 +5007,7 @@ file_names[ 4]: ) ) ;; code offset: 0xac - (loop $label$7 + (loop $label0 ;; code offset: 0xbd (i32.store ;; code offset: 0xba @@ -5049,16 +5049,16 @@ file_names[ 4]: (local.get $1) ) ;; code offset: 0xcd - (br_if $label$7 + (br_if $label0 ;; code offset: 0xcb (local.get $0) ) ) ) ;; code offset: 0xd1 - (block $label$8 + (block $block2 ;; code offset: 0xdb - (br_if $label$8 + (br_if $block2 ;; code offset: 0xda (i32.eqz ;; code offset: 0xd8 @@ -5072,7 +5072,7 @@ file_names[ 4]: ) ) ;; code offset: 0xe5 - (br_if $label$8 + (br_if $block2 ;; code offset: 0xe4 (i32.eq ;; code offset: 0xdf @@ -5108,16 +5108,16 @@ file_names[ 4]: (i32.const 0) ) ;; code offset: 0xfa - (loop $label$9 + (loop $label2 ;; code offset: 0xfe (local.set $13 ;; code offset: 0xfc (local.get $0) ) ;; code offset: 0x100 - (block $label$10 + (block $block3 ;; code offset: 0x107 - (br_if $label$10 + (br_if $block3 ;; code offset: 0x106 (i32.lt_s ;; code offset: 0x102 @@ -5142,7 +5142,7 @@ file_names[ 4]: (i32.const 1) ) ;; code offset: 0x114 - (loop $label$11 + (loop $label1 ;; code offset: 0x123 (local.set $15 ;; code offset: 0x120 @@ -5195,7 +5195,7 @@ file_names[ 4]: (local.get $15) ) ;; code offset: 0x14d - (br_if $label$11 + (br_if $label1 ;; code offset: 0x14c (i32.lt_s ;; code offset: 0x143 @@ -5266,7 +5266,7 @@ file_names[ 4]: (local.get $1) ) ;; code offset: 0x174 - (br_if $label$9 + (br_if $label2 ;; code offset: 0x172 (local.get $1) ) @@ -5290,7 +5290,7 @@ file_names[ 4]: ) ) ;; code offset: 0x189 - (br_if $label$1 + (br_if $block4 ;; code offset: 0x188 (i32.ge_s ;; code offset: 0x184 @@ -5300,16 +5300,16 @@ file_names[ 4]: ) ) ;; code offset: 0x18b - (loop $label$12 + (loop $label5 ;; code offset: 0x18f (local.set $1 ;; code offset: 0x18d (i32.const 0) ) ;; code offset: 0x191 - (block $label$13 + (block $block5 ;; code offset: 0x198 - (br_if $label$13 + (br_if $block5 ;; code offset: 0x197 (i32.le_s ;; code offset: 0x193 @@ -5319,7 +5319,7 @@ file_names[ 4]: ) ) ;; code offset: 0x19a - (loop $label$14 + (loop $label3 ;; code offset: 0x1b4 (i32.store ;; code offset: 0x1a3 @@ -5359,7 +5359,7 @@ file_names[ 4]: ) ) ;; code offset: 0x1bc - (br_if $label$14 + (br_if $label3 ;; code offset: 0x1bb (i32.ne ;; code offset: 0x1b7 @@ -5424,7 +5424,7 @@ file_names[ 4]: ) ) ;; code offset: 0x1ed - (br_if $label$5 + (br_if $label4 ;; code offset: 0x1ec (i32.gt_s ;; code offset: 0x1e8 @@ -5434,7 +5434,7 @@ file_names[ 4]: ) ) ;; code offset: 0x1f9 - (br_if $label$1 + (br_if $block4 ;; code offset: 0x1f8 (i32.eq ;; code offset: 0x1f4 @@ -5460,9 +5460,13 @@ file_names[ 4]: ) ) ;; code offset: 0x202 - (br $label$12) + (br $label5) ) + ;; code offset: 0x205 + (unreachable) ) + ;; code offset: 0x207 + (unreachable) ) ;; code offset: 0x21d (i32.store @@ -5522,11 +5526,11 @@ file_names[ 4]: (i32.const 0) ) ;; code offset: 0x234 - (loop $label$15 + (loop $label10 ;; code offset: 0x236 - (block $label$16 + (block $block6 ;; code offset: 0x23d - (br_if $label$16 + (br_if $block6 ;; code offset: 0x23c (i32.lt_s ;; code offset: 0x238 @@ -5536,7 +5540,7 @@ file_names[ 4]: ) ) ;; code offset: 0x23f - (loop $label$17 + (loop $label6 ;; code offset: 0x250 (i32.store ;; code offset: 0x24d @@ -5578,16 +5582,16 @@ file_names[ 4]: (local.get $1) ) ;; code offset: 0x260 - (br_if $label$17 + (br_if $label6 ;; code offset: 0x25e (local.get $0) ) ) ) ;; code offset: 0x264 - (block $label$18 + (block $block7 ;; code offset: 0x26e - (br_if $label$18 + (br_if $block7 ;; code offset: 0x26d (i32.eqz ;; code offset: 0x26b @@ -5601,7 +5605,7 @@ file_names[ 4]: ) ) ;; code offset: 0x278 - (br_if $label$18 + (br_if $block7 ;; code offset: 0x277 (i32.eq ;; code offset: 0x272 @@ -5627,16 +5631,16 @@ file_names[ 4]: (i32.const 0) ) ;; code offset: 0x285 - (loop $label$19 + (loop $label8 ;; code offset: 0x289 (local.set $10 ;; code offset: 0x287 (local.get $0) ) ;; code offset: 0x28b - (block $label$20 + (block $block8 ;; code offset: 0x292 - (br_if $label$20 + (br_if $block8 ;; code offset: 0x291 (i32.lt_s ;; code offset: 0x28d @@ -5661,7 +5665,7 @@ file_names[ 4]: (i32.const 1) ) ;; code offset: 0x29f - (loop $label$21 + (loop $label7 ;; code offset: 0x2ae (local.set $14 ;; code offset: 0x2ab @@ -5714,7 +5718,7 @@ file_names[ 4]: (local.get $14) ) ;; code offset: 0x2d8 - (br_if $label$21 + (br_if $label7 ;; code offset: 0x2d7 (i32.lt_s ;; code offset: 0x2ce @@ -5785,7 +5789,7 @@ file_names[ 4]: (local.get $1) ) ;; code offset: 0x2ff - (br_if $label$19 + (br_if $label8 ;; code offset: 0x2fd (local.get $1) ) @@ -5809,7 +5813,7 @@ file_names[ 4]: ) ) ;; code offset: 0x314 - (br_if $label$1 + (br_if $block4 ;; code offset: 0x313 (i32.ge_s ;; code offset: 0x30f @@ -5819,16 +5823,16 @@ file_names[ 4]: ) ) ;; code offset: 0x316 - (loop $label$22 + (loop $label11 ;; code offset: 0x31a (local.set $1 ;; code offset: 0x318 (i32.const 0) ) ;; code offset: 0x31c - (block $label$23 + (block $block9 ;; code offset: 0x323 - (br_if $label$23 + (br_if $block9 ;; code offset: 0x322 (i32.lt_s ;; code offset: 0x31e @@ -5838,7 +5842,7 @@ file_names[ 4]: ) ) ;; code offset: 0x325 - (loop $label$24 + (loop $label9 ;; code offset: 0x33f (i32.store ;; code offset: 0x32e @@ -5878,7 +5882,7 @@ file_names[ 4]: ) ) ;; code offset: 0x347 - (br_if $label$24 + (br_if $label9 ;; code offset: 0x346 (i32.ne ;; code offset: 0x342 @@ -5943,7 +5947,7 @@ file_names[ 4]: ) ) ;; code offset: 0x378 - (br_if $label$15 + (br_if $label10 ;; code offset: 0x377 (i32.gt_s ;; code offset: 0x373 @@ -5953,7 +5957,7 @@ file_names[ 4]: ) ) ;; code offset: 0x384 - (br_if $label$1 + (br_if $block4 ;; code offset: 0x383 (i32.eq ;; code offset: 0x37f @@ -5979,9 +5983,13 @@ file_names[ 4]: ) ) ;; code offset: 0x38d - (br $label$22) + (br $label11) ) + ;; code offset: 0x390 + (unreachable) ) + ;; code offset: 0x392 + (unreachable) ) ;; code offset: 0x396 (call $free @@ -6023,13 +6031,13 @@ file_names[ 4]: ) ) ;; code offset: 0x3bd - (block $label$1 + (block $block1 ;; code offset: 0x3bf - (block $label$2 + (block $block0 ;; code offset: 0x3c1 - (block $label$3 + (block $block ;; code offset: 0x3c8 - (br_if $label$3 + (br_if $block ;; code offset: 0x3c7 (i32.lt_s ;; code offset: 0x3c3 @@ -6044,7 +6052,7 @@ file_names[ 4]: (i32.const 0) ) ;; code offset: 0x3da - (br_if $label$2 + (br_if $block0 ;; code offset: 0x3d9 (i32.gt_s ;; code offset: 0x3d5 @@ -6077,12 +6085,12 @@ file_names[ 4]: (i32.const 1) ) ;; code offset: 0x3e7 - (br $label$1) + (br $block1) ) ;; code offset: 0x3ea - (block $label$4 + (block $block2 ;; code offset: 0x3f1 - (br_if $label$4 + (br_if $block2 ;; code offset: 0x3f0 (i32.eq ;; code offset: 0x3ec @@ -6112,7 +6120,7 @@ file_names[ 4]: (i32.const 0) ) ;; code offset: 0x402 - (loop $label$5 + (loop $label ;; code offset: 0x40c (i32.store offset=8 ;; code offset: 0x408 @@ -6146,7 +6154,7 @@ file_names[ 4]: (local.get $3) ) ;; code offset: 0x42b - (br_if $label$5 + (br_if $label ;; code offset: 0x42a (i32.ne ;; code offset: 0x426 @@ -6195,15 +6203,15 @@ file_names[ 4]: ) ) ;; code offset: 0x444 - (block $label$6 + (block $block7 ;; code offset: 0x446 - (block $label$7 + (block $block5 ;; code offset: 0x448 - (block $label$8 + (block $block4 ;; code offset: 0x44a - (block $label$9 + (block $block3 ;; code offset: 0x451 - (br_if $label$9 + (br_if $block3 ;; code offset: 0x450 (i32.le_s ;; code offset: 0x44c @@ -6213,7 +6221,7 @@ file_names[ 4]: ) ) ;; code offset: 0x453 - (loop $label$10 + (loop $label0 ;; code offset: 0x45f (i32.store ;; code offset: 0x45c @@ -6232,7 +6240,7 @@ file_names[ 4]: (local.get $0) ) ;; code offset: 0x46c - (br_if $label$10 + (br_if $label0 ;; code offset: 0x46b (i32.ne ;; code offset: 0x467 @@ -6261,7 +6269,7 @@ file_names[ 4]: (local.get $4) ) ;; code offset: 0x477 - (br $label$8) + (br $block4) ) ;; code offset: 0x47c (local.set $7 @@ -6274,17 +6282,17 @@ file_names[ 4]: (local.get $4) ) ;; code offset: 0x482 - (br $label$7) + (br $block5) ) ;; code offset: 0x485 - (loop $label$11 + (loop $label5 ;; code offset: 0x489 (local.set $0 ;; code offset: 0x487 (i32.const 0) ) ;; code offset: 0x48b - (loop $label$12 + (loop $label1 ;; code offset: 0x49d (i32.store offset=16 ;; code offset: 0x48d @@ -6326,7 +6334,7 @@ file_names[ 4]: ) ) ;; code offset: 0x4b5 - (br_if $label$12 + (br_if $label1 ;; code offset: 0x4b4 (i32.ne ;; code offset: 0x4b0 @@ -6353,9 +6361,9 @@ file_names[ 4]: ) ) ;; code offset: 0x4bd - (block $label$13 + (block $block6 ;; code offset: 0x4c4 - (br_if $label$13 + (br_if $block6 ;; code offset: 0x4c3 (i32.le_s ;; code offset: 0x4bf @@ -6365,7 +6373,7 @@ file_names[ 4]: ) ) ;; code offset: 0x4c6 - (loop $label$14 + (loop $label2 ;; code offset: 0x4d7 (i32.store ;; code offset: 0x4d4 @@ -6407,14 +6415,14 @@ file_names[ 4]: (local.get $0) ) ;; code offset: 0x4e7 - (br_if $label$14 + (br_if $label2 ;; code offset: 0x4e5 (local.get $8) ) ) ) ;; code offset: 0x4f0 - (br_if $label$6 + (br_if $block7 ;; code offset: 0x4ef (i32.eq ;; code offset: 0x4eb @@ -6434,7 +6442,7 @@ file_names[ 4]: ) ) ;; code offset: 0x4f9 - (loop $label$15 + (loop $label4 ;; code offset: 0x4fd (local.set $0 ;; code offset: 0x4fb @@ -6449,9 +6457,9 @@ file_names[ 4]: ) ) ;; code offset: 0x506 - (block $label$16 + (block $block8 ;; code offset: 0x50d - (br_if $label$16 + (br_if $block8 ;; code offset: 0x50c (i32.le_s ;; code offset: 0x508 @@ -6461,7 +6469,7 @@ file_names[ 4]: ) ) ;; code offset: 0x50f - (loop $label$17 + (loop $label3 ;; code offset: 0x529 (i32.store ;; code offset: 0x518 @@ -6501,7 +6509,7 @@ file_names[ 4]: ) ) ;; code offset: 0x531 - (br_if $label$17 + (br_if $label3 ;; code offset: 0x530 (i32.ne ;; code offset: 0x52c @@ -6566,9 +6574,9 @@ file_names[ 4]: ) ) ;; code offset: 0x55d - (block $label$18 + (block $block9 ;; code offset: 0x564 - (br_if $label$18 + (br_if $block9 ;; code offset: 0x563 (i32.gt_s ;; code offset: 0x55f @@ -6578,7 +6586,7 @@ file_names[ 4]: ) ) ;; code offset: 0x570 - (br_if $label$15 + (br_if $label4 ;; code offset: 0x56f (i32.ne ;; code offset: 0x56b @@ -6596,11 +6604,11 @@ file_names[ 4]: ) ) ;; code offset: 0x572 - (br $label$6) + (br $block7) ) ) ;; code offset: 0x579 - (br_if $label$6 + (br_if $block7 ;; code offset: 0x578 (i32.eqz ;; code offset: 0x576 @@ -6608,11 +6616,13 @@ file_names[ 4]: ) ) ;; code offset: 0x57b - (br $label$11) + (br $label5) ) + ;; code offset: 0x57e + (unreachable) ) ;; code offset: 0x580 - (loop $label$19 + (loop $label9 ;; code offset: 0x586 (drop ;; code offset: 0x584 @@ -6622,9 +6632,9 @@ file_names[ 4]: ) ) ;; code offset: 0x587 - (block $label$20 + (block $block10 ;; code offset: 0x58e - (br_if $label$20 + (br_if $block10 ;; code offset: 0x58d (i32.le_s ;; code offset: 0x589 @@ -6634,7 +6644,7 @@ file_names[ 4]: ) ) ;; code offset: 0x590 - (loop $label$21 + (loop $label6 ;; code offset: 0x5a1 (i32.store ;; code offset: 0x59e @@ -6676,14 +6686,14 @@ file_names[ 4]: (local.get $0) ) ;; code offset: 0x5b1 - (br_if $label$21 + (br_if $label6 ;; code offset: 0x5af (local.get $8) ) ) ) ;; code offset: 0x5ba - (br_if $label$6 + (br_if $block7 ;; code offset: 0x5b9 (i32.eq ;; code offset: 0x5b5 @@ -6703,7 +6713,7 @@ file_names[ 4]: ) ) ;; code offset: 0x5c3 - (loop $label$22 + (loop $label8 ;; code offset: 0x5ca (local.set $8 ;; code offset: 0x5c7 @@ -6718,9 +6728,9 @@ file_names[ 4]: (i32.const 0) ) ;; code offset: 0x5d0 - (block $label$23 + (block $block11 ;; code offset: 0x5d7 - (br_if $label$23 + (br_if $block11 ;; code offset: 0x5d6 (i32.lt_s ;; code offset: 0x5d2 @@ -6730,7 +6740,7 @@ file_names[ 4]: ) ) ;; code offset: 0x5d9 - (loop $label$24 + (loop $label7 ;; code offset: 0x5f3 (i32.store ;; code offset: 0x5e2 @@ -6770,7 +6780,7 @@ file_names[ 4]: ) ) ;; code offset: 0x5fb - (br_if $label$24 + (br_if $label7 ;; code offset: 0x5fa (i32.ne ;; code offset: 0x5f6 @@ -6835,9 +6845,9 @@ file_names[ 4]: ) ) ;; code offset: 0x627 - (block $label$25 + (block $block12 ;; code offset: 0x62e - (br_if $label$25 + (br_if $block12 ;; code offset: 0x62d (i32.gt_s ;; code offset: 0x629 @@ -6847,7 +6857,7 @@ file_names[ 4]: ) ) ;; code offset: 0x63a - (br_if $label$22 + (br_if $label8 ;; code offset: 0x639 (i32.ne ;; code offset: 0x635 @@ -6865,11 +6875,11 @@ file_names[ 4]: ) ) ;; code offset: 0x63c - (br $label$6) + (br $block7) ) ) ;; code offset: 0x642 - (br_if $label$19 + (br_if $label9 ;; code offset: 0x640 (local.get $7) ) @@ -6896,9 +6906,9 @@ file_names[ 4]: (i32.const 0) ) ;; code offset: 0x656 - (block $label$26 + (block $block13 ;; code offset: 0x65b - (br_if $label$26 + (br_if $block13 ;; code offset: 0x65a (i32.eqz ;; code offset: 0x658 @@ -6911,7 +6921,7 @@ file_names[ 4]: (i32.const 0) ) ;; code offset: 0x661 - (loop $label$27 + (loop $label10 ;; code offset: 0x667 (local.set $1 ;; code offset: 0x665 @@ -6956,7 +6966,7 @@ file_names[ 4]: (local.get $6) ) ;; code offset: 0x686 - (br_if $label$27 + (br_if $label10 ;; code offset: 0x684 (local.get $6) ) diff --git a/test/passes/fannkuch3_manyopts_dwarf.bin.txt b/test/passes/fannkuch3_manyopts_dwarf.bin.txt index 3ffb81efeaf..8c57326f569 100644 --- a/test/passes/fannkuch3_manyopts_dwarf.bin.txt +++ b/test/passes/fannkuch3_manyopts_dwarf.bin.txt @@ -4710,8 +4710,8 @@ file_names[ 4]: (local $14 i32) (local $15 i32) (local $16 i32) - (local $17 i32) - (local $18 i32) + (local $scratch i32) + (local $scratch_18 i32) ;; code offset: 0x35 (local.set $3 ;; code offset: 0x33 @@ -4751,9 +4751,9 @@ file_names[ 4]: ) ) ;; code offset: 0x43 - (block $label$1 + (block $block1 ;; code offset: 0x45 - (block $label$2 + (block $block ;; code offset: 0x4c (if ;; code offset: 0x4b @@ -4765,7 +4765,7 @@ file_names[ 4]: ) (then ;; code offset: 0x4e - (loop $label$4 + (loop $label ;; code offset: 0x5a (i32.store ;; code offset: 0x57 @@ -4784,7 +4784,7 @@ file_names[ 4]: (local.get $1) ) ;; code offset: 0x67 - (br_if $label$4 + (br_if $label ;; code offset: 0x66 (i32.ne ;; code offset: 0x62 @@ -4854,7 +4854,7 @@ file_names[ 4]: (local.get $1) ) ;; code offset: 0x95 - (br_if $label$2 + (br_if $block ;; code offset: 0x94 (i32.le_s ;; code offset: 0x90 @@ -4864,7 +4864,7 @@ file_names[ 4]: ) ) ;; code offset: 0x97 - (loop $label$5 + (loop $label4 ;; code offset: 0x9e (if ;; code offset: 0x9d @@ -4876,7 +4876,7 @@ file_names[ 4]: ) (then ;; code offset: 0xa0 - (loop $label$7 + (loop $label0 ;; code offset: 0xb1 (i32.store ;; code offset: 0xae @@ -4902,10 +4902,9 @@ file_names[ 4]: ;; code offset: 0xaf (local.get $2) ) - ;; code offset: 0xbd - (br_if $label$7 + (br_if $label0 (block (result i32) - (local.set $17 + (local.set $scratch ;; code offset: 0xb8 (i32.gt_s ;; code offset: 0xb4 @@ -4919,16 +4918,17 @@ file_names[ 4]: ;; code offset: 0xb9 (local.get $1) ) - (local.get $17) + ;; code offset: 0xbd + (local.get $scratch) ) ) ) ) ) ;; code offset: 0xc1 - (block $label$8 + (block $block0 ;; code offset: 0xcb - (br_if $label$8 + (br_if $block0 ;; code offset: 0xca (i32.eqz ;; code offset: 0xc8 @@ -4942,7 +4942,7 @@ file_names[ 4]: ) ) ;; code offset: 0xd5 - (br_if $label$8 + (br_if $block0 ;; code offset: 0xd4 (i32.eq ;; code offset: 0xcf @@ -4978,7 +4978,7 @@ file_names[ 4]: (i32.const 0) ) ;; code offset: 0xea - (loop $label$9 + (loop $label2 ;; code offset: 0xee (local.set $16 ;; code offset: 0xec @@ -5010,7 +5010,7 @@ file_names[ 4]: (i32.const 1) ) ;; code offset: 0x102 - (loop $label$11 + (loop $label1 ;; code offset: 0x111 (local.set $15 ;; code offset: 0x10e @@ -5063,7 +5063,7 @@ file_names[ 4]: (local.get $15) ) ;; code offset: 0x13b - (br_if $label$11 + (br_if $label1 ;; code offset: 0x13a (i32.lt_s ;; code offset: 0x131 @@ -5135,7 +5135,7 @@ file_names[ 4]: (local.get $1) ) ;; code offset: 0x162 - (br_if $label$9 + (br_if $label2 ;; code offset: 0x160 (local.get $1) ) @@ -5159,7 +5159,7 @@ file_names[ 4]: ) ) ;; code offset: 0x177 - (br_if $label$1 + (br_if $block1 ;; code offset: 0x176 (i32.ge_s ;; code offset: 0x172 @@ -5169,7 +5169,7 @@ file_names[ 4]: ) ) ;; code offset: 0x179 - (loop $label$12 + (loop $label5 ;; code offset: 0x17d (local.set $1 ;; code offset: 0x17b @@ -5186,7 +5186,7 @@ file_names[ 4]: ) (then ;; code offset: 0x186 - (loop $label$14 + (loop $label3 ;; code offset: 0x1a0 (i32.store ;; code offset: 0x18f @@ -5226,7 +5226,7 @@ file_names[ 4]: ) ) ;; code offset: 0x1a8 - (br_if $label$14 + (br_if $label3 ;; code offset: 0x1a7 (i32.ne ;; code offset: 0x1a3 @@ -5292,7 +5292,7 @@ file_names[ 4]: ) ) ;; code offset: 0x1d9 - (br_if $label$5 + (br_if $label4 ;; code offset: 0x1d8 (i32.gt_s ;; code offset: 0x1d4 @@ -5302,7 +5302,7 @@ file_names[ 4]: ) ) ;; code offset: 0x1e5 - (br_if $label$1 + (br_if $block1 ;; code offset: 0x1e4 (i32.eq ;; code offset: 0x1e0 @@ -5328,9 +5328,13 @@ file_names[ 4]: ) ) ;; code offset: 0x1ee - (br $label$12) + (br $label5) ) + ;; code offset: 0x1f1 + (unreachable) ) + ;; code offset: 0x1f3 + (unreachable) ) ) ;; code offset: 0x209 @@ -5386,7 +5390,7 @@ file_names[ 4]: ) ) ;; code offset: 0x21c - (loop $label$15 + (loop $label10 ;; code offset: 0x223 (if ;; code offset: 0x222 @@ -5398,7 +5402,7 @@ file_names[ 4]: ) (then ;; code offset: 0x225 - (loop $label$17 + (loop $label6 ;; code offset: 0x236 (i32.store ;; code offset: 0x233 @@ -5424,10 +5428,9 @@ file_names[ 4]: ;; code offset: 0x234 (local.get $2) ) - ;; code offset: 0x242 - (br_if $label$17 + (br_if $label6 (block (result i32) - (local.set $18 + (local.set $scratch_18 ;; code offset: 0x23d (i32.gt_s ;; code offset: 0x239 @@ -5441,16 +5444,17 @@ file_names[ 4]: ;; code offset: 0x23e (local.get $1) ) - (local.get $18) + ;; code offset: 0x242 + (local.get $scratch_18) ) ) ) ) ) ;; code offset: 0x246 - (block $label$18 + (block $block2 ;; code offset: 0x250 - (br_if $label$18 + (br_if $block2 ;; code offset: 0x24f (i32.eqz ;; code offset: 0x24d @@ -5464,7 +5468,7 @@ file_names[ 4]: ) ) ;; code offset: 0x25a - (br_if $label$18 + (br_if $block2 ;; code offset: 0x259 (i32.eq ;; code offset: 0x254 @@ -5490,7 +5494,7 @@ file_names[ 4]: (i32.const 0) ) ;; code offset: 0x267 - (loop $label$19 + (loop $label8 ;; code offset: 0x26b (local.set $10 ;; code offset: 0x269 @@ -5522,7 +5526,7 @@ file_names[ 4]: (i32.const 1) ) ;; code offset: 0x27f - (loop $label$21 + (loop $label7 ;; code offset: 0x28e (local.set $14 ;; code offset: 0x28b @@ -5575,7 +5579,7 @@ file_names[ 4]: (local.get $14) ) ;; code offset: 0x2b8 - (br_if $label$21 + (br_if $label7 ;; code offset: 0x2b7 (i32.lt_s ;; code offset: 0x2ae @@ -5647,7 +5651,7 @@ file_names[ 4]: (local.get $1) ) ;; code offset: 0x2df - (br_if $label$19 + (br_if $label8 ;; code offset: 0x2dd (local.get $1) ) @@ -5671,7 +5675,7 @@ file_names[ 4]: ) ) ;; code offset: 0x2f4 - (br_if $label$1 + (br_if $block1 ;; code offset: 0x2f3 (i32.ge_s ;; code offset: 0x2ef @@ -5681,7 +5685,7 @@ file_names[ 4]: ) ) ;; code offset: 0x2f6 - (loop $label$22 + (loop $label11 ;; code offset: 0x2fa (local.set $1 ;; code offset: 0x2f8 @@ -5698,7 +5702,7 @@ file_names[ 4]: ) (then ;; code offset: 0x303 - (loop $label$24 + (loop $label9 ;; code offset: 0x31d (i32.store ;; code offset: 0x30c @@ -5738,7 +5742,7 @@ file_names[ 4]: ) ) ;; code offset: 0x325 - (br_if $label$24 + (br_if $label9 ;; code offset: 0x324 (i32.ne ;; code offset: 0x320 @@ -5804,7 +5808,7 @@ file_names[ 4]: ) ) ;; code offset: 0x356 - (br_if $label$15 + (br_if $label10 ;; code offset: 0x355 (i32.gt_s ;; code offset: 0x351 @@ -5814,7 +5818,7 @@ file_names[ 4]: ) ) ;; code offset: 0x362 - (br_if $label$1 + (br_if $block1 ;; code offset: 0x361 (i32.eq ;; code offset: 0x35d @@ -5840,9 +5844,13 @@ file_names[ 4]: ) ) ;; code offset: 0x36b - (br $label$22) + (br $label11) ) + ;; code offset: 0x36e + (unreachable) ) + ;; code offset: 0x370 + (unreachable) ) ;; code offset: 0x374 (call $free @@ -5870,8 +5878,8 @@ file_names[ 4]: (local $6 i32) (local $7 i32) (local $8 i32) - (local $9 i32) - (local $10 i32) + (local $scratch i32) + (local $scratch_10 i32) ;; code offset: 0x399 (global.set $global$0 ;; code offset: 0x397 @@ -5886,9 +5894,9 @@ file_names[ 4]: ) ) ;; code offset: 0x39b - (block $label$1 + (block $block0 ;; code offset: 0x39d - (block $label$2 + (block $block ;; code offset: 0x3a4 (if ;; code offset: 0x3a3 @@ -5900,7 +5908,7 @@ file_names[ 4]: ) (then ;; code offset: 0x3b2 - (br_if $label$2 + (br_if $block ;; code offset: 0x3b1 (i32.gt_s ;; code offset: 0x3ad @@ -5934,7 +5942,7 @@ file_names[ 4]: (i32.const 1) ) ;; code offset: 0x3bf - (br $label$1) + (br $block0) ) ;; code offset: 0x3c7 (if @@ -5967,7 +5975,7 @@ file_names[ 4]: (i32.const 0) ) ;; code offset: 0x3d8 - (loop $label$5 + (loop $label ;; code offset: 0x3e2 (i32.store offset=8 ;; code offset: 0x3de @@ -6001,7 +6009,7 @@ file_names[ 4]: (local.get $4) ) ;; code offset: 0x401 - (br_if $label$5 + (br_if $label ;; code offset: 0x400 (i32.ne ;; code offset: 0x3fc @@ -6051,11 +6059,11 @@ file_names[ 4]: ) ) ;; code offset: 0x41a - (block $label$6 + (block $block3 ;; code offset: 0x41c - (block $label$7 + (block $block2 ;; code offset: 0x41e - (block $label$8 + (block $block1 ;; code offset: 0x425 (if ;; code offset: 0x424 @@ -6067,7 +6075,7 @@ file_names[ 4]: ) (then ;; code offset: 0x427 - (loop $label$10 + (loop $label0 ;; code offset: 0x433 (i32.store ;; code offset: 0x430 @@ -6086,7 +6094,7 @@ file_names[ 4]: (local.get $0) ) ;; code offset: 0x440 - (br_if $label$10 + (br_if $label0 ;; code offset: 0x43f (i32.ne ;; code offset: 0x43b @@ -6115,7 +6123,7 @@ file_names[ 4]: (local.get $3) ) ;; code offset: 0x44b - (br $label$8) + (br $block1) ) ) ;; code offset: 0x450 @@ -6129,17 +6137,17 @@ file_names[ 4]: (local.get $3) ) ;; code offset: 0x456 - (br $label$7) + (br $block2) ) ;; code offset: 0x459 - (loop $label$11 + (loop $label5 ;; code offset: 0x45d (local.set $0 ;; code offset: 0x45b (i32.const 0) ) ;; code offset: 0x45f - (loop $label$12 + (loop $label1 ;; code offset: 0x471 (i32.store offset=16 ;; code offset: 0x461 @@ -6181,7 +6189,7 @@ file_names[ 4]: ) ) ;; code offset: 0x489 - (br_if $label$12 + (br_if $label1 ;; code offset: 0x488 (i32.ne ;; code offset: 0x484 @@ -6218,7 +6226,7 @@ file_names[ 4]: ) (then ;; code offset: 0x498 - (loop $label$14 + (loop $label2 ;; code offset: 0x4a9 (i32.store ;; code offset: 0x4a6 @@ -6244,10 +6252,9 @@ file_names[ 4]: ;; code offset: 0x4a7 (local.get $2) ) - ;; code offset: 0x4b5 - (br_if $label$14 + (br_if $label2 (block (result i32) - (local.set $9 + (local.set $scratch ;; code offset: 0x4b0 (i32.gt_s ;; code offset: 0x4ac @@ -6261,14 +6268,15 @@ file_names[ 4]: ;; code offset: 0x4b1 (local.get $0) ) - (local.get $9) + ;; code offset: 0x4b5 + (local.get $scratch) ) ) ) ) ) ;; code offset: 0x4be - (br_if $label$6 + (br_if $block3 ;; code offset: 0x4bd (i32.eq ;; code offset: 0x4b9 @@ -6288,7 +6296,7 @@ file_names[ 4]: ) ) ;; code offset: 0x4c7 - (loop $label$15 + (loop $label4 ;; code offset: 0x4cb (local.set $0 ;; code offset: 0x4c9 @@ -6313,7 +6321,7 @@ file_names[ 4]: ) (then ;; code offset: 0x4db - (loop $label$17 + (loop $label3 ;; code offset: 0x4f5 (i32.store ;; code offset: 0x4e4 @@ -6353,7 +6361,7 @@ file_names[ 4]: ) ) ;; code offset: 0x4fd - (br_if $label$17 + (br_if $label3 ;; code offset: 0x4fc (i32.ne ;; code offset: 0x4f8 @@ -6429,7 +6437,7 @@ file_names[ 4]: ) (then ;; code offset: 0x53a - (br_if $label$15 + (br_if $label4 ;; code offset: 0x539 (i32.ne ;; code offset: 0x535 @@ -6447,21 +6455,21 @@ file_names[ 4]: ) ) ;; code offset: 0x53c - (br $label$6) + (br $block3) ) ) ) ;; code offset: 0x542 - (br_if $label$11 + (br_if $label5 ;; code offset: 0x540 (local.get $6) ) ) ;; code offset: 0x545 - (br $label$6) + (br $block3) ) ;; code offset: 0x548 - (loop $label$19 + (loop $label9 ;; code offset: 0x54e (drop ;; code offset: 0x54c @@ -6481,7 +6489,7 @@ file_names[ 4]: ) (then ;; code offset: 0x556 - (loop $label$21 + (loop $label6 ;; code offset: 0x567 (i32.store ;; code offset: 0x564 @@ -6507,10 +6515,9 @@ file_names[ 4]: ;; code offset: 0x565 (local.get $2) ) - ;; code offset: 0x573 - (br_if $label$21 + (br_if $label6 (block (result i32) - (local.set $10 + (local.set $scratch_10 ;; code offset: 0x56e (i32.gt_s ;; code offset: 0x56a @@ -6524,14 +6531,15 @@ file_names[ 4]: ;; code offset: 0x56f (local.get $0) ) - (local.get $10) + ;; code offset: 0x573 + (local.get $scratch_10) ) ) ) ) ) ;; code offset: 0x57c - (br_if $label$6 + (br_if $block3 ;; code offset: 0x57b (i32.eq ;; code offset: 0x577 @@ -6551,7 +6559,7 @@ file_names[ 4]: ) ) ;; code offset: 0x585 - (loop $label$22 + (loop $label8 ;; code offset: 0x58c (local.set $7 ;; code offset: 0x589 @@ -6576,7 +6584,7 @@ file_names[ 4]: ) (then ;; code offset: 0x599 - (loop $label$24 + (loop $label7 ;; code offset: 0x5b3 (i32.store ;; code offset: 0x5a2 @@ -6616,7 +6624,7 @@ file_names[ 4]: ) ) ;; code offset: 0x5bb - (br_if $label$24 + (br_if $label7 ;; code offset: 0x5ba (i32.ne ;; code offset: 0x5b6 @@ -6692,7 +6700,7 @@ file_names[ 4]: ) (then ;; code offset: 0x5f8 - (br_if $label$22 + (br_if $label8 ;; code offset: 0x5f7 (i32.ne ;; code offset: 0x5f3 @@ -6710,12 +6718,12 @@ file_names[ 4]: ) ) ;; code offset: 0x5fa - (br $label$6) + (br $block3) ) ) ) ;; code offset: 0x600 - (br_if $label$19 + (br_if $label9 ;; code offset: 0x5fe (local.get $6) ) @@ -6747,7 +6755,7 @@ file_names[ 4]: (local.get $4) (then ;; code offset: 0x618 - (loop $label$27 + (loop $label10 ;; code offset: 0x61e (local.set $1 ;; code offset: 0x61c @@ -6792,7 +6800,7 @@ file_names[ 4]: (local.get $2) ) ;; code offset: 0x63d - (br_if $label$27 + (br_if $label10 ;; code offset: 0x63b (local.get $2) ) diff --git a/test/passes/fib2_dwarf.bin.txt b/test/passes/fib2_dwarf.bin.txt index 9d633f78b2d..37c49c336aa 100644 --- a/test/passes/fib2_dwarf.bin.txt +++ b/test/passes/fib2_dwarf.bin.txt @@ -637,9 +637,9 @@ file_names[ 1]: (i32.const 1) ) ;; code offset: 0x12 - (block $label$1 + (block $block ;; code offset: 0x19 - (br_if $label$1 + (br_if $block ;; code offset: 0x18 (i32.lt_s ;; code offset: 0x14 @@ -659,7 +659,7 @@ file_names[ 1]: (i32.const 0) ) ;; code offset: 0x23 - (loop $label$2 + (loop $label ;; code offset: 0x2c (local.set $1 ;; code offset: 0x2b @@ -679,7 +679,7 @@ file_names[ 1]: (local.get $4) ) ;; code offset: 0x3c - (br_if $label$2 + (br_if $label ;; code offset: 0x3b (i32.ne ;; code offset: 0x37 diff --git a/test/passes/fib2_emptylocspan_dwarf.bin.txt b/test/passes/fib2_emptylocspan_dwarf.bin.txt index 6d9078ccc08..e59fe19bb29 100644 --- a/test/passes/fib2_emptylocspan_dwarf.bin.txt +++ b/test/passes/fib2_emptylocspan_dwarf.bin.txt @@ -637,9 +637,9 @@ file_names[ 1]: (i32.const 1) ) ;; code offset: 0x12 - (block $label$1 + (block $block ;; code offset: 0x19 - (br_if $label$1 + (br_if $block ;; code offset: 0x18 (i32.lt_s ;; code offset: 0x14 @@ -659,7 +659,7 @@ file_names[ 1]: (i32.const 0) ) ;; code offset: 0x23 - (loop $label$2 + (loop $label ;; code offset: 0x2c (local.set $1 ;; code offset: 0x2b @@ -679,7 +679,7 @@ file_names[ 1]: (local.get $4) ) ;; code offset: 0x3c - (br_if $label$2 + (br_if $label ;; code offset: 0x3b (i32.ne ;; code offset: 0x37 diff --git a/test/passes/fib_nonzero-low-pc_dwarf.bin.txt b/test/passes/fib_nonzero-low-pc_dwarf.bin.txt index 8d1c7faa89a..a9294f7e1ea 100644 --- a/test/passes/fib_nonzero-low-pc_dwarf.bin.txt +++ b/test/passes/fib_nonzero-low-pc_dwarf.bin.txt @@ -539,9 +539,9 @@ file_names[ 1]: (i32.const 1) ) ;; code offset: 0x19 - (block $label$1 + (block $block ;; code offset: 0x20 - (br_if $label$1 + (br_if $block ;; code offset: 0x1f (i32.le_s ;; code offset: 0x1b @@ -561,7 +561,7 @@ file_names[ 1]: (i32.const 1) ) ;; code offset: 0x2a - (loop $label$2 + (loop $label ;; code offset: 0x33 (local.set $1 ;; code offset: 0x32 @@ -601,7 +601,7 @@ file_names[ 1]: (local.get $4) ) ;; code offset: 0x4a - (br_if $label$2 + (br_if $label ;; code offset: 0x49 (i32.eqz ;; code offset: 0x47 diff --git a/test/passes/func-metrics.txt b/test/passes/func-metrics.txt index b61e8146ec9..86eb8871f10 100644 --- a/test/passes/func-metrics.txt +++ b/test/passes/func-metrics.txt @@ -13,10 +13,10 @@ global Const : 3 RefFunc : 3 func: empty - [binary-bytes] : 3 + [binary-bytes] : 2 [total] : 1 [vars] : 0 - Nop : 1 + Block : 1 func: small [binary-bytes] : 9 [total] : 5 @@ -44,7 +44,6 @@ func: ifs (table $0 256 256 funcref) (elem $0 (i32.const 0) $ifs $ifs $ifs) (func $empty - (nop) ) (func $small (nop) diff --git a/test/passes/licm.txt b/test/passes/licm.txt index 83edd78c3d2..64d86c32efa 100644 --- a/test/passes/licm.txt +++ b/test/passes/licm.txt @@ -508,7 +508,6 @@ ) (func $after (loop $loop - (nop) ) (drop (i32.const 10) diff --git a/test/passes/minify-imports-and-exports_all-features.txt b/test/passes/minify-imports-and-exports_all-features.txt index 2d131416d48..87aa3c2f289 100644 --- a/test/passes/minify-imports-and-exports_all-features.txt +++ b/test/passes/minify-imports-and-exports_all-features.txt @@ -10020,9 +10020,7 @@ longname4880 => zza (export "OBa" (func $foo2)) (export "PBa" (tag $tag1)) (func $foo1 (type $0) - (nop) ) (func $foo2 (type $0) - (nop) ) ) diff --git a/test/passes/minify-imports_all-features.txt b/test/passes/minify-imports_all-features.txt index 536a6a042f6..ec25564396a 100644 --- a/test/passes/minify-imports_all-features.txt +++ b/test/passes/minify-imports_all-features.txt @@ -10014,9 +10014,7 @@ longname4880 => zza (export "foo2" (func $foo2)) (export "tag1" (tag $tag1)) (func $foo1 (type $0) - (nop) ) (func $foo2 (type $0) - (nop) ) ) diff --git a/test/passes/post-emscripten.txt b/test/passes/post-emscripten.txt index 186cdeb7675..6cefe366f8e 100644 --- a/test/passes/post-emscripten.txt +++ b/test/passes/post-emscripten.txt @@ -43,10 +43,8 @@ ) ) (func $other_safe (param $0 i32) (param $1 f32) - (nop) ) (func $other_unsafe (param $0 i32) (param $1 f32) - (nop) ) (func $deep_safe (param $0 i32) (param $1 f32) (call $other_safe @@ -84,7 +82,6 @@ ) ) (func $other_safe (param $0 i32) (param $1 f32) - (nop) ) ) (module diff --git a/test/passes/print-function-map.txt b/test/passes/print-function-map.txt index 228276e0635..5cf4c5843fb 100644 --- a/test/passes/print-function-map.txt +++ b/test/passes/print-function-map.txt @@ -5,9 +5,7 @@ (type $0 (func)) (import "env" "foo" (func $Foo)) (func $bar - (nop) ) (func $baz - (nop) ) ) diff --git a/test/passes/print_g.bin.txt b/test/passes/print_g.bin.txt index 174230388c9..f9a2ac67b39 100644 --- a/test/passes/print_g.bin.txt +++ b/test/passes/print_g.bin.txt @@ -35,9 +35,9 @@ ) (then ;; code offset: 0x12 - (loop $label$2 + (loop $label ;; code offset: 0x2e - (br_if $label$2 + (br_if $label ;; code offset: 0x2d (i32.ne ;; code offset: 0x2a @@ -167,9 +167,9 @@ ) (then ;; code offset: 0x12 - (loop $label$2 + (loop $label ;; code offset: 0x2e - (br_if $label$2 + (br_if $label ;; code offset: 0x2d (i32.ne ;; code offset: 0x2a diff --git a/test/passes/print_g_strip-dwarf.bin.txt b/test/passes/print_g_strip-dwarf.bin.txt index 967e03f3d39..e9b36b9757d 100644 --- a/test/passes/print_g_strip-dwarf.bin.txt +++ b/test/passes/print_g_strip-dwarf.bin.txt @@ -27,8 +27,8 @@ (i32.const 55) ) (then - (loop $label$2 - (br_if $label$2 + (loop $label + (br_if $label (i32.ne (i32.rem_s (local.tee $0 @@ -120,8 +120,8 @@ (i32.const 55) ) (then - (loop $label$2 - (br_if $label$2 + (loop $label + (br_if $label (i32.ne (i32.rem_s (local.tee $0 diff --git a/test/passes/remove-unused-brs_enable-multivalue.txt b/test/passes/remove-unused-brs_enable-multivalue.txt index f3c1b7d7733..ee6efbf4dab 100644 --- a/test/passes/remove-unused-brs_enable-multivalue.txt +++ b/test/passes/remove-unused-brs_enable-multivalue.txt @@ -529,7 +529,6 @@ ) ) (loop $in2 - (nop) ) (loop $in3 (block $out2 diff --git a/test/passes/remove-unused-names_merge-blocks_all-features.txt b/test/passes/remove-unused-names_merge-blocks_all-features.txt index ec63edd5e01..2169d636b71 100644 --- a/test/passes/remove-unused-names_merge-blocks_all-features.txt +++ b/test/passes/remove-unused-names_merge-blocks_all-features.txt @@ -1657,7 +1657,6 @@ (type $1 (func (param i32))) (tag $e (param i32)) (func $foo (type $0) - (nop) ) (func $throw (type $0) (nop) diff --git a/test/passes/remove-unused-nonfunction-module-elements_all-features.txt b/test/passes/remove-unused-nonfunction-module-elements_all-features.txt index e125373d8d8..c56b99253d1 100644 --- a/test/passes/remove-unused-nonfunction-module-elements_all-features.txt +++ b/test/passes/remove-unused-nonfunction-module-elements_all-features.txt @@ -111,7 +111,6 @@ (data $0 (i32.const 1) "hello, world!") (elem $0 (i32.const 0) $waka) (func $waka (type $0) - (nop) ) ) (module @@ -228,7 +227,6 @@ (data $0 (global.get $memoryBase) "hello, world!") (elem $0 (global.get $tableBase) $waka) (func $waka (type $0) - (nop) ) ) (module @@ -347,6 +345,5 @@ (tag $e1 (param i64)) (export "e1" (tag $e1)) (func $f (type $0) (param $0 i32) - (nop) ) ) diff --git a/test/passes/reverse_dwarf_abbrevs.bin.txt b/test/passes/reverse_dwarf_abbrevs.bin.txt index 5427acc6cf0..5c2bcfc3f53 100644 --- a/test/passes/reverse_dwarf_abbrevs.bin.txt +++ b/test/passes/reverse_dwarf_abbrevs.bin.txt @@ -292,11 +292,11 @@ file_names[ 1]: ;; code offset: 0x18d (local.set $4 ;; code offset: 0x89 - (block $label$1 (result i32) + (block $block1 (result i32) ;; code offset: 0x8b - (block $label$2 + (block $block0 ;; code offset: 0x8d - (block $label$3 + (block $block ;; code offset: 0xa5 (if ;; code offset: 0xa4 @@ -331,9 +331,9 @@ file_names[ 1]: ) (then ;; code offset: 0xa7 - (loop $label$5 + (loop $label ;; code offset: 0xb3 - (br_if $label$3 + (br_if $block ;; code offset: 0xb2 (i32.eq ;; code offset: 0xa9 @@ -349,7 +349,7 @@ file_names[ 1]: ) ) ;; code offset: 0xba - (br_if $label$2 + (br_if $block0 ;; code offset: 0xb9 (i32.le_s ;; code offset: 0xb5 @@ -456,7 +456,7 @@ file_names[ 1]: ) ) ;; code offset: 0x125 - (br_if $label$5 + (br_if $label ;; code offset: 0x124 (i32.eqz ;; code offset: 0x122 @@ -517,7 +517,7 @@ file_names[ 1]: (i32.const -1) ) ;; code offset: 0x135 - (br_if $label$2 + (br_if $block0 ;; code offset: 0x134 (i32.ne ;; code offset: 0x130 @@ -563,7 +563,7 @@ file_names[ 1]: ) ) ;; code offset: 0x15a - (br $label$1 + (br $block1 ;; code offset: 0x158 (local.get $2) ) @@ -600,7 +600,7 @@ file_names[ 1]: ;; code offset: 0x183 (drop ;; code offset: 0x181 - (br_if $label$1 + (br_if $block1 ;; code offset: 0x17a (local.tee $4 ;; code offset: 0x178 @@ -797,7 +797,7 @@ file_names[ 1]: ) ) ;; code offset: 0x222 - (block $label$2 + (block $block1 ;; code offset: 0x22d (if ;; code offset: 0x22c @@ -817,7 +817,7 @@ file_names[ 1]: ) (then ;; code offset: 0x22f - (block $label$4 + (block $block ;; code offset: 0x236 (if ;; code offset: 0x235 @@ -834,7 +834,7 @@ file_names[ 1]: (local.get $0) ) ;; code offset: 0x23c - (br $label$4) + (br $block) ) ) ;; code offset: 0x245 @@ -856,7 +856,7 @@ file_names[ 1]: (local.get $0) ) ;; code offset: 0x24b - (br $label$4) + (br $block) ) ) ;; code offset: 0x250 @@ -865,7 +865,7 @@ file_names[ 1]: (local.get $0) ) ;; code offset: 0x252 - (loop $label$7 + (loop $label ;; code offset: 0x25b (i32.store8 ;; code offset: 0x254 @@ -887,7 +887,7 @@ file_names[ 1]: ) ) ;; code offset: 0x26f - (br_if $label$4 + (br_if $block ;; code offset: 0x26e (i32.ge_u ;; code offset: 0x26a @@ -905,7 +905,7 @@ file_names[ 1]: ) ) ;; code offset: 0x276 - (br_if $label$7 + (br_if $label ;; code offset: 0x275 (i32.and ;; code offset: 0x271 @@ -917,9 +917,9 @@ file_names[ 1]: ) ) ;; code offset: 0x27a - (block $label$8 + (block $block0 ;; code offset: 0x287 - (br_if $label$8 + (br_if $block0 ;; code offset: 0x286 (i32.lt_u ;; code offset: 0x281 @@ -937,7 +937,7 @@ file_names[ 1]: ) ) ;; code offset: 0x293 - (br_if $label$8 + (br_if $block0 ;; code offset: 0x292 (i32.gt_u ;; code offset: 0x289 @@ -955,7 +955,7 @@ file_names[ 1]: ) ) ;; code offset: 0x295 - (loop $label$9 + (loop $label0 ;; code offset: 0x29e (i32.store ;; code offset: 0x297 @@ -1127,7 +1127,7 @@ file_names[ 1]: ) ) ;; code offset: 0x348 - (br_if $label$9 + (br_if $label0 ;; code offset: 0x347 (i32.le_u ;; code offset: 0x343 @@ -1147,7 +1147,7 @@ file_names[ 1]: ) ) ;; code offset: 0x351 - (br_if $label$2 + (br_if $block1 ;; code offset: 0x350 (i32.ge_u ;; code offset: 0x34c @@ -1157,7 +1157,7 @@ file_names[ 1]: ) ) ;; code offset: 0x353 - (loop $label$10 + (loop $label1 ;; code offset: 0x35c (i32.store ;; code offset: 0x355 @@ -1179,7 +1179,7 @@ file_names[ 1]: ) ) ;; code offset: 0x370 - (br_if $label$10 + (br_if $label1 ;; code offset: 0x36f (i32.lt_u ;; code offset: 0x36b @@ -1198,7 +1198,7 @@ file_names[ 1]: ) ) ;; code offset: 0x373 - (br $label$2) + (br $block1) ) ) ;; code offset: 0x37b @@ -1217,7 +1217,7 @@ file_names[ 1]: (local.get $0) ) ;; code offset: 0x381 - (br $label$2) + (br $block1) ) ) ;; code offset: 0x38e @@ -1244,7 +1244,7 @@ file_names[ 1]: (local.get $0) ) ;; code offset: 0x394 - (br $label$2) + (br $block1) ) ) ;; code offset: 0x399 @@ -1253,7 +1253,7 @@ file_names[ 1]: (local.get $0) ) ;; code offset: 0x39b - (loop $label$13 + (loop $label2 ;; code offset: 0x3a4 (i32.store8 ;; code offset: 0x39d @@ -1305,7 +1305,7 @@ file_names[ 1]: ) ) ;; code offset: 0x3d6 - (br_if $label$13 + (br_if $label2 ;; code offset: 0x3d5 (i32.le_u ;; code offset: 0x3d1 @@ -1335,7 +1335,7 @@ file_names[ 1]: ) (then ;; code offset: 0x3e1 - (loop $label$15 + (loop $label3 ;; code offset: 0x3ea (i32.store8 ;; code offset: 0x3e3 @@ -1357,7 +1357,7 @@ file_names[ 1]: ) ) ;; code offset: 0x3fe - (br_if $label$15 + (br_if $label3 ;; code offset: 0x3fd (i32.ne ;; code offset: 0x3f9 @@ -1386,380 +1386,377 @@ file_names[ 1]: (local $5 i32) (local $6 i32) ;; code offset: 0x410 - (block $label$1 - ;; code offset: 0x43a + (block $block + ;; code offset: 0x41a (if - ;; code offset: 0x412 - (block $label$2 (result i32) - ;; code offset: 0x41c - (if - ;; code offset: 0x41b - (i32.eqz - ;; code offset: 0x419 - (local.tee $3 - ;; code offset: 0x416 - (i32.load offset=16 - ;; code offset: 0x414 - (local.get $2) - ) - ) + ;; code offset: 0x419 + (i32.eqz + ;; code offset: 0x417 + (local.tee $3 + ;; code offset: 0x414 + (i32.load offset=16 + ;; code offset: 0x412 + (local.get $2) + ) + ) + ) + (then + ;; code offset: 0x420 + (br_if $block + ;; code offset: 0x41e + (call $8 + ;; code offset: 0x41c + (local.get $2) ) - (then + ) + ;; code offset: 0x427 + (local.set $3 + ;; code offset: 0x424 + (i32.load offset=16 ;; code offset: 0x422 - (br_if $label$1 - ;; code offset: 0x420 - (call $8 - ;; code offset: 0x41e - (local.get $2) - ) - ) - ;; code offset: 0x429 - (local.set $3 - ;; code offset: 0x426 - (i32.load offset=16 - ;; code offset: 0x424 - (local.get $2) - ) - ) + (local.get $2) ) ) - ;; code offset: 0x438 - (i32.lt_u - ;; code offset: 0x435 - (i32.sub - ;; code offset: 0x42c - (local.get $3) - ;; code offset: 0x433 - (local.tee $5 - ;; code offset: 0x430 - (i32.load offset=20 - ;; code offset: 0x42e - (local.get $2) - ) + ) + ) + ;; code offset: 0x437 + (if + ;; code offset: 0x436 + (i32.lt_u + ;; code offset: 0x433 + (i32.sub + ;; code offset: 0x42a + (local.get $3) + ;; code offset: 0x431 + (local.tee $5 + ;; code offset: 0x42e + (i32.load offset=20 + ;; code offset: 0x42c + (local.get $2) ) ) - ;; code offset: 0x436 - (local.get $1) ) + ;; code offset: 0x434 + (local.get $1) ) (then - ;; code offset: 0x44a + ;; code offset: 0x447 (return - ;; code offset: 0x447 + ;; code offset: 0x444 (call_indirect (type $1) - ;; code offset: 0x43c + ;; code offset: 0x439 (local.get $2) - ;; code offset: 0x43e + ;; code offset: 0x43b (local.get $0) - ;; code offset: 0x440 + ;; code offset: 0x43d (local.get $1) - ;; code offset: 0x444 + ;; code offset: 0x441 (i32.load offset=36 - ;; code offset: 0x442 + ;; code offset: 0x43f (local.get $2) ) ) ) ) ) - ;; code offset: 0x44c - (block $label$5 - ;; code offset: 0x456 - (br_if $label$5 - ;; code offset: 0x455 + ;; code offset: 0x449 + (block $block0 + ;; code offset: 0x453 + (br_if $block0 + ;; code offset: 0x452 (i32.lt_s - ;; code offset: 0x450 + ;; code offset: 0x44d (i32.load8_s offset=75 - ;; code offset: 0x44e + ;; code offset: 0x44b (local.get $2) ) - ;; code offset: 0x453 + ;; code offset: 0x450 (i32.const 0) ) ) - ;; code offset: 0x45a + ;; code offset: 0x457 (local.set $4 - ;; code offset: 0x458 + ;; code offset: 0x455 (local.get $1) ) - ;; code offset: 0x45c - (loop $label$6 - ;; code offset: 0x463 - (br_if $label$5 - ;; code offset: 0x462 + ;; code offset: 0x459 + (loop $label + ;; code offset: 0x460 + (br_if $block0 + ;; code offset: 0x45f (i32.eqz - ;; code offset: 0x460 + ;; code offset: 0x45d (local.tee $3 - ;; code offset: 0x45e + ;; code offset: 0x45b (local.get $4) ) ) ) - ;; code offset: 0x475 - (br_if $label$6 - ;; code offset: 0x474 + ;; code offset: 0x472 + (br_if $label + ;; code offset: 0x471 (i32.ne - ;; code offset: 0x46f + ;; code offset: 0x46c (i32.load8_u - ;; code offset: 0x46e + ;; code offset: 0x46b (i32.add - ;; code offset: 0x465 + ;; code offset: 0x462 (local.get $0) - ;; code offset: 0x46c + ;; code offset: 0x469 (local.tee $4 - ;; code offset: 0x46b + ;; code offset: 0x468 (i32.add - ;; code offset: 0x467 + ;; code offset: 0x464 (local.get $3) - ;; code offset: 0x469 + ;; code offset: 0x466 (i32.const -1) ) ) ) ) - ;; code offset: 0x472 + ;; code offset: 0x46f (i32.const 10) ) ) ) - ;; code offset: 0x48b - (br_if $label$1 - ;; code offset: 0x48a + ;; code offset: 0x488 + (br_if $block + ;; code offset: 0x487 (i32.lt_u - ;; code offset: 0x486 + ;; code offset: 0x483 (local.tee $4 - ;; code offset: 0x483 + ;; code offset: 0x480 (call_indirect (type $1) - ;; code offset: 0x478 + ;; code offset: 0x475 (local.get $2) - ;; code offset: 0x47a + ;; code offset: 0x477 (local.get $0) - ;; code offset: 0x47c + ;; code offset: 0x479 (local.get $3) - ;; code offset: 0x480 + ;; code offset: 0x47d (i32.load offset=36 - ;; code offset: 0x47e + ;; code offset: 0x47b (local.get $2) ) ) ) - ;; code offset: 0x488 + ;; code offset: 0x485 (local.get $3) ) ) - ;; code offset: 0x492 + ;; code offset: 0x48f (local.set $0 - ;; code offset: 0x491 + ;; code offset: 0x48e (i32.add - ;; code offset: 0x48d + ;; code offset: 0x48a (local.get $0) - ;; code offset: 0x48f + ;; code offset: 0x48c (local.get $3) ) ) - ;; code offset: 0x499 + ;; code offset: 0x496 (local.set $1 - ;; code offset: 0x498 + ;; code offset: 0x495 (i32.sub - ;; code offset: 0x494 + ;; code offset: 0x491 (local.get $1) - ;; code offset: 0x496 + ;; code offset: 0x493 (local.get $3) ) ) - ;; code offset: 0x4a0 + ;; code offset: 0x49d (local.set $5 - ;; code offset: 0x49d + ;; code offset: 0x49a (i32.load offset=20 - ;; code offset: 0x49b + ;; code offset: 0x498 (local.get $2) ) ) - ;; code offset: 0x4a4 + ;; code offset: 0x4a1 (local.set $6 - ;; code offset: 0x4a2 + ;; code offset: 0x49f (local.get $3) ) ) - ;; code offset: 0x4af + ;; code offset: 0x4ac (drop - ;; code offset: 0x4ad + ;; code offset: 0x4aa (call $9 - ;; code offset: 0x4a7 + ;; code offset: 0x4a4 (local.get $5) - ;; code offset: 0x4a9 + ;; code offset: 0x4a6 (local.get $0) - ;; code offset: 0x4ab + ;; code offset: 0x4a8 (local.get $1) ) ) - ;; code offset: 0x4ba + ;; code offset: 0x4b7 (i32.store offset=20 - ;; code offset: 0x4b0 + ;; code offset: 0x4ad (local.get $2) - ;; code offset: 0x4b9 + ;; code offset: 0x4b6 (i32.add - ;; code offset: 0x4b4 + ;; code offset: 0x4b1 (i32.load offset=20 - ;; code offset: 0x4b2 + ;; code offset: 0x4af (local.get $2) ) - ;; code offset: 0x4b7 + ;; code offset: 0x4b4 (local.get $1) ) ) - ;; code offset: 0x4c2 + ;; code offset: 0x4bf (local.set $4 - ;; code offset: 0x4c1 + ;; code offset: 0x4be (i32.add - ;; code offset: 0x4bd + ;; code offset: 0x4ba (local.get $1) - ;; code offset: 0x4bf + ;; code offset: 0x4bc (local.get $6) ) ) ) - ;; code offset: 0x4c5 + ;; code offset: 0x4c2 (local.get $4) ) (func $11 (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (local $4 i32) (local $5 i32) - ;; code offset: 0x4d3 + ;; code offset: 0x4d0 (local.set $4 - ;; code offset: 0x4d2 + ;; code offset: 0x4cf (i32.mul - ;; code offset: 0x4ce + ;; code offset: 0x4cb (local.get $1) - ;; code offset: 0x4d0 + ;; code offset: 0x4cd (local.get $2) ) ) - ;; code offset: 0x4d5 - (block $label$1 - ;; code offset: 0x4df + ;; code offset: 0x4d2 + (block $block + ;; code offset: 0x4dc (if - ;; code offset: 0x4de + ;; code offset: 0x4db (i32.le_s - ;; code offset: 0x4d9 + ;; code offset: 0x4d6 (i32.load offset=76 - ;; code offset: 0x4d7 + ;; code offset: 0x4d4 (local.get $3) ) - ;; code offset: 0x4dc + ;; code offset: 0x4d9 (i32.const -1) ) (then - ;; code offset: 0x4e9 + ;; code offset: 0x4e6 (local.set $0 - ;; code offset: 0x4e7 + ;; code offset: 0x4e4 (call $10 - ;; code offset: 0x4e1 + ;; code offset: 0x4de (local.get $0) - ;; code offset: 0x4e3 + ;; code offset: 0x4e0 (local.get $4) - ;; code offset: 0x4e5 + ;; code offset: 0x4e2 (local.get $3) ) ) - ;; code offset: 0x4eb - (br $label$1) + ;; code offset: 0x4e8 + (br $block) ) ) - ;; code offset: 0x4f2 + ;; code offset: 0x4ef (local.set $5 - ;; code offset: 0x4f0 + ;; code offset: 0x4ed (call $15 - ;; code offset: 0x4ee + ;; code offset: 0x4eb (local.get $3) ) ) - ;; code offset: 0x4fc + ;; code offset: 0x4f9 (local.set $0 - ;; code offset: 0x4fa + ;; code offset: 0x4f7 (call $10 - ;; code offset: 0x4f4 + ;; code offset: 0x4f1 (local.get $0) - ;; code offset: 0x4f6 + ;; code offset: 0x4f3 (local.get $4) - ;; code offset: 0x4f8 + ;; code offset: 0x4f5 (local.get $3) ) ) - ;; code offset: 0x501 - (br_if $label$1 - ;; code offset: 0x500 + ;; code offset: 0x4fe + (br_if $block + ;; code offset: 0x4fd (i32.eqz - ;; code offset: 0x4fe + ;; code offset: 0x4fb (local.get $5) ) ) - ;; code offset: 0x505 + ;; code offset: 0x502 (call $16 - ;; code offset: 0x503 + ;; code offset: 0x500 (local.get $3) ) ) - ;; code offset: 0x50d + ;; code offset: 0x50a (if - ;; code offset: 0x50c + ;; code offset: 0x509 (i32.eq - ;; code offset: 0x508 + ;; code offset: 0x505 (local.get $0) - ;; code offset: 0x50a + ;; code offset: 0x507 (local.get $4) ) (then - ;; code offset: 0x516 + ;; code offset: 0x513 (return - ;; code offset: 0x515 + ;; code offset: 0x512 (select - ;; code offset: 0x50f + ;; code offset: 0x50c (local.get $2) - ;; code offset: 0x511 + ;; code offset: 0x50e (i32.const 0) - ;; code offset: 0x513 + ;; code offset: 0x510 (local.get $1) ) ) ) ) - ;; code offset: 0x51c + ;; code offset: 0x519 (i32.div_u - ;; code offset: 0x518 + ;; code offset: 0x515 (local.get $0) - ;; code offset: 0x51a + ;; code offset: 0x517 (local.get $1) ) ) (func $12 (param $0 i32) (param $1 i32) (result i32) (local $2 i32) - ;; code offset: 0x537 + ;; code offset: 0x534 (select - ;; code offset: 0x522 + ;; code offset: 0x51f (i32.const -1) - ;; code offset: 0x524 + ;; code offset: 0x521 (i32.const 0) - ;; code offset: 0x536 + ;; code offset: 0x533 (i32.ne - ;; code offset: 0x532 + ;; code offset: 0x52f (call $11 - ;; code offset: 0x526 + ;; code offset: 0x523 (local.get $0) - ;; code offset: 0x528 + ;; code offset: 0x525 (i32.const 1) - ;; code offset: 0x52e + ;; code offset: 0x52b (local.tee $2 - ;; code offset: 0x52c + ;; code offset: 0x529 (call $17 - ;; code offset: 0x52a + ;; code offset: 0x527 (local.get $0) ) ) - ;; code offset: 0x530 + ;; code offset: 0x52d (local.get $1) ) - ;; code offset: 0x534 + ;; code offset: 0x531 (local.get $2) ) ) @@ -1768,624 +1765,624 @@ file_names[ 1]: (local $2 i32) (local $3 i32) (local $4 i32) - ;; code offset: 0x549 + ;; code offset: 0x546 (global.set $global$0 - ;; code offset: 0x547 + ;; code offset: 0x544 (local.tee $3 - ;; code offset: 0x546 + ;; code offset: 0x543 (i32.sub - ;; code offset: 0x542 + ;; code offset: 0x53f (global.get $global$0) - ;; code offset: 0x544 + ;; code offset: 0x541 (i32.const 16) ) ) ) - ;; code offset: 0x54f + ;; code offset: 0x54c (i32.store8 offset=15 - ;; code offset: 0x54b + ;; code offset: 0x548 (local.get $3) - ;; code offset: 0x54d + ;; code offset: 0x54a (local.get $1) ) - ;; code offset: 0x552 - (block $label$1 - ;; code offset: 0x55c + ;; code offset: 0x54f + (block $block + ;; code offset: 0x559 (if - ;; code offset: 0x55b + ;; code offset: 0x558 (i32.eqz - ;; code offset: 0x559 + ;; code offset: 0x556 (local.tee $2 - ;; code offset: 0x556 + ;; code offset: 0x553 (i32.load offset=16 - ;; code offset: 0x554 + ;; code offset: 0x551 (local.get $0) ) ) ) (then - ;; code offset: 0x560 + ;; code offset: 0x55d (local.set $2 - ;; code offset: 0x55e + ;; code offset: 0x55b (i32.const -1) ) - ;; code offset: 0x566 - (br_if $label$1 - ;; code offset: 0x564 + ;; code offset: 0x563 + (br_if $block + ;; code offset: 0x561 (call $8 - ;; code offset: 0x562 + ;; code offset: 0x55f (local.get $0) ) ) - ;; code offset: 0x56d + ;; code offset: 0x56a (local.set $2 - ;; code offset: 0x56a + ;; code offset: 0x567 (i32.load offset=16 - ;; code offset: 0x568 + ;; code offset: 0x565 (local.get $0) ) ) ) ) - ;; code offset: 0x570 - (block $label$3 - ;; code offset: 0x57c - (br_if $label$3 - ;; code offset: 0x57b + ;; code offset: 0x56d + (block $block0 + ;; code offset: 0x579 + (br_if $block0 + ;; code offset: 0x578 (i32.ge_u - ;; code offset: 0x577 + ;; code offset: 0x574 (local.tee $4 - ;; code offset: 0x574 + ;; code offset: 0x571 (i32.load offset=20 - ;; code offset: 0x572 + ;; code offset: 0x56f (local.get $0) ) ) - ;; code offset: 0x579 + ;; code offset: 0x576 (local.get $2) ) ) - ;; code offset: 0x58c - (br_if $label$3 - ;; code offset: 0x58b + ;; code offset: 0x589 + (br_if $block0 + ;; code offset: 0x588 (i32.eq - ;; code offset: 0x584 + ;; code offset: 0x581 (local.tee $2 - ;; code offset: 0x583 + ;; code offset: 0x580 (i32.and - ;; code offset: 0x57e + ;; code offset: 0x57b (local.get $1) - ;; code offset: 0x580 + ;; code offset: 0x57d (i32.const 255) ) ) - ;; code offset: 0x588 + ;; code offset: 0x585 (i32.load8_s offset=75 - ;; code offset: 0x586 + ;; code offset: 0x583 (local.get $0) ) ) ) - ;; code offset: 0x595 + ;; code offset: 0x592 (i32.store offset=20 - ;; code offset: 0x58e + ;; code offset: 0x58b (local.get $0) - ;; code offset: 0x594 + ;; code offset: 0x591 (i32.add - ;; code offset: 0x590 + ;; code offset: 0x58d (local.get $4) - ;; code offset: 0x592 + ;; code offset: 0x58f (i32.const 1) ) ) - ;; code offset: 0x59c + ;; code offset: 0x599 (i32.store8 - ;; code offset: 0x598 + ;; code offset: 0x595 (local.get $4) - ;; code offset: 0x59a + ;; code offset: 0x597 (local.get $1) ) - ;; code offset: 0x59f - (br $label$1) + ;; code offset: 0x59c + (br $block) ) - ;; code offset: 0x5a4 + ;; code offset: 0x5a1 (local.set $2 - ;; code offset: 0x5a2 + ;; code offset: 0x59f (i32.const -1) ) - ;; code offset: 0x5ba - (br_if $label$1 - ;; code offset: 0x5b9 + ;; code offset: 0x5b7 + (br_if $block + ;; code offset: 0x5b6 (i32.ne - ;; code offset: 0x5b4 + ;; code offset: 0x5b1 (call_indirect (type $1) - ;; code offset: 0x5a6 + ;; code offset: 0x5a3 (local.get $0) - ;; code offset: 0x5ac + ;; code offset: 0x5a9 (i32.add - ;; code offset: 0x5a8 + ;; code offset: 0x5a5 (local.get $3) - ;; code offset: 0x5aa + ;; code offset: 0x5a7 (i32.const 15) ) - ;; code offset: 0x5ad + ;; code offset: 0x5aa (i32.const 1) - ;; code offset: 0x5b1 + ;; code offset: 0x5ae (i32.load offset=36 - ;; code offset: 0x5af + ;; code offset: 0x5ac (local.get $0) ) ) - ;; code offset: 0x5b7 + ;; code offset: 0x5b4 (i32.const 1) ) ) - ;; code offset: 0x5c1 + ;; code offset: 0x5be (local.set $2 - ;; code offset: 0x5be + ;; code offset: 0x5bb (i32.load8_u offset=15 - ;; code offset: 0x5bc + ;; code offset: 0x5b9 (local.get $3) ) ) ) - ;; code offset: 0x5c9 + ;; code offset: 0x5c6 (global.set $global$0 - ;; code offset: 0x5c8 + ;; code offset: 0x5c5 (i32.add - ;; code offset: 0x5c4 + ;; code offset: 0x5c1 (local.get $3) - ;; code offset: 0x5c6 + ;; code offset: 0x5c3 (i32.const 16) ) ) - ;; code offset: 0x5cb + ;; code offset: 0x5c8 (local.get $2) ) (func $14 (param $0 i32) (result i32) (local $1 i32) (local $2 i32) - ;; code offset: 0x5e2 + ;; code offset: 0x5df (if - ;; code offset: 0x5e1 + ;; code offset: 0x5de (i32.ge_s - ;; code offset: 0x5dc + ;; code offset: 0x5d9 (i32.load offset=76 - ;; code offset: 0x5da + ;; code offset: 0x5d7 (local.tee $1 - ;; code offset: 0x5d7 + ;; code offset: 0x5d4 (i32.load - ;; code offset: 0x5d4 + ;; code offset: 0x5d1 (i32.const 1040) ) ) ) - ;; code offset: 0x5df + ;; code offset: 0x5dc (i32.const 0) ) (then - ;; code offset: 0x5e8 + ;; code offset: 0x5e5 (local.set $2 - ;; code offset: 0x5e6 + ;; code offset: 0x5e3 (call $15 - ;; code offset: 0x5e4 + ;; code offset: 0x5e1 (local.get $1) ) ) ) ) - ;; code offset: 0x636 + ;; code offset: 0x633 (local.set $0 - ;; code offset: 0x5eb - (block $label$2 (result i32) - ;; code offset: 0x5fa + ;; code offset: 0x5e8 + (block $block (result i32) + ;; code offset: 0x5f7 (drop - ;; code offset: 0x5f8 - (br_if $label$2 - ;; code offset: 0x5ed + ;; code offset: 0x5f5 + (br_if $block + ;; code offset: 0x5ea (i32.const -1) - ;; code offset: 0x5f7 + ;; code offset: 0x5f4 (i32.lt_s - ;; code offset: 0x5f3 + ;; code offset: 0x5f0 (call $12 - ;; code offset: 0x5ef + ;; code offset: 0x5ec (local.get $0) - ;; code offset: 0x5f1 + ;; code offset: 0x5ee (local.get $1) ) - ;; code offset: 0x5f5 + ;; code offset: 0x5f2 (i32.const 0) ) ) ) - ;; code offset: 0x5fb - (block $label$3 - ;; code offset: 0x605 - (br_if $label$3 - ;; code offset: 0x604 + ;; code offset: 0x5f8 + (block $block0 + ;; code offset: 0x602 + (br_if $block0 + ;; code offset: 0x601 (i32.eq - ;; code offset: 0x5ff + ;; code offset: 0x5fc (i32.load8_u offset=75 - ;; code offset: 0x5fd + ;; code offset: 0x5fa (local.get $1) ) - ;; code offset: 0x602 + ;; code offset: 0x5ff (i32.const 10) ) ) - ;; code offset: 0x614 - (br_if $label$3 - ;; code offset: 0x613 + ;; code offset: 0x611 + (br_if $block0 + ;; code offset: 0x610 (i32.ge_u - ;; code offset: 0x60c + ;; code offset: 0x609 (local.tee $0 - ;; code offset: 0x609 + ;; code offset: 0x606 (i32.load offset=20 - ;; code offset: 0x607 + ;; code offset: 0x604 (local.get $1) ) ) - ;; code offset: 0x610 + ;; code offset: 0x60d (i32.load offset=16 - ;; code offset: 0x60e + ;; code offset: 0x60b (local.get $1) ) ) ) - ;; code offset: 0x61d + ;; code offset: 0x61a (i32.store offset=20 - ;; code offset: 0x616 + ;; code offset: 0x613 (local.get $1) - ;; code offset: 0x61c + ;; code offset: 0x619 (i32.add - ;; code offset: 0x618 + ;; code offset: 0x615 (local.get $0) - ;; code offset: 0x61a + ;; code offset: 0x617 (i32.const 1) ) ) - ;; code offset: 0x624 + ;; code offset: 0x621 (i32.store8 - ;; code offset: 0x620 + ;; code offset: 0x61d (local.get $0) - ;; code offset: 0x622 + ;; code offset: 0x61f (i32.const 10) ) - ;; code offset: 0x629 - (br $label$2 - ;; code offset: 0x627 + ;; code offset: 0x626 + (br $block + ;; code offset: 0x624 (i32.const 0) ) ) - ;; code offset: 0x634 + ;; code offset: 0x631 (i32.shr_s - ;; code offset: 0x630 + ;; code offset: 0x62d (call $13 - ;; code offset: 0x62c + ;; code offset: 0x629 (local.get $1) - ;; code offset: 0x62e + ;; code offset: 0x62b (i32.const 10) ) - ;; code offset: 0x632 + ;; code offset: 0x62f (i32.const 31) ) ) ) - ;; code offset: 0x63a + ;; code offset: 0x637 (if - ;; code offset: 0x638 + ;; code offset: 0x635 (local.get $2) (then - ;; code offset: 0x63e + ;; code offset: 0x63b (call $16 - ;; code offset: 0x63c + ;; code offset: 0x639 (local.get $1) ) ) ) - ;; code offset: 0x641 + ;; code offset: 0x63e (local.get $0) ) (func $15 (param $0 i32) (result i32) - ;; code offset: 0x646 + ;; code offset: 0x643 (i32.const 1) ) (func $16 (param $0 i32) - ;; code offset: 0x64b + ;; code offset: 0x648 (nop) ) (func $17 (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) - ;; code offset: 0x658 + ;; code offset: 0x655 (local.set $1 - ;; code offset: 0x656 + ;; code offset: 0x653 (local.get $0) ) - ;; code offset: 0x65a - (block $label$1 - ;; code offset: 0x65c - (block $label$2 - ;; code offset: 0x664 - (br_if $label$2 - ;; code offset: 0x663 + ;; code offset: 0x657 + (block $block0 + ;; code offset: 0x659 + (block $block + ;; code offset: 0x661 + (br_if $block + ;; code offset: 0x660 (i32.eqz - ;; code offset: 0x662 + ;; code offset: 0x65f (i32.and - ;; code offset: 0x65e + ;; code offset: 0x65b (local.get $0) - ;; code offset: 0x660 + ;; code offset: 0x65d (i32.const 3) ) ) ) - ;; code offset: 0x66c + ;; code offset: 0x669 (if - ;; code offset: 0x66b + ;; code offset: 0x668 (i32.eqz - ;; code offset: 0x668 + ;; code offset: 0x665 (i32.load8_u - ;; code offset: 0x666 + ;; code offset: 0x663 (local.get $0) ) ) (then - ;; code offset: 0x670 + ;; code offset: 0x66d (return - ;; code offset: 0x66e + ;; code offset: 0x66b (i32.const 0) ) ) ) - ;; code offset: 0x672 - (loop $label$4 - ;; code offset: 0x67f - (br_if $label$2 - ;; code offset: 0x67e + ;; code offset: 0x66f + (loop $label + ;; code offset: 0x67c + (br_if $block + ;; code offset: 0x67b (i32.eqz - ;; code offset: 0x67d + ;; code offset: 0x67a (i32.and - ;; code offset: 0x679 + ;; code offset: 0x676 (local.tee $1 - ;; code offset: 0x678 + ;; code offset: 0x675 (i32.add - ;; code offset: 0x674 + ;; code offset: 0x671 (local.get $1) - ;; code offset: 0x676 + ;; code offset: 0x673 (i32.const 1) ) ) - ;; code offset: 0x67b + ;; code offset: 0x678 (i32.const 3) ) ) ) - ;; code offset: 0x686 - (br_if $label$4 - ;; code offset: 0x683 + ;; code offset: 0x683 + (br_if $label + ;; code offset: 0x680 (i32.load8_u - ;; code offset: 0x681 + ;; code offset: 0x67e (local.get $1) ) ) ) - ;; code offset: 0x689 - (br $label$1) + ;; code offset: 0x686 + (br $block0) ) - ;; code offset: 0x68c - (loop $label$5 - ;; code offset: 0x695 + ;; code offset: 0x689 + (loop $label0 + ;; code offset: 0x692 (local.set $1 - ;; code offset: 0x694 + ;; code offset: 0x691 (i32.add - ;; code offset: 0x690 + ;; code offset: 0x68d (local.tee $2 - ;; code offset: 0x68e + ;; code offset: 0x68b (local.get $1) ) - ;; code offset: 0x692 + ;; code offset: 0x68f (i32.const 4) ) ) - ;; code offset: 0x6b2 - (br_if $label$5 - ;; code offset: 0x6b1 + ;; code offset: 0x6af + (br_if $label0 + ;; code offset: 0x6ae (i32.eqz - ;; code offset: 0x6b0 + ;; code offset: 0x6ad (i32.and - ;; code offset: 0x6a9 + ;; code offset: 0x6a6 (i32.and - ;; code offset: 0x6a0 + ;; code offset: 0x69d (i32.xor - ;; code offset: 0x69c + ;; code offset: 0x699 (local.tee $3 - ;; code offset: 0x699 + ;; code offset: 0x696 (i32.load - ;; code offset: 0x697 + ;; code offset: 0x694 (local.get $2) ) ) - ;; code offset: 0x69e + ;; code offset: 0x69b (i32.const -1) ) - ;; code offset: 0x6a8 + ;; code offset: 0x6a5 (i32.add - ;; code offset: 0x6a1 + ;; code offset: 0x69e (local.get $3) - ;; code offset: 0x6a3 + ;; code offset: 0x6a0 (i32.const -16843009) ) ) - ;; code offset: 0x6aa + ;; code offset: 0x6a7 (i32.const -2139062144) ) ) ) ) - ;; code offset: 0x6bc + ;; code offset: 0x6b9 (if - ;; code offset: 0x6bb + ;; code offset: 0x6b8 (i32.eqz - ;; code offset: 0x6ba + ;; code offset: 0x6b7 (i32.and - ;; code offset: 0x6b5 + ;; code offset: 0x6b2 (local.get $3) - ;; code offset: 0x6b7 + ;; code offset: 0x6b4 (i32.const 255) ) ) (then - ;; code offset: 0x6c3 + ;; code offset: 0x6c0 (return - ;; code offset: 0x6c2 + ;; code offset: 0x6bf (i32.sub - ;; code offset: 0x6be + ;; code offset: 0x6bb (local.get $2) - ;; code offset: 0x6c0 + ;; code offset: 0x6bd (local.get $0) ) ) ) ) - ;; code offset: 0x6c5 - (loop $label$7 - ;; code offset: 0x6cc + ;; code offset: 0x6c2 + (loop $label1 + ;; code offset: 0x6c9 (local.set $3 - ;; code offset: 0x6c9 + ;; code offset: 0x6c6 (i32.load8_u offset=1 - ;; code offset: 0x6c7 + ;; code offset: 0x6c4 (local.get $2) ) ) - ;; code offset: 0x6d5 + ;; code offset: 0x6d2 (local.set $2 - ;; code offset: 0x6d3 + ;; code offset: 0x6d0 (local.tee $1 - ;; code offset: 0x6d2 + ;; code offset: 0x6cf (i32.add - ;; code offset: 0x6ce + ;; code offset: 0x6cb (local.get $2) - ;; code offset: 0x6d0 + ;; code offset: 0x6cd (i32.const 1) ) ) ) - ;; code offset: 0x6d9 - (br_if $label$7 - ;; code offset: 0x6d7 + ;; code offset: 0x6d6 + (br_if $label1 + ;; code offset: 0x6d4 (local.get $3) ) ) ) - ;; code offset: 0x6e1 + ;; code offset: 0x6de (i32.sub - ;; code offset: 0x6dd + ;; code offset: 0x6da (local.get $1) - ;; code offset: 0x6df + ;; code offset: 0x6dc (local.get $0) ) ) (func $18 (result i32) - ;; code offset: 0x6e5 + ;; code offset: 0x6e2 (global.get $global$0) ) (func $19 (param $0 i32) - ;; code offset: 0x6ec + ;; code offset: 0x6e9 (global.set $global$0 - ;; code offset: 0x6ea + ;; code offset: 0x6e7 (local.get $0) ) ) (func $20 (param $0 i32) (result i32) (local $1 i32) - ;; code offset: 0x6fd + ;; code offset: 0x6fa (global.set $global$0 - ;; code offset: 0x6fb + ;; code offset: 0x6f8 (local.tee $1 - ;; code offset: 0x6fa + ;; code offset: 0x6f7 (i32.and - ;; code offset: 0x6f7 + ;; code offset: 0x6f4 (i32.sub - ;; code offset: 0x6f3 + ;; code offset: 0x6f0 (global.get $global$0) - ;; code offset: 0x6f5 + ;; code offset: 0x6f2 (local.get $0) ) - ;; code offset: 0x6f8 + ;; code offset: 0x6f5 (i32.const -16) ) ) ) - ;; code offset: 0x6ff + ;; code offset: 0x6fc (local.get $1) ) (func $21 (param $0 i32) (param $1 i32) (param $2 i64) (param $3 i32) (result i64) - ;; code offset: 0x70c + ;; code offset: 0x709 (call_indirect (type $6) - ;; code offset: 0x704 + ;; code offset: 0x701 (local.get $1) - ;; code offset: 0x706 + ;; code offset: 0x703 (local.get $2) - ;; code offset: 0x708 + ;; code offset: 0x705 (local.get $3) - ;; code offset: 0x70a + ;; code offset: 0x707 (local.get $0) ) ) (func $22 (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (result i32) (local $5 i64) - ;; code offset: 0x72c + ;; code offset: 0x729 (call $fimport$2 - ;; code offset: 0x72b + ;; code offset: 0x728 (i32.wrap_i64 - ;; code offset: 0x72a + ;; code offset: 0x727 (i64.shr_u - ;; code offset: 0x726 + ;; code offset: 0x723 (local.tee $5 - ;; code offset: 0x724 + ;; code offset: 0x721 (call $21 - ;; code offset: 0x714 + ;; code offset: 0x711 (local.get $0) - ;; code offset: 0x716 + ;; code offset: 0x713 (local.get $1) - ;; code offset: 0x721 + ;; code offset: 0x71e (i64.or - ;; code offset: 0x71a + ;; code offset: 0x717 (i64.extend_i32_u - ;; code offset: 0x718 + ;; code offset: 0x715 (local.get $2) ) - ;; code offset: 0x720 + ;; code offset: 0x71d (i64.shl - ;; code offset: 0x71d + ;; code offset: 0x71a (i64.extend_i32_u - ;; code offset: 0x71b + ;; code offset: 0x718 (local.get $3) ) - ;; code offset: 0x71e + ;; code offset: 0x71b (i64.const 32) ) ) - ;; code offset: 0x722 + ;; code offset: 0x71f (local.get $4) ) ) - ;; code offset: 0x728 + ;; code offset: 0x725 (i64.const 32) ) ) ) - ;; code offset: 0x730 + ;; code offset: 0x72d (i32.wrap_i64 - ;; code offset: 0x72e + ;; code offset: 0x72b (local.get $5) ) ) (func $23 (param $0 i32) (result i32) - ;; code offset: 0x736 + ;; code offset: 0x733 (memory.grow - ;; code offset: 0x734 + ;; code offset: 0x731 (local.get $0) ) ) diff --git a/test/passes/spill-pointers.txt b/test/passes/spill-pointers.txt index 0c51683efdf..52d7b19a16b 100644 --- a/test/passes/spill-pointers.txt +++ b/test/passes/spill-pointers.txt @@ -12,7 +12,6 @@ (table $0 1 1 funcref) (elem $0 (i32.const 0)) (func $nothing - (nop) ) (func $not-alive (local $x i32) @@ -698,7 +697,6 @@ (global.get $stack_ptr) ) (func $nothing - (nop) ) (func $not-alive (local $x i32) diff --git a/test/reduce/memory_table.wast.txt b/test/reduce/memory_table.wast.txt index 5578072d110..ca2fde91414 100644 --- a/test/reduce/memory_table.wast.txt +++ b/test/reduce/memory_table.wast.txt @@ -13,7 +13,6 @@ (export "f4" (func $2)) (export "f5" (func $3)) (func $0 - (nop) ) (func $1 (result i32) (i32.store diff --git a/test/try-delegate.wasm.fromBinary b/test/try-delegate.wasm.fromBinary index 5b6d7ad2f61..a3e799627d6 100644 --- a/test/try-delegate.wasm.fromBinary +++ b/test/try-delegate.wasm.fromBinary @@ -6,13 +6,11 @@ (do (try (do - (nop) ) (delegate $label) ) ) (catch $tag$0 - (nop) ) ) ) @@ -21,7 +19,6 @@ (do (try (do - (nop) ) (catch $tag$0 (drop @@ -29,7 +26,6 @@ ) (try (do - (nop) ) (delegate $label) ) @@ -37,7 +33,6 @@ ) ) (catch $tag$0 - (nop) ) ) ) From 07c6b9bbeeb78513467da8d750dd5b87bdbb4ba4 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Thu, 14 Nov 2024 16:23:13 -0800 Subject: [PATCH 20/56] Use empty blocks instead of nops for empty scopes in IRBuilder When IRBuilder builds an empty non-block scope such as a function body, an if arm, a try block, etc, it needs to produce some expression to represent the empty contents. Previously it produced a nop, but change it to produce an empty block instead. The binary writer and printer have special logic to elide empty blocks, so this produces smaller output. Update J2CLOpts to recognize functions containing empty blocks as trivial to avoid regressing one of its tests. --- src/passes/J2CLOpts.cpp | 1 + src/wasm/wasm-ir-builder.cpp | 7 +-- test/example/module-splitting.txt | 4 -- test/lit/basic/complexTextNames.wast | 3 -- test/lit/basic/duplicate_types.wast | 3 -- test/lit/basic/exception-handling-legacy.wast | 45 ---------------- test/lit/basic/exception-handling.wast | 6 --- test/lit/basic/multi-table.wast | 6 --- test/lit/basic/pop-fixup.wast | 5 -- test/lit/basic/print-explicit-typeuse.wast | 4 -- test/lit/basic/reference-types.wast | 15 ------ test/lit/basic/shared-types.wast | 2 - test/lit/basic/types-function-references.wast | 12 ----- test/lit/if-then-else.wast | 2 - test/lit/merge/chain.wat | 1 - test/lit/merge/names.wat | 6 --- test/lit/merge/renamings.wat | 4 -- test/lit/merge/table64.wat | 1 - test/lit/non-nullable-locals.wast | 2 - test/lit/passes/abstract-type-refining.wast | 8 --- .../passes/asyncify_enable-multivalue.wast | 2 - .../lit/passes/asyncify_optimize-level=1.wast | 1 - ...syncify_pass-arg=asyncify-addlist@foo.wast | 1 - ...foo_pass-arg=asyncify-ignore-indirect.wast | 1 - ...o_pass-arg=asyncify-propagate-addlist.wast | 1 - ...yncify-imports@env.import,env.import2.wast | 2 - .../lit/passes/coalesce-locals-eh-legacy.wast | 1 - test/lit/passes/code-folding-eh-legacy.wast | 2 - test/lit/passes/code-folding-eh.wast | 1 - test/lit/passes/code-pushing-eh-legacy.wast | 4 -- test/lit/passes/code-pushing-eh.wast | 1 - test/lit/passes/dae-gc-refine-params.wast | 1 - test/lit/passes/dae-gc.wast | 3 -- test/lit/passes/dae_all-features.wast | 8 +-- test/lit/passes/dae_tnh.wast | 2 - test/lit/passes/dce-eh-legacy.wast | 4 -- test/lit/passes/dce-eh.wast | 1 - test/lit/passes/denan.wast | 5 +- test/lit/passes/flatten-eh-legacy.wast | 1 - .../passes/flatten_i64-to-i32-lowering.wast | 2 - ...g_souperify-single-use_enable-threads.wast | 1 - ...ls-nonesting_souperify_enable-threads.wast | 2 - test/lit/passes/fpcast-emu.wast | 4 -- test/lit/passes/global-refining.wast | 4 -- test/lit/passes/gto-removals.wast | 8 --- test/lit/passes/gufa-refs.wast | 5 -- test/lit/passes/heap2local.wast | 1 - test/lit/passes/inlining-eh-legacy.wast | 11 ++-- test/lit/passes/inlining-gc.wast | 6 ++- test/lit/passes/inlining_all-features.wast | 7 +-- test/lit/passes/inlining_splitting.wast | 1 - .../passes/instrument-locals-eh-legacy.wast | 1 - test/lit/passes/j2cl-merge-itables.wast | 2 - test/lit/passes/j2cl.wast | 5 +- ...egalize-js-interface-exported-helpers.wast | 1 - test/lit/passes/local-cse_all-features.wast | 1 - test/lit/passes/monomorphize-context.wast | 25 +++++---- test/lit/passes/monomorphize-limits.wast | 8 +-- test/lit/passes/name-types.wast | 1 - test/lit/passes/once-reduction.wast | 3 -- test/lit/passes/optimize-casts-noeh.wast | 1 - test/lit/passes/optimize-casts.wast | 1 - ...imize-instructions-call_ref-roundtrip.wast | 3 -- .../optimize-instructions-call_ref.wast | 1 - .../optimize-instructions-eh-legacy.wast | 3 -- .../passes/optimize-instructions-gc-iit.wast | 2 - test/lit/passes/optimize-instructions-gc.wast | 1 - .../optimize-instructions-iit-eh-legacy.wast | 1 - .../lit/passes/optimize-instructions-mvp.wast | 1 - test/lit/passes/remove-unused-brs-eh.wast | 2 - test/lit/passes/remove-unused-brs.wast | 1 - .../remove-unused-brs_all-features.wast | 1 - .../remove-unused-module-elements-refs.wast | 52 ------------------- ...e-unused-module-elements_all-features.wast | 4 -- .../remove-unused-module-elements_tnh.wast | 6 --- .../passes/remove-unused-names-eh-legacy.wast | 1 - test/lit/passes/rse-eh-legacy.wast | 12 ----- test/lit/passes/rse-eh.wast | 2 - test/lit/passes/rse-gc.wast | 1 - test/lit/passes/signature-pruning.wast | 16 ------ test/lit/passes/signature-refining.wast | 18 ------- .../lit/passes/simplify-locals-eh-legacy.wast | 3 -- test/lit/passes/simplify-locals-gc.wast | 3 -- test/lit/passes/simplify-locals-global.wast | 1 - test/lit/passes/ssa.wast | 1 - .../passes/stack-ir-roundtrip-eh-legacy.wast | 2 - test/lit/passes/string-lowering_types.wast | 1 - test/lit/passes/translate-to-exnref.wast | 15 +++--- test/lit/passes/type-finalizing.wast | 2 - test/lit/passes/type-generalizing.wast | 1 - test/lit/passes/type-merging-shared.wast | 3 -- test/lit/passes/type-merging.wast | 17 ------ test/lit/passes/type-refining.wast | 1 - test/lit/string.as_wtf16.wast | 1 - test/lit/validation/nn-tuples.wast | 1 - test/lit/wasm-split/passive.wast | 2 - test/lit/wasm-split/ref.func.wast | 2 - test/lit/wat-kitchen-sink.wast | 46 ---------------- test/lld/basic_safe_stack.wat.out | 2 - test/lld/duplicate_imports.wat.out | 1 - test/lld/em_asm.wat.out | 1 - test/lld/em_asm64.wat.out | 1 - test/lld/em_asm_O0.wat.out | 1 - test/lld/em_asm_main_thread.wat.out | 1 - test/lld/em_asm_shared.wat.out | 2 - test/lld/hello_world.wat.out | 1 - test/lld/longjmp.wat.out | 1 - test/lld/main_module_table.wat.out | 1 - test/lld/main_module_table_2.wat.out | 1 - test/lld/main_module_table_3.wat.out | 1 - test/lld/main_module_table_4.wat.out | 1 - test/lld/main_module_table_5.wat.out | 3 -- test/lld/recursive.wat.out | 1 - test/lld/recursive_safe_stack.wat.out | 1 - test/lld/reserved_func_ptr.wat.out | 3 -- test/lld/safe_stack_standalone-wasm.wat.out | 1 - test/lld/shared.wat.out | 1 - test/lld/shared_longjmp.wat.out | 2 - test/metadce/name_collision.wast.dced | 1 - test/metadce/outside.wast.dced | 1 - test/metadce/tag.wast.dced | 1 - ...cate-function-elimination_all-features.txt | 1 - test/passes/func-metrics.txt | 5 +- test/passes/licm.txt | 1 - ...inify-imports-and-exports_all-features.txt | 2 - test/passes/minify-imports_all-features.txt | 2 - test/passes/post-emscripten.txt | 3 -- test/passes/print-function-map.txt | 2 - .../remove-unused-brs_enable-multivalue.txt | 1 - ...unused-names_merge-blocks_all-features.txt | 1 - ...nfunction-module-elements_all-features.txt | 3 -- test/passes/spill-pointers.txt | 2 - 132 files changed, 51 insertions(+), 512 deletions(-) diff --git a/src/passes/J2CLOpts.cpp b/src/passes/J2CLOpts.cpp index cc73e873e26..d0df446e1ff 100644 --- a/src/passes/J2CLOpts.cpp +++ b/src/passes/J2CLOpts.cpp @@ -43,6 +43,7 @@ Expression* getTrivialFunctionBody(Function* func) { // Only consider trivial the following instructions which can be safely // inlined and note that their size is at most 2. if (body->is() || body->is() || body->is() || + (body->is() && body->cast()->list.empty()) || // Call with no arguments. (body->is() && body->dynCast()->operands.size() == 0) || // Simple global.set with a constant. diff --git a/src/wasm/wasm-ir-builder.cpp b/src/wasm/wasm-ir-builder.cpp index 4cb9514f59e..5e5decca42b 100644 --- a/src/wasm/wasm-ir-builder.cpp +++ b/src/wasm/wasm-ir-builder.cpp @@ -157,7 +157,7 @@ void IRBuilder::push(Expression* expr) { Result IRBuilder::build() { if (scopeStack.empty()) { - return builder.makeNop(); + return builder.makeBlock(); } if (scopeStack.size() > 1 || !scopeStack.back().isNone()) { return Err{"unfinished block context"}; @@ -792,12 +792,13 @@ Result IRBuilder::finishScope(Block* block) { Expression* ret = nullptr; if (scope.exprStack.size() == 0) { // No expressions for this scope, but we need something. If we were given a - // block, we can empty it out and return it, but otherwise we need a nop. + // block, we can empty it out and return it, but otherwise create a new + // empty block. if (block) { block->list.clear(); ret = block; } else { - ret = builder.makeNop(); + ret = builder.makeBlock(); } } else if (scope.exprStack.size() == 1) { // We can put our single expression directly into the surrounding scope. diff --git a/test/example/module-splitting.txt b/test/example/module-splitting.txt index fe878d739ab..709ebd4d755 100644 --- a/test/example/module-splitting.txt +++ b/test/example/module-splitting.txt @@ -585,7 +585,6 @@ Before: (elem $0 (global.get $base) $null $foo) (export "foo" (func $foo)) (func $null (type $0) - (nop) ) (func $foo (type $1) (param $0 i32) (result i32) (local.get $0) @@ -607,7 +606,6 @@ After: (export "%table_2" (table $0)) (export "%global" (global $base)) (func $null (type $0) - (nop) ) (func $foo (type $1) (param $0 i32) (result i32) (call_indirect $0 (type $1) @@ -1144,7 +1142,6 @@ Before: (export "foo1" (func $foo)) (export "foo2" (func $foo)) (func $foo (type $0) - (nop) ) ) Keeping: @@ -1169,7 +1166,6 @@ Secondary: (import "primary" "%table" (table $0 1 funcref)) (elem $0 (i32.const 0) $foo) (func $foo (type $0) - (nop) ) ) diff --git a/test/lit/basic/complexTextNames.wast b/test/lit/basic/complexTextNames.wast index 88240e038d8..16c19aadf9a 100644 --- a/test/lit/basic/complexTextNames.wast +++ b/test/lit/basic/complexTextNames.wast @@ -13,12 +13,10 @@ ;; CHECK-TEXT: (type $0 (func)) ;; CHECK-TEXT: (func $foo\20\28.bar\29 (type $0) - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (type $0 (func)) ;; CHECK-BIN: (func $foo\20\28.bar\29 (type $0) - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) (func $foo\20\28.bar\29) @@ -34,7 +32,6 @@ ;; CHECK-BIN-NODEBUG: (type $0 (func)) ;; CHECK-BIN-NODEBUG: (func $0 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $1 (type $0) diff --git a/test/lit/basic/duplicate_types.wast b/test/lit/basic/duplicate_types.wast index 244d97bc9fe..1c1462b3704 100644 --- a/test/lit/basic/duplicate_types.wast +++ b/test/lit/basic/duplicate_types.wast @@ -25,12 +25,10 @@ ;; CHECK-TEXT: (type $1 (func (param i32) (result i32))) ;; CHECK-TEXT: (func $f0 (type $0) (param $0 i32) - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (type $1 (func (param i32) (result i32))) ;; CHECK-BIN: (func $f0 (type $0) (param $0 i32) - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) (func $f0 (param i32)) @@ -47,7 +45,6 @@ ;; CHECK-BIN-NODEBUG: (type $1 (func (param i32) (result i32))) ;; CHECK-BIN-NODEBUG: (func $0 (type $0) (param $0 i32) -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $1 (type $1) (param $0 i32) (result i32) diff --git a/test/lit/basic/exception-handling-legacy.wast b/test/lit/basic/exception-handling-legacy.wast index 6d6c82e83eb..70cc3f5bca6 100644 --- a/test/lit/basic/exception-handling-legacy.wast +++ b/test/lit/basic/exception-handling-legacy.wast @@ -47,18 +47,14 @@ (tag $e-empty) ;; CHECK-TEXT: (func $foo (type $0) - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $foo (type $0) - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) (func $foo) ;; CHECK-TEXT: (func $bar (type $0) - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $bar (type $0) - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) (func $bar) @@ -223,7 +219,6 @@ ;; CHECK-TEXT: (func $empty-try-body (type $0) ;; CHECK-TEXT-NEXT: (try ;; CHECK-TEXT-NEXT: (do - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (catch $e-i32 ;; CHECK-TEXT-NEXT: (drop @@ -235,7 +230,6 @@ ;; CHECK-BIN: (func $empty-try-body (type $0) ;; CHECK-BIN-NEXT: (try $label$3 ;; CHECK-BIN-NEXT: (do - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (catch $e-i32 ;; CHECK-BIN-NEXT: (drop @@ -357,7 +351,6 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (catch_all - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) @@ -369,7 +362,6 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (catch_all - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -461,7 +453,6 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (catch_all - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) @@ -483,7 +474,6 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (catch_all - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) @@ -504,7 +494,6 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (catch_all - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -526,7 +515,6 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (catch_all - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -605,7 +593,6 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (catch_all - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) @@ -628,7 +615,6 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (catch_all - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -674,7 +660,6 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (catch_all - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) @@ -703,7 +688,6 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (catch_all - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -780,20 +764,16 @@ ;; CHECK-TEXT: (func $empty-catch-body (type $0) ;; CHECK-TEXT-NEXT: (try ;; CHECK-TEXT-NEXT: (do - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (catch $e-empty - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $empty-catch-body (type $0) ;; CHECK-BIN-NEXT: (try $label$3 ;; CHECK-BIN-NEXT: (do - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (catch $e-empty - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -1068,7 +1048,6 @@ ;; CHECK-TEXT-NEXT: (rethrow $l0) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (catch_all - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) @@ -1083,7 +1062,6 @@ ;; CHECK-TEXT-NEXT: (rethrow $l00) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (catch_all - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) @@ -1100,7 +1078,6 @@ ;; CHECK-BIN-NEXT: (rethrow $label$6) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (catch_all - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -1115,7 +1092,6 @@ ;; CHECK-BIN-NEXT: (rethrow $label$12) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (catch_all - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -1154,7 +1130,6 @@ ;; CHECK-TEXT: (func $pop-within-if-condition (type $0) ;; CHECK-TEXT-NEXT: (try ;; CHECK-TEXT-NEXT: (do - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (catch $e-i32 ;; CHECK-TEXT-NEXT: (throw $e-i32 @@ -1174,7 +1149,6 @@ ;; CHECK-BIN: (func $pop-within-if-condition (type $0) ;; CHECK-BIN-NEXT: (try $label$5 ;; CHECK-BIN-NEXT: (do - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (catch $e-i32 ;; CHECK-BIN-NEXT: (throw $e-i32 @@ -1214,7 +1188,6 @@ ;; CHECK-TEXT: (func $pop-can-be-supertype (type $0) ;; CHECK-TEXT-NEXT: (try ;; CHECK-TEXT-NEXT: (do - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (catch $e-eqref ;; CHECK-TEXT-NEXT: (drop @@ -1226,7 +1199,6 @@ ;; CHECK-BIN: (func $pop-can-be-supertype (type $0) ;; CHECK-BIN-NEXT: (try $label$3 ;; CHECK-BIN-NEXT: (do - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (catch $e-eqref ;; CHECK-BIN-NEXT: (drop @@ -1297,7 +1269,6 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (try ;; CHECK-TEXT-NEXT: (do - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (delegate 1) ;; CHECK-TEXT-NEXT: ) @@ -1310,7 +1281,6 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (try $label$5 ;; CHECK-BIN-NEXT: (do - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (delegate 1) ;; CHECK-BIN-NEXT: ) @@ -1351,11 +1321,9 @@ ;; CHECK-BIN-NODEBUG: (tag $tag$4) ;; CHECK-BIN-NODEBUG: (func $0 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $1 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $2 (type $0) @@ -1430,7 +1398,6 @@ ;; CHECK-BIN-NODEBUG: (func $5 (type $0) ;; CHECK-BIN-NODEBUG-NEXT: (try $label$3 ;; CHECK-BIN-NODEBUG-NEXT: (do -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (catch $tag$0 ;; CHECK-BIN-NODEBUG-NEXT: (drop @@ -1484,7 +1451,6 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (catch_all -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -1528,7 +1494,6 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (catch_all -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -1550,7 +1515,6 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (catch_all -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -1586,7 +1550,6 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (catch_all -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -1615,7 +1578,6 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (catch_all -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -1640,10 +1602,8 @@ ;; CHECK-BIN-NODEBUG: (func $15 (type $0) ;; CHECK-BIN-NODEBUG-NEXT: (try $label$3 ;; CHECK-BIN-NODEBUG-NEXT: (do -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (catch $tag$4 -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -1745,7 +1705,6 @@ ;; CHECK-BIN-NODEBUG-NEXT: (rethrow $label$6) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (catch_all -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -1760,7 +1719,6 @@ ;; CHECK-BIN-NODEBUG-NEXT: (rethrow $label$12) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (catch_all -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -1770,7 +1728,6 @@ ;; CHECK-BIN-NODEBUG: (func $21 (type $0) ;; CHECK-BIN-NODEBUG-NEXT: (try $label$5 ;; CHECK-BIN-NODEBUG-NEXT: (do -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (catch $tag$0 ;; CHECK-BIN-NODEBUG-NEXT: (throw $tag$0 @@ -1791,7 +1748,6 @@ ;; CHECK-BIN-NODEBUG: (func $22 (type $0) ;; CHECK-BIN-NODEBUG-NEXT: (try $label$3 ;; CHECK-BIN-NODEBUG-NEXT: (do -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (catch $tag$3 ;; CHECK-BIN-NODEBUG-NEXT: (drop @@ -1824,7 +1780,6 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (try $label$5 ;; CHECK-BIN-NODEBUG-NEXT: (do -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (delegate 1) ;; CHECK-BIN-NODEBUG-NEXT: ) diff --git a/test/lit/basic/exception-handling.wast b/test/lit/basic/exception-handling.wast index 05e7c0e31f3..97be09c04ca 100644 --- a/test/lit/basic/exception-handling.wast +++ b/test/lit/basic/exception-handling.wast @@ -67,10 +67,8 @@ (tag $e-empty) ;; CHECK-TEXT: (func $foo (type $0) - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $foo (type $0) - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) (func $foo) @@ -138,7 +136,6 @@ ;; CHECK-TEXT: (func $catchless-try-table (type $0) ;; CHECK-TEXT-NEXT: (try_table - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (try_table ;; CHECK-TEXT-NEXT: (throw $e-empty) @@ -146,7 +143,6 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $catchless-try-table (type $0) ;; CHECK-BIN-NEXT: (try_table - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (try_table ;; CHECK-BIN-NEXT: (throw $e-empty) @@ -753,7 +749,6 @@ ;; CHECK-BIN-NODEBUG: (tag $tag$4) ;; CHECK-BIN-NODEBUG: (func $0 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $1 (type $3) (result exnref) @@ -780,7 +775,6 @@ ;; CHECK-BIN-NODEBUG: (func $2 (type $0) ;; CHECK-BIN-NODEBUG-NEXT: (try_table -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (try_table ;; CHECK-BIN-NODEBUG-NEXT: (throw $tag$4) diff --git a/test/lit/basic/multi-table.wast b/test/lit/basic/multi-table.wast index 71dd275aa72..2d6b436a62d 100644 --- a/test/lit/basic/multi-table.wast +++ b/test/lit/basic/multi-table.wast @@ -97,18 +97,14 @@ (func $f (drop (ref.func $h))) ;; CHECK-TEXT: (func $g (type $none_=>_none) - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $g (type $none_=>_none) - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) (func $g) ;; CHECK-TEXT: (func $h (type $none_=>_none) - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $h (type $none_=>_none) - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) (func $h) ) @@ -155,9 +151,7 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $1 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $2 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) diff --git a/test/lit/basic/pop-fixup.wast b/test/lit/basic/pop-fixup.wast index 371365a0cc9..9ef51dad82d 100644 --- a/test/lit/basic/pop-fixup.wast +++ b/test/lit/basic/pop-fixup.wast @@ -12,7 +12,6 @@ ;; CHECK-NEXT: (local $1 i32) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $e ;; CHECK-NEXT: (local.set $1 @@ -43,7 +42,6 @@ ;; CHECK-NEXT: (local $1 i32) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $e ;; CHECK-NEXT: (local.set $1 @@ -78,7 +76,6 @@ ;; CHECK-NEXT: (local $2 (tuple i32 i32)) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $e2 ;; CHECK-NEXT: (local.set $2 @@ -118,7 +115,6 @@ ;; CHECK-NEXT: (local $2 (tuple i32 i32)) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $e2 ;; CHECK-NEXT: (local.set $2 @@ -164,7 +160,6 @@ ;; CHECK-NEXT: (local $3 (tuple i32 i32)) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $e2 ;; CHECK-NEXT: (local.set $3 diff --git a/test/lit/basic/print-explicit-typeuse.wast b/test/lit/basic/print-explicit-typeuse.wast index d299a3eb430..367159f373d 100644 --- a/test/lit/basic/print-explicit-typeuse.wast +++ b/test/lit/basic/print-explicit-typeuse.wast @@ -33,19 +33,15 @@ (import "" "" (func $rec-import (type $rec))) ;; CHECK: (func $mvp - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $mvp (type $mvp)) ;; CHECK: (func $open (type $open) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $open (type $open)) ;; CHECK: (func $shared (type $shared) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $shared (type $shared)) ;; CHECK: (func $rec (type $rec) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $rec (type $rec)) ) diff --git a/test/lit/basic/reference-types.wast b/test/lit/basic/reference-types.wast index 33593957382..6ef51c23d39 100644 --- a/test/lit/basic/reference-types.wast +++ b/test/lit/basic/reference-types.wast @@ -80,7 +80,6 @@ ;; CHECK-TEXT: (export "export_global" (global $import_global)) ;; CHECK-TEXT: (func $take_eqref (type $sig_eqref) (param $0 eqref) - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (global $global_eqref (mut eqref) (ref.null none)) @@ -105,31 +104,24 @@ ;; CHECK-BIN: (export "export_global" (global $import_global)) ;; CHECK-BIN: (func $take_eqref (type $sig_eqref) (param $0 eqref) - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) (func $take_eqref (param eqref)) ;; CHECK-TEXT: (func $take_funcref (type $sig_funcref) (param $0 funcref) - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $take_funcref (type $sig_funcref) (param $0 funcref) - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) (func $take_funcref (param funcref)) ;; CHECK-TEXT: (func $take_anyref (type $sig_anyref) (param $0 anyref) - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $take_anyref (type $sig_anyref) (param $0 anyref) - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) (func $take_anyref (param anyref)) ;; CHECK-TEXT: (func $foo (type $5) - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $foo (type $3) - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) (func $foo) @@ -2092,10 +2084,8 @@ ) ;; CHECK-TEXT: (func $ref-taken-but-not-in-table (type $5) - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $ref-taken-but-not-in-table (type $3) - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) (func $ref-taken-but-not-in-table) ) @@ -2106,19 +2096,15 @@ ;; CHECK-BIN-NODEBUG: (export "export_global" (global $gimport$0)) ;; CHECK-BIN-NODEBUG: (func $0 (type $5) (param $0 eqref) -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $1 (type $2) (param $0 funcref) -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $2 (type $1) (param $0 anyref) -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $3 (type $3) -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $4 (type $3) @@ -2817,5 +2803,4 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $23 (type $3) -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) diff --git a/test/lit/basic/shared-types.wast b/test/lit/basic/shared-types.wast index 25e593fd2a7..bcf9f6c54c4 100644 --- a/test/lit/basic/shared-types.wast +++ b/test/lit/basic/shared-types.wast @@ -30,7 +30,6 @@ ;; CHECK-NEXT: (local $3 (ref $bot)) ;; CHECK-NEXT: (local $4 (ref $func)) ;; CHECK-NEXT: (local $5 (ref $array)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $use-types (local (ref $final)) @@ -55,7 +54,6 @@ ;; CHECK-NEXT: (local $10 (ref (shared noextern))) ;; CHECK-NEXT: (local $11 (ref (shared nofunc))) ;; CHECK-NEXT: (local $12 (ref (shared noexn))) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $use-basic-types (local (ref (shared extern))) diff --git a/test/lit/basic/types-function-references.wast b/test/lit/basic/types-function-references.wast index 792536cfe30..9500fa4c94c 100644 --- a/test/lit/basic/types-function-references.wast +++ b/test/lit/basic/types-function-references.wast @@ -174,13 +174,11 @@ ;; CHECK-TEXT: (func $type-only-in-tuple-local (type $void) ;; CHECK-TEXT-NEXT: (local $x (tuple i32 (ref null $=>anyref) f64)) - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $type-only-in-tuple-local (type $void) ;; CHECK-BIN-NEXT: (local $x i32) ;; CHECK-BIN-NEXT: (local $1 f64) ;; CHECK-BIN-NEXT: (local $2 (ref null $=>anyref)) - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) (func $type-only-in-tuple-local (local $x (tuple i32 (ref null $=>anyref) f64)) @@ -246,7 +244,6 @@ ;; CHECK-TEXT-NEXT: (local $i3 i64) ;; CHECK-TEXT-NEXT: (local $r5 anyref) ;; CHECK-TEXT-NEXT: (local $r6 funcref) - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $ref-types-first (type $void) ;; CHECK-BIN-NEXT: (local $r1 (ref null $mixed_results)) @@ -258,7 +255,6 @@ ;; CHECK-BIN-NEXT: (local $i1 i32) ;; CHECK-BIN-NEXT: (local $i2 i64) ;; CHECK-BIN-NEXT: (local $i3 i64) - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) (func $ref-types-first ;; 6 reference types and 3 MVP types. The binary format should emit all the @@ -286,7 +282,6 @@ ;; CHECK-TEXT-NEXT: (local $i3 i64) ;; CHECK-TEXT-NEXT: (local $r5 anyref) ;; CHECK-TEXT-NEXT: (local $r6 funcref) - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $mvp-types-first (type $void) ;; CHECK-BIN-NEXT: (local $i1 i32) @@ -298,7 +293,6 @@ ;; CHECK-BIN-NEXT: (local $r4 anyref) ;; CHECK-BIN-NEXT: (local $r5 anyref) ;; CHECK-BIN-NEXT: (local $r6 funcref) - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) (func $mvp-types-first ;; Reversed from before, now an MVP type appears first, so they should all @@ -324,7 +318,6 @@ ;; CHECK-TEXT-NEXT: (local $i3 i64) ;; CHECK-TEXT-NEXT: (local $r5 anyref) ;; CHECK-TEXT-NEXT: (local $r6 funcref) - ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $mvp-types-first-param (type $10) (param $r0 (ref null $mixed_results)) ;; CHECK-BIN-NEXT: (local $i1 i32) @@ -336,7 +329,6 @@ ;; CHECK-BIN-NEXT: (local $r4 anyref) ;; CHECK-BIN-NEXT: (local $r5 anyref) ;; CHECK-BIN-NEXT: (local $r6 funcref) - ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) (func $mvp-types-first-param (param $r0 (ref null $mixed_results)) ;; As before, but now there is a reference type *parameter*. We should @@ -428,7 +420,6 @@ ;; CHECK-BIN-NODEBUG-NEXT: (local $0 i32) ;; CHECK-BIN-NODEBUG-NEXT: (local $1 f64) ;; CHECK-BIN-NODEBUG-NEXT: (local $2 (ref null $9)) -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $8 (type $2) @@ -477,7 +468,6 @@ ;; CHECK-BIN-NODEBUG-NEXT: (local $6 i32) ;; CHECK-BIN-NODEBUG-NEXT: (local $7 i64) ;; CHECK-BIN-NODEBUG-NEXT: (local $8 i64) -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $10 (type $2) @@ -490,7 +480,6 @@ ;; CHECK-BIN-NODEBUG-NEXT: (local $6 anyref) ;; CHECK-BIN-NODEBUG-NEXT: (local $7 anyref) ;; CHECK-BIN-NODEBUG-NEXT: (local $8 funcref) -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $11 (type $10) (param $0 (ref null $0)) @@ -503,5 +492,4 @@ ;; CHECK-BIN-NODEBUG-NEXT: (local $7 anyref) ;; CHECK-BIN-NODEBUG-NEXT: (local $8 anyref) ;; CHECK-BIN-NODEBUG-NEXT: (local $9 funcref) -;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) diff --git a/test/lit/if-then-else.wast b/test/lit/if-then-else.wast index c1247af96ec..7fa59fad0e5 100644 --- a/test/lit/if-then-else.wast +++ b/test/lit/if-then-else.wast @@ -7,7 +7,6 @@ ;; CHECK-NEXT: (if ;; CHECK-NEXT: (local.get $0) ;; CHECK-NEXT: (then - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (else ;; CHECK-NEXT: (return @@ -23,7 +22,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (else - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (return diff --git a/test/lit/merge/chain.wat b/test/lit/merge/chain.wat index 528b20d0eed..9faca1143a9 100644 --- a/test/lit/merge/chain.wat +++ b/test/lit/merge/chain.wat @@ -16,7 +16,6 @@ ;; CHECK: (export "h" (func $0_2)) ;; CHECK: (func $0 (type $0) -;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK: (func $0_2 (type $0) diff --git a/test/lit/merge/names.wat b/test/lit/merge/names.wat index 504dac102c2..6f51b54cac5 100644 --- a/test/lit/merge/names.wat +++ b/test/lit/merge/names.wat @@ -89,7 +89,6 @@ ;; CHECK: (export "func2" (func $5)) ;; CHECK: (func $func0 (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func0 (export "f0")) (func (export "f1")) @@ -117,21 +116,16 @@ (func (export "func") (param $x (ref $t))) ) ;; CHECK: (func $1 (type $0) -;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK: (func $2 (type $3) (param $x (ref $t)) -;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK: (func $func2 (type $0) -;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK: (func $4 (type $0) -;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK: (func $5 (type $4) (param $0 (ref $u)) -;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) diff --git a/test/lit/merge/renamings.wat b/test/lit/merge/renamings.wat index 9c54f3514ec..e680b276b3e 100644 --- a/test/lit/merge/renamings.wat +++ b/test/lit/merge/renamings.wat @@ -141,7 +141,6 @@ ;; CHECK: (func $uses (type $3) (param $array (ref $array)) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $foo ;; CHECK-NEXT: (drop @@ -151,7 +150,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $bar ;; CHECK-NEXT: (drop @@ -323,7 +321,6 @@ ;; CHECK: (func $uses.second (type $3) (param $array (ref $array)) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do -;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $foo_2 ;; CHECK-NEXT: (drop @@ -333,7 +330,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do -;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $other ;; CHECK-NEXT: (drop diff --git a/test/lit/merge/table64.wat b/test/lit/merge/table64.wat index a313b5bc350..e1e41dca936 100644 --- a/test/lit/merge/table64.wat +++ b/test/lit/merge/table64.wat @@ -15,5 +15,4 @@ ;; CHECK: (export "table" (table $table)) ;; CHECK: (func $second (type $0) -;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) diff --git a/test/lit/non-nullable-locals.wast b/test/lit/non-nullable-locals.wast index 21c12d4ad76..6349a0ed425 100644 --- a/test/lit/non-nullable-locals.wast +++ b/test/lit/non-nullable-locals.wast @@ -15,7 +15,6 @@ ;; CHECK: (func $no-uses (type $0) ;; CHECK-NEXT: (local $x (ref func)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $no-uses ;; A local with no uses validates. @@ -171,7 +170,6 @@ ) ;; CHECK: (func $helper (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $helper) diff --git a/test/lit/passes/abstract-type-refining.wast b/test/lit/passes/abstract-type-refining.wast index e887894ea74..5f6010ca07c 100644 --- a/test/lit/passes/abstract-type-refining.wast +++ b/test/lit/passes/abstract-type-refining.wast @@ -242,7 +242,6 @@ ;; YESTNH-NEXT: (local $C (ref $C)) ;; YESTNH-NEXT: (local $D (ref $E)) ;; YESTNH-NEXT: (local $E (ref $E)) - ;; YESTNH-NEXT: (nop) ;; YESTNH-NEXT: ) ;; NO_TNH: (func $locals (type $6) ;; NO_TNH-NEXT: (local $A (ref $A)) @@ -250,7 +249,6 @@ ;; NO_TNH-NEXT: (local $C (ref $C)) ;; NO_TNH-NEXT: (local $D (ref $D)) ;; NO_TNH-NEXT: (local $E (ref $E)) - ;; NO_TNH-NEXT: (nop) ;; NO_TNH-NEXT: ) (func $locals ;; Local variable types are also updated. @@ -799,14 +797,12 @@ ;; YESTNH-NEXT: (local $B (ref none)) ;; YESTNH-NEXT: (local $C1 (ref none)) ;; YESTNH-NEXT: (local $C2 nullref) - ;; YESTNH-NEXT: (nop) ;; YESTNH-NEXT: ) ;; NO_TNH: (func $locals (type $1) ;; NO_TNH-NEXT: (local $A (ref none)) ;; NO_TNH-NEXT: (local $B (ref none)) ;; NO_TNH-NEXT: (local $C1 (ref none)) ;; NO_TNH-NEXT: (local $C2 nullref) - ;; NO_TNH-NEXT: (nop) ;; NO_TNH-NEXT: ) (func $locals ;; All these locals can become nullable or even non-nullable null types. @@ -1002,21 +998,17 @@ ;; YESTNH: (type $3 (func (param funcref))) ;; YESTNH: (func $A (type $A) - ;; YESTNH-NEXT: (nop) ;; YESTNH-NEXT: ) ;; NO_TNH: (type $3 (func (param funcref))) ;; NO_TNH: (func $A (type $A) - ;; NO_TNH-NEXT: (nop) ;; NO_TNH-NEXT: ) (func $A (type $A) ) ;; YESTNH: (func $C (type $A) - ;; YESTNH-NEXT: (nop) ;; YESTNH-NEXT: ) ;; NO_TNH: (func $C (type $A) - ;; NO_TNH-NEXT: (nop) ;; NO_TNH-NEXT: ) (func $C (type $A) ) diff --git a/test/lit/passes/asyncify_enable-multivalue.wast b/test/lit/passes/asyncify_enable-multivalue.wast index f29edd4a544..86a8bc47e65 100644 --- a/test/lit/passes/asyncify_enable-multivalue.wast +++ b/test/lit/passes/asyncify_enable-multivalue.wast @@ -193,7 +193,6 @@ (call $stuff) ;; do some more work ) ;; CHECK: (func $stuff - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $stuff) ;; the first event called from the main event loop: just call into $work @@ -2484,7 +2483,6 @@ (call $import) ) ;; CHECK: (func $boring - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $boring) ;; CHECK: (func $calls-mix-deep diff --git a/test/lit/passes/asyncify_optimize-level=1.wast b/test/lit/passes/asyncify_optimize-level=1.wast index d7627f40781..4839b08bbae 100644 --- a/test/lit/passes/asyncify_optimize-level=1.wast +++ b/test/lit/passes/asyncify_optimize-level=1.wast @@ -1425,7 +1425,6 @@ (call $import) ) ;; CHECK: (func $boring - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $boring) ;; CHECK: (func $calls-mix-deep diff --git a/test/lit/passes/asyncify_pass-arg=asyncify-addlist@foo.wast b/test/lit/passes/asyncify_pass-arg=asyncify-addlist@foo.wast index 92dbe2bb230..2803d243d06 100644 --- a/test/lit/passes/asyncify_pass-arg=asyncify-addlist@foo.wast +++ b/test/lit/passes/asyncify_pass-arg=asyncify-addlist@foo.wast @@ -114,7 +114,6 @@ (call $nothing) ) ;; CHECK: (func $nothing - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $nothing ) diff --git a/test/lit/passes/asyncify_pass-arg=asyncify-addlist@foo_pass-arg=asyncify-ignore-indirect.wast b/test/lit/passes/asyncify_pass-arg=asyncify-addlist@foo_pass-arg=asyncify-ignore-indirect.wast index 81107cb164c..5f4fb89def7 100644 --- a/test/lit/passes/asyncify_pass-arg=asyncify-addlist@foo_pass-arg=asyncify-ignore-indirect.wast +++ b/test/lit/passes/asyncify_pass-arg=asyncify-addlist@foo_pass-arg=asyncify-ignore-indirect.wast @@ -155,7 +155,6 @@ (call_indirect (type $t) (i32.const 0)) ) ;; CHECK: (func $nothing - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $nothing ) diff --git a/test/lit/passes/asyncify_pass-arg=asyncify-addlist@foo_pass-arg=asyncify-propagate-addlist.wast b/test/lit/passes/asyncify_pass-arg=asyncify-addlist@foo_pass-arg=asyncify-propagate-addlist.wast index b0b758b4921..37075e800a4 100644 --- a/test/lit/passes/asyncify_pass-arg=asyncify-addlist@foo_pass-arg=asyncify-propagate-addlist.wast +++ b/test/lit/passes/asyncify_pass-arg=asyncify-addlist@foo_pass-arg=asyncify-propagate-addlist.wast @@ -113,7 +113,6 @@ (call $nothing) ) ;; CHECK: (func $nothing - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $nothing ) diff --git a/test/lit/passes/asyncify_pass-arg=asyncify-imports@env.import,env.import2.wast b/test/lit/passes/asyncify_pass-arg=asyncify-imports@env.import,env.import2.wast index 801ab5eb954..36e1aa68ca1 100644 --- a/test/lit/passes/asyncify_pass-arg=asyncify-imports@env.import,env.import2.wast +++ b/test/lit/passes/asyncify_pass-arg=asyncify-imports@env.import,env.import2.wast @@ -193,7 +193,6 @@ (call $stuff) ;; do some more work ) ;; CHECK: (func $stuff - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $stuff) ;; the first event called from the main event loop: just call into $work @@ -1610,7 +1609,6 @@ (call $import) ) ;; CHECK: (func $boring - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $boring) ;; CHECK: (func $calls-mix-deep diff --git a/test/lit/passes/coalesce-locals-eh-legacy.wast b/test/lit/passes/coalesce-locals-eh-legacy.wast index 9091fdcb960..b5b41b66154 100644 --- a/test/lit/passes/coalesce-locals-eh-legacy.wast +++ b/test/lit/passes/coalesce-locals-eh-legacy.wast @@ -50,7 +50,6 @@ ;; CHECK-NEXT: (local $0 anyref) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $any ;; CHECK-NEXT: (drop diff --git a/test/lit/passes/code-folding-eh-legacy.wast b/test/lit/passes/code-folding-eh-legacy.wast index 852ec126a92..81180d04463 100644 --- a/test/lit/passes/code-folding-eh-legacy.wast +++ b/test/lit/passes/code-folding-eh-legacy.wast @@ -12,7 +12,6 @@ ;; CHECK-NEXT: (do ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $e-i32 ;; CHECK-NEXT: (drop @@ -112,7 +111,6 @@ ;; CHECK: (func $foo (type $1) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo) diff --git a/test/lit/passes/code-folding-eh.wast b/test/lit/passes/code-folding-eh.wast index 5a7cd68c783..94eb0b38d32 100644 --- a/test/lit/passes/code-folding-eh.wast +++ b/test/lit/passes/code-folding-eh.wast @@ -53,7 +53,6 @@ ;; CHECK: (func $foo (type $1) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo) diff --git a/test/lit/passes/code-pushing-eh-legacy.wast b/test/lit/passes/code-pushing-eh-legacy.wast index 9511d244a41..06b2e3e7140 100644 --- a/test/lit/passes/code-pushing-eh-legacy.wast +++ b/test/lit/passes/code-pushing-eh-legacy.wast @@ -17,7 +17,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop @@ -53,7 +52,6 @@ ) ;; CHECK: (func $foo (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo) @@ -166,7 +164,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop @@ -224,7 +221,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop diff --git a/test/lit/passes/code-pushing-eh.wast b/test/lit/passes/code-pushing-eh.wast index ee2798c4605..3c6d005b123 100644 --- a/test/lit/passes/code-pushing-eh.wast +++ b/test/lit/passes/code-pushing-eh.wast @@ -118,7 +118,6 @@ ) ;; CHECK: (func $foo (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo) diff --git a/test/lit/passes/dae-gc-refine-params.wast b/test/lit/passes/dae-gc-refine-params.wast index f9e9c4651c9..8cefbe88184 100644 --- a/test/lit/passes/dae-gc-refine-params.wast +++ b/test/lit/passes/dae-gc-refine-params.wast @@ -316,7 +316,6 @@ ;; CHECK: (func $unused-and-refinable (type $2) ;; CHECK-NEXT: (local $0 structref) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $unused-and-refinable (param $0 structref) ;; This function does not use $0. It is called with $"{}", so it is also diff --git a/test/lit/passes/dae-gc.wast b/test/lit/passes/dae-gc.wast index 9878230207f..1f39567d146 100644 --- a/test/lit/passes/dae-gc.wast +++ b/test/lit/passes/dae-gc.wast @@ -155,15 +155,12 @@ ;; Helper functions so we have something to take the reference of. ;; CHECK: (func $a (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $a) ;; CHECK: (func $b (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $b) ;; CHECK: (func $c (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $c) ) diff --git a/test/lit/passes/dae_all-features.wast b/test/lit/passes/dae_all-features.wast index da9558dd8e0..145ae1ff032 100644 --- a/test/lit/passes/dae_all-features.wast +++ b/test/lit/passes/dae_all-features.wast @@ -33,7 +33,8 @@ ;; CHECK-NEXT: (local.set $0 ;; CHECK-NEXT: (i32.const 1) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $a (param $x i32)) ;; CHECK: (func $b (type $0) @@ -114,7 +115,8 @@ ;; CHECK-NEXT: (local.set $0 ;; CHECK-NEXT: (i32.const 4) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $a4 (param $x i32) ;; This function is called with one constant and one unreachable. We can @@ -219,7 +221,6 @@ (call $a7 (i32.const 1) (call $get-f64)) ) ;; CHECK: (func $a8 (type $1) (param $x i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $a8 (param $x i32)) ;; exported, do not optimize ;; CHECK: (func $b8 (type $0) @@ -231,7 +232,6 @@ (call $a8 (i32.const 1)) ) ;; CHECK: (func $a9 (type $1) (param $x i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $a9 (param $x i32)) ;; tabled, do not optimize ;; CHECK: (func $b9 (type $0) diff --git a/test/lit/passes/dae_tnh.wast b/test/lit/passes/dae_tnh.wast index 2bba6570b7c..6e78283fdce 100644 --- a/test/lit/passes/dae_tnh.wast +++ b/test/lit/passes/dae_tnh.wast @@ -57,7 +57,6 @@ ) ;; CHECK: (func $target (type $1) (param $0 i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $target (param i32) ) @@ -105,7 +104,6 @@ ) ;; CHECK: (func $target (type $1) (param $0 i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $target (param i32) ) diff --git a/test/lit/passes/dce-eh-legacy.wast b/test/lit/passes/dce-eh-legacy.wast index 107c35609cd..31ba4fac2de 100644 --- a/test/lit/passes/dce-eh-legacy.wast +++ b/test/lit/passes/dce-eh-legacy.wast @@ -25,7 +25,6 @@ (tag $e-eqref (param (ref null eq))) ;; CHECK: (func $foo (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo) @@ -35,7 +34,6 @@ ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (call $foo) @@ -53,7 +51,6 @@ ;; CHECK: (func $catch_unreachable (type $0) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all ;; CHECK-NEXT: (unreachable) @@ -96,7 +93,6 @@ ;; CHECK: (func $rethrow (type $0) ;; CHECK-NEXT: (try $l0 ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $e ;; CHECK-NEXT: (drop diff --git a/test/lit/passes/dce-eh.wast b/test/lit/passes/dce-eh.wast index 413a278d0b8..b2742913b54 100644 --- a/test/lit/passes/dce-eh.wast +++ b/test/lit/passes/dce-eh.wast @@ -11,7 +11,6 @@ (tag $e-i32 (param i32)) ;; CHECK: (func $foo (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo) diff --git a/test/lit/passes/denan.wast b/test/lit/passes/denan.wast index bc42ab04e57..9f167b15d91 100644 --- a/test/lit/passes/denan.wast +++ b/test/lit/passes/denan.wast @@ -59,7 +59,8 @@ ;; CHECK-NEXT: (local.get $w) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $various (param $x i32) (param $y f32) (param $z i64) (param $w f64) ) @@ -251,11 +252,9 @@ ;; CHECK: (type $2 (func (param f64) (result f64))) ;; CHECK: (func $deNan32 - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $deNan32) ;; CHECK: (func $deNan64 - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $deNan64) ;; CHECK: (func $foo32 (param $x f32) (result f32) diff --git a/test/lit/passes/flatten-eh-legacy.wast b/test/lit/passes/flatten-eh-legacy.wast index 56057b7798e..34b5cf08b82 100644 --- a/test/lit/passes/flatten-eh-legacy.wast +++ b/test/lit/passes/flatten-eh-legacy.wast @@ -61,7 +61,6 @@ ;; CHECK-NEXT: (block $l0 ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $e-i32 ;; CHECK-NEXT: (local.set $1 diff --git a/test/lit/passes/flatten_i64-to-i32-lowering.wast b/test/lit/passes/flatten_i64-to-i32-lowering.wast index 5a185cc0aeb..e5e556c79ab 100644 --- a/test/lit/passes/flatten_i64-to-i32-lowering.wast +++ b/test/lit/passes/flatten_i64-to-i32-lowering.wast @@ -480,7 +480,6 @@ ;; CHECK: (export "unreach" (func $unreach)) ;; CHECK: (func $call (type $1) (param $0 i32) (param $0$hi i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $call (param i64)) ;; CHECK: (func $exp (type $0) @@ -586,7 +585,6 @@ ;; CHECK: (export "exp" (func $exp)) ;; CHECK: (func $call (type $0) (param $0 i32) (param $0$hi i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $call (param i64)) ;; CHECK: (func $exp (type $1) diff --git a/test/lit/passes/flatten_simplify-locals-nonesting_souperify-single-use_enable-threads.wast b/test/lit/passes/flatten_simplify-locals-nonesting_souperify-single-use_enable-threads.wast index 76b4e6e51f0..f71970035af 100644 --- a/test/lit/passes/flatten_simplify-locals-nonesting_souperify-single-use_enable-threads.wast +++ b/test/lit/passes/flatten_simplify-locals-nonesting_souperify-single-use_enable-threads.wast @@ -2477,7 +2477,6 @@ ;; CHECK-NEXT: (i32.const 2) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (loop $loopy - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: (nop) diff --git a/test/lit/passes/flatten_simplify-locals-nonesting_souperify_enable-threads.wast b/test/lit/passes/flatten_simplify-locals-nonesting_souperify_enable-threads.wast index 5c11e34e364..d57df657913 100644 --- a/test/lit/passes/flatten_simplify-locals-nonesting_souperify_enable-threads.wast +++ b/test/lit/passes/flatten_simplify-locals-nonesting_souperify_enable-threads.wast @@ -318,7 +318,6 @@ ) ) ;; CHECK: (func $send-i32 (param $0 i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $send-i32 (param i32)) ;; flipping of greater than/or equals ops, which are not in Souper IR @@ -2545,7 +2544,6 @@ ;; CHECK-NEXT: (i32.const 2) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (loop $loopy - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: (nop) diff --git a/test/lit/passes/fpcast-emu.wast b/test/lit/passes/fpcast-emu.wast index 8ded8264724..9da081c4ac5 100644 --- a/test/lit/passes/fpcast-emu.wast +++ b/test/lit/passes/fpcast-emu.wast @@ -370,19 +370,15 @@ ;; CHECK: (export "dynCall_vd" (func $min_vd)) (export "dynCall_vd" (func $min_vd)) ;; CHECK: (func $a (param $0 f32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $a (param $0 f32)) ;; CHECK: (func $b (param $0 f64) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $b (param $0 f64)) ;; CHECK: (func $dynCall_vf (param $0 f32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $dynCall_vf (param $0 f32)) ;; CHECK: (func $min_vd (param $0 f32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $min_vd (param $0 f32)) ) diff --git a/test/lit/passes/global-refining.wast b/test/lit/passes/global-refining.wast index 1ede2009eb9..927dfd1f26c 100644 --- a/test/lit/passes/global-refining.wast +++ b/test/lit/passes/global-refining.wast @@ -18,10 +18,8 @@ ;; CLOSD: (global $func-func-init (mut (ref $foo_t)) (ref.func $foo)) (global $func-func-init (mut funcref) (ref.func $foo)) ;; CHECK: (func $foo (type $foo_t) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CLOSD: (func $foo (type $foo_t) - ;; CLOSD-NEXT: (nop) ;; CLOSD-NEXT: ) (func $foo (type $foo_t)) ) @@ -188,10 +186,8 @@ (global $b (ref $super) (global.get $a)) ;; CHECK: (func $func (type $sub) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CLOSD: (func $func (type $sub) - ;; CLOSD-NEXT: (nop) ;; CLOSD-NEXT: ) (func $func (type $sub) ) diff --git a/test/lit/passes/gto-removals.wast b/test/lit/passes/gto-removals.wast index 99579f8ab1d..a6fd9c22857 100644 --- a/test/lit/passes/gto-removals.wast +++ b/test/lit/passes/gto-removals.wast @@ -12,7 +12,6 @@ ;; CHECK: (type $1 (func (param (ref $struct)))) ;; CHECK: (func $func (type $1) (param $x (ref $struct)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func (param $x (ref $struct)) ) @@ -328,23 +327,18 @@ ) ;; CHECK: (func $func-0 (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func-0) ;; CHECK: (func $func-1 (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func-1) ;; CHECK: (func $func-2 (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func-2) ;; CHECK: (func $func-3 (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func-3) ;; CHECK: (func $func-4 (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func-4) ) @@ -1254,7 +1248,6 @@ ;; CHECK: (type $2 (func (param (ref $B)))) ;; CHECK: (func $func (type $2) (param $x (ref $B)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func (param $x (ref $B)) ;; Use $B in a param to keep it alive, and lead us to process it and $A. @@ -1273,7 +1266,6 @@ ;; CHECK: (type $2 (func (param (ref $B)))) ;; CHECK: (func $func (type $2) (param $x (ref $B)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func (param $x (ref $B)) ) diff --git a/test/lit/passes/gufa-refs.wast b/test/lit/passes/gufa-refs.wast index 6722d0ed452..9772745bc28 100644 --- a/test/lit/passes/gufa-refs.wast +++ b/test/lit/passes/gufa-refs.wast @@ -1917,7 +1917,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $nothing ;; CHECK-NEXT: (local.set $0 @@ -1943,7 +1942,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $something ;; CHECK-NEXT: (drop @@ -2146,7 +2144,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $tag ;; CHECK-NEXT: (local.set $0 @@ -2164,7 +2161,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $tag ;; CHECK-NEXT: (drop @@ -2393,7 +2389,6 @@ ) ;; CHECK: (func $foo (type $1) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo) ) diff --git a/test/lit/passes/heap2local.wast b/test/lit/passes/heap2local.wast index 179437c3874..bad4a33bf30 100644 --- a/test/lit/passes/heap2local.wast +++ b/test/lit/passes/heap2local.wast @@ -485,7 +485,6 @@ ) ;; CHECK: (func $send-ref (type $5) (param $0 (ref null $struct.A)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $send-ref (param (ref null $struct.A)) ) diff --git a/test/lit/passes/inlining-eh-legacy.wast b/test/lit/passes/inlining-eh-legacy.wast index 9135f786ed0..4d9d3a7aa94 100644 --- a/test/lit/passes/inlining-eh-legacy.wast +++ b/test/lit/passes/inlining-eh-legacy.wast @@ -25,7 +25,6 @@ ;; CHECK-NEXT: (block $__inlined_func$callee-with-label ;; CHECK-NEXT: (try $label0 ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $tag$0 ;; CHECK-NEXT: (drop @@ -52,7 +51,6 @@ ;; CHECK: (func $callee-with-try-delegate (type $0) ;; CHECK-NEXT: (try $label$3 ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (delegate 0) ;; CHECK-NEXT: ) @@ -83,7 +81,6 @@ ;; CHECK: (func $caller-with-try-delegate (type $2) (result i32) ;; CHECK-NEXT: (try $label$3 ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (delegate 0) ;; CHECK-NEXT: ) @@ -107,14 +104,14 @@ ;; CHECK-NEXT: (local $0 i32) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $tag$0 ;; CHECK-NEXT: (block $__inlined_func$callee-b$2 ;; CHECK-NEXT: (local.set $0 ;; CHECK-NEXT: (pop i32) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -144,7 +141,6 @@ ;; CHECK-NEXT: (local $2 i32) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $tag$0 ;; CHECK-NEXT: (local.set $2 @@ -159,7 +155,8 @@ ;; CHECK-NEXT: (local.get $0) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) diff --git a/test/lit/passes/inlining-gc.wast b/test/lit/passes/inlining-gc.wast index 8da522e1d15..445cbf04208 100644 --- a/test/lit/passes/inlining-gc.wast +++ b/test/lit/passes/inlining-gc.wast @@ -8,7 +8,8 @@ ;; CHECK-NEXT: (local.set $0 ;; CHECK-NEXT: (ref.null nofunc) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $caller-nullable @@ -27,7 +28,8 @@ ;; CHECK: (func $caller-non-nullable (type $0) ;; CHECK-NEXT: (local $0 (ref func)) ;; CHECK-NEXT: (block $__inlined_func$target-non-nullable$1 - ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $caller-non-nullable diff --git a/test/lit/passes/inlining_all-features.wast b/test/lit/passes/inlining_all-features.wast index 38d24ab72bb..860f5b8f75f 100644 --- a/test/lit/passes/inlining_all-features.wast +++ b/test/lit/passes/inlining_all-features.wast @@ -15,13 +15,13 @@ ;; $foo should not be removed after being inlined, because there is 'ref.func' ;; instruction that refers to it ;; CHECK: (func $foo (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo) ;; CHECK: (func $ref_func_test (type $1) (result funcref) ;; CHECK-NEXT: (block $__inlined_func$foo - ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (ref.func $foo) ;; CHECK-NEXT: ) @@ -160,7 +160,8 @@ ;; CHECK-NEXT: (local.get $0) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $caller-with-pop-twice diff --git a/test/lit/passes/inlining_splitting.wast b/test/lit/passes/inlining_splitting.wast index 84c0b9832a3..f3d7f44a4d2 100644 --- a/test/lit/passes/inlining_splitting.wast +++ b/test/lit/passes/inlining_splitting.wast @@ -856,7 +856,6 @@ ) ;; CHECK: (func $byn-split-outlined-A$colliding-name (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $byn-split-outlined-A$colliding-name ;; This function's name might collide with the split function we create for diff --git a/test/lit/passes/instrument-locals-eh-legacy.wast b/test/lit/passes/instrument-locals-eh-legacy.wast index 8ee5535544f..23d944a0cff 100644 --- a/test/lit/passes/instrument-locals-eh-legacy.wast +++ b/test/lit/passes/instrument-locals-eh-legacy.wast @@ -9,7 +9,6 @@ ;; CHECK-NEXT: (local $x i32) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $e ;; CHECK-NEXT: (local.set $x diff --git a/test/lit/passes/j2cl-merge-itables.wast b/test/lit/passes/j2cl-merge-itables.wast index 499f598e127..8506724fd1a 100644 --- a/test/lit/passes/j2cl-merge-itables.wast +++ b/test/lit/passes/j2cl-merge-itables.wast @@ -65,7 +65,6 @@ (struct.new $Object.vtable)) ;; CHECK: (func $SubObject.f (type $function) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $SubObject.f (type $function) @@ -180,7 +179,6 @@ (struct.new_default $Object.itable)) ;; CHECK: (func $SubObject.f (type $function) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $SubObject.f (type $function) diff --git a/test/lit/passes/j2cl.wast b/test/lit/passes/j2cl.wast index 4fe661e5c96..e17d9f43c1c 100644 --- a/test/lit/passes/j2cl.wast +++ b/test/lit/passes/j2cl.wast @@ -212,7 +212,6 @@ ;; CHECK: (func $notOnceFunction@Zoo (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $notOnceFunction@Zoo ) @@ -225,7 +224,6 @@ ) ;; CHECK: (func $empty__@Zoo (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $empty__@Zoo ) @@ -255,7 +253,8 @@ ;; CHECK: (func $caller_@Zoo (type $1) (result i32) ;; CHECK-NEXT: (nop) - ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: ) ;; CHECK-NEXT: (call $notOnceFunction@Zoo) ;; CHECK-NEXT: (global.set $$var2@Zoo ;; CHECK-NEXT: (i32.const 3) diff --git a/test/lit/passes/legalize-js-interface-exported-helpers.wast b/test/lit/passes/legalize-js-interface-exported-helpers.wast index 707cbe5c9b1..bed768f1a0d 100644 --- a/test/lit/passes/legalize-js-interface-exported-helpers.wast +++ b/test/lit/passes/legalize-js-interface-exported-helpers.wast @@ -31,7 +31,6 @@ (i64.const 0) ) ;; CHECK: (func $__set_temp_ret (param $0 i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $__set_temp_ret (param i32)) ;; CHECK: (func $__get_temp_ret (result i32) diff --git a/test/lit/passes/local-cse_all-features.wast b/test/lit/passes/local-cse_all-features.wast index 8878d595fe9..e8d7da4c7f5 100644 --- a/test/lit/passes/local-cse_all-features.wast +++ b/test/lit/passes/local-cse_all-features.wast @@ -509,7 +509,6 @@ ) ;; CHECK: (func $callee (type $2) (param $x i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $callee (param $x i32) ) diff --git a/test/lit/passes/monomorphize-context.wast b/test/lit/passes/monomorphize-context.wast index cc4bdfc9d2e..7f9cb2f566e 100644 --- a/test/lit/passes/monomorphize-context.wast +++ b/test/lit/passes/monomorphize-context.wast @@ -177,7 +177,6 @@ ) ;; ALWAYS: (func $target (type $1) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (param $5 i32) (param $6 i32) (param $7 i32) (param $8 i32) (param $9 i32) (param $10 anyref) (param $11 funcref) (param $12 i32) (param $13 f64) (param $14 i32) (param $15 anyref) (param $16 anyref) - ;; ALWAYS-NEXT: (nop) ;; ALWAYS-NEXT: ) ;; CAREFUL: (func $target (type $1) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (param $5 i32) (param $6 i32) (param $7 i32) (param $8 i32) (param $9 i32) (param $10 anyref) (param $11 funcref) (param $12 i32) (param $13 f64) (param $14 i32) (param $15 anyref) (param $16 anyref) ;; CAREFUL-NEXT: (nop) @@ -285,7 +284,8 @@ ;; ALWAYS-NEXT: (local.set $22 ;; ALWAYS-NEXT: (struct.new_default $struct) ;; ALWAYS-NEXT: ) -;; ALWAYS-NEXT: (nop) +;; ALWAYS-NEXT: (block +;; ALWAYS-NEXT: ) ;; ALWAYS-NEXT: ) ;; CAREFUL: (func $target_2 (type $2) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (param $5 i32) @@ -1333,7 +1333,6 @@ ) ;; ALWAYS: (func $target (type $1) (param $0 i32) (param $1 i32) - ;; ALWAYS-NEXT: (nop) ;; ALWAYS-NEXT: ) ;; CAREFUL: (func $target (type $1) (param $0 i32) (param $1 i32) ;; CAREFUL-NEXT: (nop) @@ -1353,7 +1352,8 @@ ;; ALWAYS-NEXT: (i32.const 0) ;; ALWAYS-NEXT: ) ;; ALWAYS-NEXT: ) -;; ALWAYS-NEXT: (nop) +;; ALWAYS-NEXT: (block +;; ALWAYS-NEXT: ) ;; ALWAYS-NEXT: ) (module (memory 10 20) @@ -1414,7 +1414,6 @@ ) ;; ALWAYS: (func $target (type $0) (param $0 i32) - ;; ALWAYS-NEXT: (nop) ;; ALWAYS-NEXT: ) ;; CAREFUL: (func $target (type $1) (param $0 i32) ;; CAREFUL-NEXT: (nop) @@ -1432,7 +1431,8 @@ ;; ALWAYS-NEXT: (i32.const 1) ;; ALWAYS-NEXT: ) ;; ALWAYS-NEXT: ) -;; ALWAYS-NEXT: (nop) +;; ALWAYS-NEXT: (block +;; ALWAYS-NEXT: ) ;; ALWAYS-NEXT: ) (module ;; ALWAYS: (type $0 (func)) @@ -1551,7 +1551,6 @@ ) ;; ALWAYS: (func $target (type $2) (param $0 anyref) - ;; ALWAYS-NEXT: (nop) ;; ALWAYS-NEXT: ) ;; CAREFUL: (func $target (type $1) (param $0 anyref) ;; CAREFUL-NEXT: (nop) @@ -1569,7 +1568,8 @@ ;; ALWAYS-NEXT: (local.get $1) ;; ALWAYS-NEXT: ) ;; ALWAYS-NEXT: ) -;; ALWAYS-NEXT: (nop) +;; ALWAYS-NEXT: (block +;; ALWAYS-NEXT: ) ;; ALWAYS-NEXT: ) ;; ALWAYS: (func $target_4 (type $4) (param $0 i32) @@ -1582,7 +1582,8 @@ ;; ALWAYS-NEXT: ) ;; ALWAYS-NEXT: ) ;; ALWAYS-NEXT: ) -;; ALWAYS-NEXT: (nop) +;; ALWAYS-NEXT: (block +;; ALWAYS-NEXT: ) ;; ALWAYS-NEXT: ) ;; CAREFUL: (func $target_3 (type $2) (param $0 i32) (param $1 i32) @@ -1719,7 +1720,6 @@ ) ;; ALWAYS: (func $target (type $1) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (param $5 i32) - ;; ALWAYS-NEXT: (nop) ;; ALWAYS-NEXT: ) ;; CAREFUL: (func $target (type $1) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (param $5 i32) ;; CAREFUL-NEXT: (nop) @@ -1756,7 +1756,8 @@ ;; ALWAYS-NEXT: (i32.const 0) ;; ALWAYS-NEXT: ) ;; ALWAYS-NEXT: ) -;; ALWAYS-NEXT: (nop) +;; ALWAYS-NEXT: (block +;; ALWAYS-NEXT: ) ;; ALWAYS-NEXT: ) (module ;; ALWAYS: (type $0 (func)) @@ -1795,10 +1796,8 @@ ) ;; ALWAYS: (func $target (type $1) (param $0 f32) - ;; ALWAYS-NEXT: (nop) ;; ALWAYS-NEXT: ) ;; CAREFUL: (func $target (type $1) (param $0 f32) - ;; CAREFUL-NEXT: (nop) ;; CAREFUL-NEXT: ) (func $target (param $0 f32) ) diff --git a/test/lit/passes/monomorphize-limits.wast b/test/lit/passes/monomorphize-limits.wast index 344f55b51a0..29dd9de20d5 100644 --- a/test/lit/passes/monomorphize-limits.wast +++ b/test/lit/passes/monomorphize-limits.wast @@ -112,7 +112,6 @@ ) ;; ALWAYS: (func $many-params (type $1) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (param $5 i32) (param $6 i32) (param $7 i32) (param $8 i32) (param $9 i32) (param $10 i32) (param $11 i32) (param $12 i32) (param $13 i32) (param $14 i32) (param $15 i32) (param $16 i32) (param $17 i32) (param $18 i32) (param $19 i32) (param $20 i32) (param $21 i32) (param $22 i32) (param $23 i32) (param $24 i32) - ;; ALWAYS-NEXT: (nop) ;; ALWAYS-NEXT: ) ;; CAREFUL: (func $many-params (type $1) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (param $5 i32) (param $6 i32) (param $7 i32) (param $8 i32) (param $9 i32) (param $10 i32) (param $11 i32) (param $12 i32) (param $13 i32) (param $14 i32) (param $15 i32) (param $16 i32) (param $17 i32) (param $18 i32) (param $19 i32) (param $20 i32) (param $21 i32) (param $22 i32) (param $23 i32) (param $24 i32) ;; CAREFUL-NEXT: (nop) @@ -227,7 +226,8 @@ ;; ALWAYS-NEXT: (local.set $24 ;; ALWAYS-NEXT: (i32.const 25) ;; ALWAYS-NEXT: ) -;; ALWAYS-NEXT: (nop) +;; ALWAYS-NEXT: (block +;; ALWAYS-NEXT: ) ;; ALWAYS-NEXT: ) ;; CAREFUL: (func $many-params_3 (type $0) @@ -353,7 +353,6 @@ ) ;; ALWAYS: (func $target (type $3) (param $array (ref $array)) - ;; ALWAYS-NEXT: (nop) ;; ALWAYS-NEXT: ) ;; CAREFUL: (func $target (type $3) (param $0 (ref $array)) ;; CAREFUL-NEXT: (nop) @@ -392,7 +391,8 @@ ;; ALWAYS-NEXT: (i32.const 25) ;; ALWAYS-NEXT: ) ;; ALWAYS-NEXT: ) -;; ALWAYS-NEXT: (nop) +;; ALWAYS-NEXT: (block +;; ALWAYS-NEXT: ) ;; ALWAYS-NEXT: ) ;; CAREFUL: (func $target_3 (type $1) diff --git a/test/lit/passes/name-types.wast b/test/lit/passes/name-types.wast index bb31ffc8230..bde56309f70 100644 --- a/test/lit/passes/name-types.wast +++ b/test/lit/passes/name-types.wast @@ -34,7 +34,6 @@ ;; CHECK: (type $type (func (param (ref $type_1) (ref $reasonable-name) (ref $lintable-name) (ref $unlintable-name_7) (ref $unlintable-name) (ref $onelintable-name) (ref $onelintable-name_8)))) ;; CHECK: (func $foo (type $type) (param $x (ref $type_1)) (param $y (ref $reasonable-name)) (param $z (ref $lintable-name)) (param $w (ref $unlintable-name_7)) (param $t (ref $unlintable-name)) (param $a (ref $onelintable-name)) (param $b (ref $onelintable-name_8)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo ;; Use the types to keep them alive. diff --git a/test/lit/passes/once-reduction.wast b/test/lit/passes/once-reduction.wast index af9f4f113ed..640d14461f1 100644 --- a/test/lit/passes/once-reduction.wast +++ b/test/lit/passes/once-reduction.wast @@ -201,7 +201,6 @@ ) ;; CHECK: (func $caller-empty (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $caller-empty ;; A tiny function with nothing at all, just to verify we do not crash on @@ -1481,7 +1480,6 @@ ) ;; CHECK: (func $bad-B (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $bad-B ) @@ -2022,7 +2020,6 @@ ) ;; CHECK: (func $other (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $other ) diff --git a/test/lit/passes/optimize-casts-noeh.wast b/test/lit/passes/optimize-casts-noeh.wast index 3cee5f3d441..3c3b5f8c504 100644 --- a/test/lit/passes/optimize-casts-noeh.wast +++ b/test/lit/passes/optimize-casts-noeh.wast @@ -63,7 +63,6 @@ ) ;; CHECK: (func $none (type $2) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $none ;; Helper for the above. diff --git a/test/lit/passes/optimize-casts.wast b/test/lit/passes/optimize-casts.wast index acf8fc7b425..0719cbd91f9 100644 --- a/test/lit/passes/optimize-casts.wast +++ b/test/lit/passes/optimize-casts.wast @@ -1398,7 +1398,6 @@ ) ;; CHECK: (func $void (type $void) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $void ;; Helper for the above. diff --git a/test/lit/passes/optimize-instructions-call_ref-roundtrip.wast b/test/lit/passes/optimize-instructions-call_ref-roundtrip.wast index 05f03110c40..c3e51d04984 100644 --- a/test/lit/passes/optimize-instructions-call_ref-roundtrip.wast +++ b/test/lit/passes/optimize-instructions-call_ref-roundtrip.wast @@ -46,15 +46,12 @@ (ref.func $helper-3)) ;; CHECK: (func $helper-1 (type $v1) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $helper-1 (type $v1)) ;; CHECK: (func $helper-2 (type $v2) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $helper-2 (type $v2)) ;; CHECK: (func $helper-3 (type $v3) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $helper-3 (type $v3)) diff --git a/test/lit/passes/optimize-instructions-call_ref.wast b/test/lit/passes/optimize-instructions-call_ref.wast index 937fbe6a766..66e651a0694 100644 --- a/test/lit/passes/optimize-instructions-call_ref.wast +++ b/test/lit/passes/optimize-instructions-call_ref.wast @@ -189,7 +189,6 @@ ;; Helper function for the above test. ;; CHECK: (func $return-nothing (type $none_=>_none) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $return-nothing) diff --git a/test/lit/passes/optimize-instructions-eh-legacy.wast b/test/lit/passes/optimize-instructions-eh-legacy.wast index a6c65018380..dd51d6c1753 100644 --- a/test/lit/passes/optimize-instructions-eh-legacy.wast +++ b/test/lit/passes/optimize-instructions-eh-legacy.wast @@ -6,7 +6,6 @@ ;; CHECK: (tag $e (param i32)) ;; CHECK: (func $dummy (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $dummy) (tag $e (param i32)) @@ -164,7 +163,6 @@ ;; CHECK-NEXT: (call $dummy) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (i32.const 1) @@ -209,7 +207,6 @@ ;; CHECK-NEXT: (do ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all ;; CHECK-NEXT: (call $dummy) diff --git a/test/lit/passes/optimize-instructions-gc-iit.wast b/test/lit/passes/optimize-instructions-gc-iit.wast index ab3005af531..224e53d4050 100644 --- a/test/lit/passes/optimize-instructions-gc-iit.wast +++ b/test/lit/passes/optimize-instructions-gc-iit.wast @@ -19,10 +19,8 @@ (type $other (struct (field i64) (field f32))) ;; CHECK: (func $foo (type $3) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; TNH: (func $foo (type $3) - ;; TNH-NEXT: (nop) ;; TNH-NEXT: ) (func $foo) diff --git a/test/lit/passes/optimize-instructions-gc.wast b/test/lit/passes/optimize-instructions-gc.wast index 21d6291a921..4b88507ffc7 100644 --- a/test/lit/passes/optimize-instructions-gc.wast +++ b/test/lit/passes/optimize-instructions-gc.wast @@ -472,7 +472,6 @@ ) ;; CHECK: (func $nothing (type $5) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $nothing) diff --git a/test/lit/passes/optimize-instructions-iit-eh-legacy.wast b/test/lit/passes/optimize-instructions-iit-eh-legacy.wast index c0e4a05da92..79cb6f6f1c8 100644 --- a/test/lit/passes/optimize-instructions-iit-eh-legacy.wast +++ b/test/lit/passes/optimize-instructions-iit-eh-legacy.wast @@ -11,7 +11,6 @@ ;; CHECK: (func $ref-cast-statically-removed (type $2) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $e ;; CHECK-NEXT: (throw $e diff --git a/test/lit/passes/optimize-instructions-mvp.wast b/test/lit/passes/optimize-instructions-mvp.wast index 8b1afa76aa8..f18c94c5c05 100644 --- a/test/lit/passes/optimize-instructions-mvp.wast +++ b/test/lit/passes/optimize-instructions-mvp.wast @@ -15688,7 +15688,6 @@ ) ) ;; CHECK: (func $send-i32 (param $0 i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $send-i32 (param i32)) ;; CHECK: (func $ternary-identical-arms-call (param $x i32) (param $y i32) (param $z i32) diff --git a/test/lit/passes/remove-unused-brs-eh.wast b/test/lit/passes/remove-unused-brs-eh.wast index 8ce578101c3..336b3b5a807 100644 --- a/test/lit/passes/remove-unused-brs-eh.wast +++ b/test/lit/passes/remove-unused-brs-eh.wast @@ -313,7 +313,6 @@ ;; CHECK-NEXT: (block $middle ;; CHECK-NEXT: (block $inner ;; CHECK-NEXT: (try_table (catch $e $outer) (catch $f $outer) (catch_all $outer) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -340,7 +339,6 @@ ;; CHECK-NEXT: (block $middle ;; CHECK-NEXT: (block $inner ;; CHECK-NEXT: (try_table (catch $e $outer) (catch $f $middle) (catch_all $outer) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (br $outer) diff --git a/test/lit/passes/remove-unused-brs.wast b/test/lit/passes/remove-unused-brs.wast index 6fcc5b066a3..3380db6b70b 100644 --- a/test/lit/passes/remove-unused-brs.wast +++ b/test/lit/passes/remove-unused-brs.wast @@ -105,7 +105,6 @@ ) ;; CHECK: (func $nothing (type $1) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $nothing) diff --git a/test/lit/passes/remove-unused-brs_all-features.wast b/test/lit/passes/remove-unused-brs_all-features.wast index 98f0202745c..4e722a04380 100644 --- a/test/lit/passes/remove-unused-brs_all-features.wast +++ b/test/lit/passes/remove-unused-brs_all-features.wast @@ -115,7 +115,6 @@ (unreachable) ) ;; CHECK: (func $i32_=>_none (type $2) (param $0 i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $i32_=>_none (param i32) ) diff --git a/test/lit/passes/remove-unused-module-elements-refs.wast b/test/lit/passes/remove-unused-module-elements-refs.wast index 146a25ea608..bd4940037c8 100644 --- a/test/lit/passes/remove-unused-module-elements-refs.wast +++ b/test/lit/passes/remove-unused-module-elements-refs.wast @@ -113,10 +113,8 @@ ) ;; CHECK: (func $target-A (type $A) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $target-A (type $A) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $target-A (type $A) ;; This function is reachable from the export "foo": there is a RefFunc and @@ -129,10 +127,8 @@ ) ;; CHECK: (func $target-A-sub (type $A-sub) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $target-A-sub (type $A-sub) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $target-A-sub (type $A-sub) ;; This function is reachable because we have a CallRef of a supertype ($A). @@ -142,7 +138,6 @@ ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $target-A-super (type $A-super) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $target-A-super (type $A-super) ;; This function is not reachable. We have a CallRef of a subtype ($A), but @@ -153,7 +148,6 @@ ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $target-B (type $B) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $target-B (type $B) ;; This function is not reachable. We have a RefFunc in "foo" but no @@ -213,10 +207,8 @@ ) ;; CHECK: (func $target-A (type $A) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $target-A (type $A) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $target-A (type $A) ;; This function is reachable. @@ -290,20 +282,16 @@ ;; WORLD_OPEN-NEXT: ) ;; CHECK: (func $target-A-1 (type $A) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $target-A-1 (type $A) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $target-A-1 (type $A) ;; This function is reachable. ) ;; CHECK: (func $target-A-2 (type $A) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $target-A-2 (type $A) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $target-A-2 (type $A) ;; This function is reachable. @@ -377,20 +365,16 @@ ) ;; CHECK: (func $target-A-1 (type $A) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $target-A-1 (type $A) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $target-A-1 (type $A) ;; This function is reachable. ) ;; CHECK: (func $target-A-2 (type $A) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $target-A-2 (type $A) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $target-A-2 (type $A) ;; This function is reachable. @@ -524,10 +508,8 @@ ) ;; CHECK: (func $target-keep (type $A) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $target-keep (type $A) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $target-keep (type $A) ) @@ -536,7 +518,6 @@ ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $target-drop (type $A) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $target-drop (type $A) ;; In a closed world we can turn this body into unreachable. @@ -617,19 +598,15 @@ ) ;; CHECK: (func $target-keep (type $A) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $target-keep (type $A) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $target-keep (type $A) ) ;; CHECK: (func $target-keep-2 (type $A) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $target-keep-2 (type $A) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $target-keep-2 (type $A) ) @@ -974,10 +951,8 @@ ) ;; CHECK: (func $void (type $void) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $void (type $void) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $void (type $void) ;; Helper function. This is reached via a call_ref. @@ -987,7 +962,6 @@ ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $a (type $void) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $a (type $void) ;; This is unreachable (in closed world) since a reference to it only exists @@ -995,10 +969,8 @@ ) ;; CHECK: (func $b (type $void) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $b (type $void) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $b (type $void) ;; This is reachable. It is in field #1, which is read, and the global @@ -1009,7 +981,6 @@ ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $c (type $void) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $c (type $void) ;; Like $a, this is unreachable. That it is in a nested struct.new, and not @@ -1017,10 +988,8 @@ ) ;; CHECK: (func $d (type $void) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $d (type $void) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $d (type $void) ;; Like $b, this is reachable. That it is in a nested struct.new, and not @@ -1031,7 +1000,6 @@ ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $e (type $void) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $e (type $void) ;; Side effects on the struct field are not enough to make this reachable: @@ -1040,10 +1008,8 @@ ) ;; CHECK: (func $f (type $void) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $f (type $void) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $f (type $void) ;; Like $b, this is reachable (the tee does not matter). @@ -1053,7 +1019,6 @@ ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $g (type $void) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $g (type $void) ;; This is in a struct written to a field that is never read in $struct, so @@ -1064,7 +1029,6 @@ ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $h (type $void) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $h (type $void) ;; This is in a struct written to a field that is never read in $struct, so @@ -1141,10 +1105,8 @@ ) ;; CHECK: (func $void (type $void) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $void (type $void) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $void (type $void) ;; Helper function. This is reached via a call_ref. @@ -1154,7 +1116,6 @@ ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $a (type $void) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $a (type $void) ;; This is unreachable (in closed world) because we have no reads from the @@ -1162,10 +1123,8 @@ ) ;; CHECK: (func $b (type $void) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $b (type $void) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $b (type $void) ;; The local.tee makes this reachable: the value is not known to only reside @@ -1503,7 +1462,6 @@ ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $f (type $void) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $f (type $void) ;; This is unreachable in closed world. The global it is in has a reference @@ -1511,20 +1469,16 @@ ) ;; CHECK: (func $subf (type $void) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $subf (type $void) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $subf (type $void) ;; There is a read of $substruct's field, which makes this reachable. ) ;; CHECK: (func $subsubf (type $void) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $subsubf (type $void) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $subsubf (type $void) ;; There is a read of $substruct's field, which may read from any subtype, @@ -1607,10 +1561,8 @@ ) ;; CHECK: (func $f1 (type $void) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $f1 (type $void) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $f1 (type $void) ;; The global containing this function's reference is used. @@ -1620,7 +1572,6 @@ ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $f2 (type $void) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $f2 (type $void) ;; This is unreachable in closed world as the global is referred to from a @@ -1727,7 +1678,6 @@ ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $f (type $void) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $f (type $void) ;; This is unreachable in closed world since $B's field is not read, so the @@ -1851,10 +1801,8 @@ ) ;; CHECK: (func $f (type $void) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; OPEN_WORLD: (func $f (type $void) - ;; OPEN_WORLD-NEXT: (nop) ;; OPEN_WORLD-NEXT: ) (func $f (type $void) ) diff --git a/test/lit/passes/remove-unused-module-elements_all-features.wast b/test/lit/passes/remove-unused-module-elements_all-features.wast index 7c2ad11d801..8b4d7f18638 100644 --- a/test/lit/passes/remove-unused-module-elements_all-features.wast +++ b/test/lit/passes/remove-unused-module-elements_all-features.wast @@ -186,7 +186,6 @@ ;; CHECK: (elem $1 (i32.const 0) $f) ;; CHECK: (func $f (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $f) ) @@ -227,7 +226,6 @@ ;; CHECK: (elem $0 (i32.const 0) $waka) ;; CHECK: (func $waka (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $waka) ) @@ -459,7 +457,6 @@ ;; CHECK: (elem $0 (global.get $tableBase) $waka) ;; CHECK: (func $waka (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $waka) ;; used in table ) @@ -819,7 +816,6 @@ ) ;; CHECK: (func $internal (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $internal ) diff --git a/test/lit/passes/remove-unused-module-elements_tnh.wast b/test/lit/passes/remove-unused-module-elements_tnh.wast index 22c09740dfc..5378431912e 100644 --- a/test/lit/passes/remove-unused-module-elements_tnh.wast +++ b/test/lit/passes/remove-unused-module-elements_tnh.wast @@ -162,12 +162,10 @@ (elem $bad (i32.const 10) $func) ;; CHECK: (func $func (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; T_N_H: (type $0 (func)) ;; T_N_H: (func $func (type $0) - ;; T_N_H-NEXT: (nop) ;; T_N_H-NEXT: ) (func $func) ) @@ -190,12 +188,10 @@ (elem $bad (i32.const 9) $func $func) ;; CHECK: (func $func (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; T_N_H: (type $0 (func)) ;; T_N_H: (func $func (type $0) - ;; T_N_H-NEXT: (nop) ;; T_N_H-NEXT: ) (func $func) ) @@ -211,12 +207,10 @@ ;; CHECK: (type $0 (func)) ;; CHECK: (func $func (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; T_N_H: (type $0 (func)) ;; T_N_H: (func $func (type $0) - ;; T_N_H-NEXT: (nop) ;; T_N_H-NEXT: ) (func $func) ) diff --git a/test/lit/passes/remove-unused-names-eh-legacy.wast b/test/lit/passes/remove-unused-names-eh-legacy.wast index 729e50addb6..797dabb55cd 100644 --- a/test/lit/passes/remove-unused-names-eh-legacy.wast +++ b/test/lit/passes/remove-unused-names-eh-legacy.wast @@ -8,7 +8,6 @@ ;; CHECK: (func $func0 (type $0) ;; CHECK-NEXT: (try $label$9 ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all ;; CHECK-NEXT: (try $label$8 diff --git a/test/lit/passes/rse-eh-legacy.wast b/test/lit/passes/rse-eh-legacy.wast index 7cdb2bccf7f..95a1459c3ba 100644 --- a/test/lit/passes/rse-eh-legacy.wast +++ b/test/lit/passes/rse-eh-legacy.wast @@ -11,7 +11,6 @@ ;; CHECK-NEXT: (local $x i32) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all ;; CHECK-NEXT: (local.set $x @@ -47,7 +46,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (local.set $x @@ -102,7 +100,6 @@ ) ;; CHECK: (func $foo (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo) @@ -116,7 +113,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (local.set $x @@ -147,7 +143,6 @@ ;; CHECK-NEXT: (call $foo) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop @@ -235,7 +230,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop @@ -285,7 +279,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (local.set $x @@ -498,7 +491,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -560,7 +552,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (local.set $x @@ -690,7 +681,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (local.set $x @@ -754,7 +744,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -762,7 +751,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) diff --git a/test/lit/passes/rse-eh.wast b/test/lit/passes/rse-eh.wast index 100543ae980..8c26946b1ac 100644 --- a/test/lit/passes/rse-eh.wast +++ b/test/lit/passes/rse-eh.wast @@ -14,7 +14,6 @@ (tag $e-empty) ;; CHECK: (func $foo (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo) @@ -23,7 +22,6 @@ ;; CHECK-NEXT: (block $outer ;; CHECK-NEXT: (block $catch_all ;; CHECK-NEXT: (try_table (catch_all $catch_all) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (br $outer) ;; CHECK-NEXT: ) diff --git a/test/lit/passes/rse-gc.wast b/test/lit/passes/rse-gc.wast index 26a973da099..d00f6d3c434 100644 --- a/test/lit/passes/rse-gc.wast +++ b/test/lit/passes/rse-gc.wast @@ -13,7 +13,6 @@ ;; CHECK: (func $test (type $3) ;; CHECK-NEXT: (local $single (ref func)) ;; CHECK-NEXT: (local $tuple (tuple (ref any) (ref any))) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $test ;; A non-nullable local. The pass should ignore it (as we cannot optimize diff --git a/test/lit/passes/signature-pruning.wast b/test/lit/passes/signature-pruning.wast index b5c5b26e28d..6a20d281551 100644 --- a/test/lit/passes/signature-pruning.wast +++ b/test/lit/passes/signature-pruning.wast @@ -308,7 +308,6 @@ ;; CHECK-NEXT: (local $1 f32) ;; CHECK-NEXT: (local $2 i64) ;; CHECK-NEXT: (local $3 i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo (type $sig) (param $i32 i32) (param $i64 i64) (param $f32 f32) (param $f64 f64) ;; Use nothing at all: all params can be removed. @@ -394,7 +393,6 @@ ;; CHECK: (func $foo (type $sig) ;; CHECK-NEXT: (local $0 i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo (type $sig) (param $i32 i32) ;; This function does not use the parameter. It also has no calls, but that @@ -416,7 +414,6 @@ ;; CHECK: (memory $0 1 1) ;; CHECK: (func $foo (type $sig) (param $i32 i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo (type $sig) (param $i32 i32) ) @@ -431,7 +428,6 @@ ;; CHECK: (memory $0 1 1) ;; CHECK: (func $foo (type $sig) (param $i32 i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo (type $sig) (param $i32 i32) ) @@ -469,7 +465,6 @@ ;; CHECK: (func $foo (type $sig) ;; CHECK-NEXT: (local $0 i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo (type $sig) (param $i32 i32) ) @@ -505,14 +500,12 @@ ;; CHECK: (func $foo (type $sig) ;; CHECK-NEXT: (local $0 i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo (type $sig) (param $i32 i32) ) ;; CHECK: (func $bar (type $sig) ;; CHECK-NEXT: (local $0 i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $bar (type $sig) (param $i32 i32) ;; As above, but the second function also does not use the parameter, and @@ -574,7 +567,6 @@ ;; CHECK: (table $0 1 1 anyref) ;; CHECK: (func $foo (type $sig) (param $i32 i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo (type $sig) (param $i32 i32) ) @@ -593,13 +585,11 @@ ;; CHECK: (export "bar" (func $bar)) ;; CHECK: (func $foo (type $sig) (param $i32 i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo (export "foo") (type $sig) (param $i32 i32) ) ;; CHECK: (func $bar (type $sig) (param $i32 i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $bar (export "bar") (type $sig) (param $i32 i32) ) @@ -632,14 +622,12 @@ ;; CHECK: (func $foo1 (type $sig1) ;; CHECK-NEXT: (local $0 i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo1 (type $sig1) (param $i32 i32) ) ;; CHECK: (func $foo2 (type $sig2) ;; CHECK-NEXT: (local $0 f64) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo2 (type $sig2) (param $f64 f64) ) @@ -1174,13 +1162,11 @@ ;; CHECK: (export "exported" (func $exported)) ;; CHECK: (func $exported (type $none) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $exported (export "exported") (type $none) ) ;; CHECK: (func $unused-param (type $much) (param $param i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $unused-param (type $much) (param $param i32) ) @@ -1219,14 +1205,12 @@ ;; CHECK: (export "exported" (func $exported)) ;; CHECK: (func $exported (type $none) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $exported (export "exported") (type $none) ;; This makes the rec group public. ) ;; CHECK: (func $unused-param (type $much) (param $param i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $unused-param (type $much) (param $param i32) ) diff --git a/test/lit/passes/signature-refining.wast b/test/lit/passes/signature-refining.wast index f6f88940847..b401237b8a7 100644 --- a/test/lit/passes/signature-refining.wast +++ b/test/lit/passes/signature-refining.wast @@ -17,7 +17,6 @@ (type $sig (sub (func (param anyref)))) ;; CHECK: (func $func (type $sig) (param $x (ref $struct)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func (type $sig) (param $x anyref) ) @@ -49,7 +48,6 @@ ;; CHECK: (elem declare func $func) ;; CHECK: (func $func (type $sig) (param $x (ref $struct)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func (type $sig) (param $x anyref) ) @@ -85,7 +83,6 @@ ;; CHECK: (elem declare func $func) ;; CHECK: (func $func (type $sig) (param $x eqref) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func (type $sig) (param $x anyref) ) @@ -140,13 +137,11 @@ ) ;; CHECK: (func $func-1 (type $sig) (param $x (ref $struct)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func-1 (type $sig) (param $x anyref) ) ;; CHECK: (func $func-2 (type $sig) (param $x (ref $struct)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func-2 (type $sig) (param $x anyref) ) @@ -184,13 +179,11 @@ (type $struct (struct)) ;; CHECK: (func $func-1 (type $sig) (param $x (ref $struct)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func-1 (type $sig) (param $x anyref) ) ;; CHECK: (func $func-2 (type $sig) (param $x (ref $struct)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func-2 (type $sig) (param $x anyref) ) @@ -288,7 +281,6 @@ ;; CHECK: (elem declare func $func) ;; CHECK: (func $func (type $sig) (param $x (ref $struct)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func (type $sig) (param $x anyref) ) @@ -327,7 +319,6 @@ ;; CHECK: (elem declare func $func) ;; CHECK: (func $func (type $sig) (param $x anyref) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func (type $sig) (param $x anyref) ) @@ -356,7 +347,6 @@ (type $sig (sub (func (param anyref)))) ;; CHECK: (func $func (type $sig) (param $x anyref) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func (type $sig) (param $x anyref) ) @@ -381,13 +371,11 @@ ;; CHECK: (elem declare func $func-2) ;; CHECK: (func $func-1 (type $sig-1) (param $x structref) (param $y anyref) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func-1 (type $sig-1) (param $x anyref) (param $y anyref) ) ;; CHECK: (func $func-2 (type $sig-2) (param $x eqref) (param $y (ref $struct)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func-2 (type $sig-2) (param $x anyref) (param $y anyref) ) @@ -455,7 +443,6 @@ ;; CHECK: (table $0 1 1 anyref) ;; CHECK: (func $func (type $sig) (param $x anyref) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func (type $sig) (param $x anyref) ) @@ -487,7 +474,6 @@ (type $struct (struct)) ;; CHECK: (func $func (type $sig) (param $x (ref null $struct)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func (type $sig) (param $x anyref) ) @@ -692,7 +678,6 @@ ;; CHECK: (export "prevent-opts" (func $func)) ;; CHECK: (func $func (type $sig) (param $x anyref) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func (export "prevent-opts") (type $sig) (param $x anyref) ) @@ -1057,7 +1042,6 @@ ) ;; CHECK: (func $target (type $5) (param $x (ref $A)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $target (param $x (ref $A)) ;; Because of the two calls above, this cannot be refined. @@ -1109,7 +1093,6 @@ ) ;; CHECK: (func $target (type $1) (param $x (ref $B)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $target (param $x (ref $A)) ;; The two calls above both send $B, so we can refine the parameter to $B. @@ -1142,7 +1125,6 @@ (export "struct" (global $struct)) ;; CHECK: (func $func (type $sig) (param $x anyref) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func (type $sig) (param $x anyref) ) diff --git a/test/lit/passes/simplify-locals-eh-legacy.wast b/test/lit/passes/simplify-locals-eh-legacy.wast index d7fb757769c..f9ab2f8c197 100644 --- a/test/lit/passes/simplify-locals-eh-legacy.wast +++ b/test/lit/passes/simplify-locals-eh-legacy.wast @@ -5,14 +5,12 @@ ;; CHECK: (tag $e-i32 (param i32)) (tag $e-i32 (param i32)) ;; CHECK: (func $foo (type $3) (param $0 i32) (param $1 i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo (param i32 i32)) ;; CHECK: (func $pop-cannot-be-sinked (type $0) ;; CHECK-NEXT: (local $0 i32) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $e-i32 ;; CHECK-NEXT: (local.set $0 @@ -44,7 +42,6 @@ ;; CHECK-NEXT: (local $0 i32) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all ;; CHECK-NEXT: (nop) diff --git a/test/lit/passes/simplify-locals-gc.wast b/test/lit/passes/simplify-locals-gc.wast index b3f6ac2fc26..85ec16d99ca 100644 --- a/test/lit/passes/simplify-locals-gc.wast +++ b/test/lit/passes/simplify-locals-gc.wast @@ -262,7 +262,6 @@ ) ;; CHECK: (func $helper (type $8) (param $ref (ref func)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $helper (param $ref (ref func)) ) @@ -491,14 +490,12 @@ ) ;; CHECK: (func $use-nn-any (type $15) (param $nn-any (ref any)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $use-nn-any (param $nn-any (ref any)) ;; Helper function for the above. ) ;; CHECK: (func $use-any (type $7) (param $any anyref) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $use-any (param $any anyref) ;; Helper function for the above. diff --git a/test/lit/passes/simplify-locals-global.wast b/test/lit/passes/simplify-locals-global.wast index 215b32a3c25..a471225d9b8 100644 --- a/test/lit/passes/simplify-locals-global.wast +++ b/test/lit/passes/simplify-locals-global.wast @@ -45,7 +45,6 @@ ) ;; CHECK: (func $helper - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $helper) ) diff --git a/test/lit/passes/ssa.wast b/test/lit/passes/ssa.wast index 68b85360719..b082cd88884 100644 --- a/test/lit/passes/ssa.wast +++ b/test/lit/passes/ssa.wast @@ -6,7 +6,6 @@ (type $A (struct )) ;; CHECK: (func $foo (type $1) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo) diff --git a/test/lit/passes/stack-ir-roundtrip-eh-legacy.wast b/test/lit/passes/stack-ir-roundtrip-eh-legacy.wast index cedcdbf4537..439681a8fd5 100644 --- a/test/lit/passes/stack-ir-roundtrip-eh-legacy.wast +++ b/test/lit/passes/stack-ir-roundtrip-eh-legacy.wast @@ -9,7 +9,6 @@ ;; CHECK-NEXT: (do ;; CHECK-NEXT: (try $label$7 ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $tag ;; CHECK-NEXT: (drop @@ -17,7 +16,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: (try $label$6 ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (delegate 2) ;; CHECK-NEXT: ) diff --git a/test/lit/passes/string-lowering_types.wast b/test/lit/passes/string-lowering_types.wast index cab84a1b8c9..2274fcaf9f5 100644 --- a/test/lit/passes/string-lowering_types.wast +++ b/test/lit/passes/string-lowering_types.wast @@ -65,7 +65,6 @@ ;; CHECK: (func $export (type $4) ;; CHECK-NEXT: (local $0 (ref $private)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $export (export "export") ;; Keep the private type alive. diff --git a/test/lit/passes/translate-to-exnref.wast b/test/lit/passes/translate-to-exnref.wast index 8bac0dc39fa..388bcf8bda8 100644 --- a/test/lit/passes/translate-to-exnref.wast +++ b/test/lit/passes/translate-to-exnref.wast @@ -43,19 +43,16 @@ (tag $e-i32-i64 (param i32 i64)) ;; CHECK: (func $foo (type $1) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; STACKIR-OPT: (func $foo (type $1) ;; STACKIR-OPT-NEXT: ) (func $foo) ;; CHECK: (func $bar (type $1) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; STACKIR-OPT: (func $bar (type $1) ;; STACKIR-OPT-NEXT: ) (func $bar) ;; CHECK: (func $baz (type $1) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; STACKIR-OPT: (func $baz (type $1) ;; STACKIR-OPT-NEXT: ) @@ -1621,7 +1618,8 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; STACKIR-OPT: (func $delegate-target-outer-try-none (type $1) @@ -1678,7 +1676,8 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; STACKIR-OPT: (func $multiple-delegates-target-outer-try-none (type $1) @@ -1963,14 +1962,16 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: (br $outer1) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (br $outer3) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; STACKIR-OPT: (func $delegate-nested-more (type $1) diff --git a/test/lit/passes/type-finalizing.wast b/test/lit/passes/type-finalizing.wast index 6897c6abf82..f1511246b0b 100644 --- a/test/lit/passes/type-finalizing.wast +++ b/test/lit/passes/type-finalizing.wast @@ -78,7 +78,6 @@ ;; UNFINAL-NEXT: (local $parent (ref $parent)) ;; UNFINAL-NEXT: (local $child-final (ref $child-final)) ;; UNFINAL-NEXT: (local $child-open (ref $child-open)) - ;; UNFINAL-NEXT: (nop) ;; UNFINAL-NEXT: ) ;; DOFINAL: (type $3 (func)) @@ -86,7 +85,6 @@ ;; DOFINAL-NEXT: (local $parent (ref $parent)) ;; DOFINAL-NEXT: (local $child-final (ref $child-final)) ;; DOFINAL-NEXT: (local $child-open (ref $child-open)) - ;; DOFINAL-NEXT: (nop) ;; DOFINAL-NEXT: ) (func $keepalive (local $parent (ref $parent)) diff --git a/test/lit/passes/type-generalizing.wast b/test/lit/passes/type-generalizing.wast index 00a809648d5..66e3520056d 100644 --- a/test/lit/passes/type-generalizing.wast +++ b/test/lit/passes/type-generalizing.wast @@ -54,7 +54,6 @@ ;; CHECK-NEXT: (local $x i32) ;; CHECK-NEXT: (local $y anyref) ;; CHECK-NEXT: (local $z (tuple anyref i32)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $unconstrained ;; This non-ref local should be unmodified diff --git a/test/lit/passes/type-merging-shared.wast b/test/lit/passes/type-merging-shared.wast index fb7fa89b7a5..99b030f016a 100644 --- a/test/lit/passes/type-merging-shared.wast +++ b/test/lit/passes/type-merging-shared.wast @@ -28,7 +28,6 @@ ;; CHECK-NEXT: (local $b' (ref null $B')) ;; CHECK-NEXT: (local $c (ref null $C)) ;; CHECK-NEXT: (local $c' (ref null $C')) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo (local $a (ref null $A)) @@ -64,7 +63,6 @@ ;; CHECK-NEXT: (local $b' (ref null $B)) ;; CHECK-NEXT: (local $c (ref null $C)) ;; CHECK-NEXT: (local $c' (ref null $C)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo (local $a (ref null $A)) @@ -90,7 +88,6 @@ ;; CHECK: (func $foo (type $2) ;; CHECK-NEXT: (local $a (ref null $A)) ;; CHECK-NEXT: (local $a' (ref null $A')) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo (local $a (ref null $A)) diff --git a/test/lit/passes/type-merging.wast b/test/lit/passes/type-merging.wast index 5d0c4bc5e7b..942e15b021a 100644 --- a/test/lit/passes/type-merging.wast +++ b/test/lit/passes/type-merging.wast @@ -95,7 +95,6 @@ ;; CHECK-NEXT: (local $e (ref null $D)) ;; CHECK-NEXT: (local $f (ref null $D)) ;; CHECK-NEXT: (local $g (ref null $D)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo (local $a (ref null $A)) @@ -139,7 +138,6 @@ ;; CHECK-NEXT: (local $e (ref null $D)) ;; CHECK-NEXT: (local $f (ref null $D)) ;; CHECK-NEXT: (local $g (ref null $D)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo (local $a (ref null $A)) @@ -169,7 +167,6 @@ ;; CHECK-NEXT: (local $a (ref null $A)) ;; CHECK-NEXT: (local $b (ref null $A)) ;; CHECK-NEXT: (local $c (ref null $C)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo ;; B can be merged into A even though it refines A's field because that @@ -192,7 +189,6 @@ ;; CHECK: (func $foo (type $1) ;; CHECK-NEXT: (local $a (ref null $A)) ;; CHECK-NEXT: (local $b (ref null $A)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo ;; A recursive subtype can be merged even though its field is a refinement @@ -220,7 +216,6 @@ ;; CHECK-NEXT: (local $b (ref null $A)) ;; CHECK-NEXT: (local $x (ref null $X)) ;; CHECK-NEXT: (local $y (ref null $X)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo ;; Two mutually referential chains, A->B and X->Y, can be merged into a pair @@ -249,7 +244,6 @@ ;; CHECK-NEXT: (local $b (ref null $X)) ;; CHECK-NEXT: (local $x (ref null $X)) ;; CHECK-NEXT: (local $y (ref null $X)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo ;; As above, but now the A->B and X->Y chains are not differentiated by the @@ -278,7 +272,6 @@ ;; CHECK-NEXT: (local $b (ref null $A)) ;; CHECK-NEXT: (local $x (ref null $X)) ;; CHECK-NEXT: (local $y (ref null $X)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo ;; As above with the differentiated chains, but now the types are top-level @@ -306,7 +299,6 @@ ;; CHECK-NEXT: (local $b (ref null $X)) ;; CHECK-NEXT: (local $x (ref null $X)) ;; CHECK-NEXT: (local $y (ref null $X)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo ;; As above, but with all the types merging into a single type. @@ -429,7 +421,6 @@ ;; CHECK-NEXT: (local $l' (ref null $L)) ;; CHECK-NEXT: (local $m (ref null $M)) ;; CHECK-NEXT: (local $m' (ref null $M)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo (local $a (ref null $A)) @@ -479,7 +470,6 @@ ;; CHECK-NEXT: (local $a (ref null $A)) ;; CHECK-NEXT: (local $b (ref null $B)) ;; CHECK-NEXT: (local $c (ref null $B)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo ;; B and C cannot be merged into A because they refine A's field, but B and @@ -506,7 +496,6 @@ ;; CHECK-NEXT: (local $a (ref null $A)) ;; CHECK-NEXT: (local $b (ref null $B)) ;; CHECK-NEXT: (local $c (ref null $B)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo ;; This is the same as above, but now B and C refine A such that they have a @@ -537,7 +526,6 @@ ;; CHECK-NEXT: (local $c (ref null $A)) ;; CHECK-NEXT: (local $d (ref null $D)) ;; CHECK-NEXT: (local $e (ref null $D)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo ;; D and E should be mergeable because they have identical shapes and will @@ -587,7 +575,6 @@ ;; CHECK-NEXT: (local $c' (ref null $C)) ;; CHECK-NEXT: (local $d (ref null $D)) ;; CHECK-NEXT: (local $d' (ref null $D)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo (local $a (ref null $A)) @@ -696,7 +683,6 @@ ;; CHECK: (func $foo (type $3) ;; CHECK-NEXT: (local $a (ref null $intarray)) ;; CHECK-NEXT: (local $b (ref null $intarray)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo ;; $A will remain the same. @@ -709,7 +695,6 @@ ;; CHECK-NEXT: (local $a (ref null $refarray)) ;; CHECK-NEXT: (local $b (ref null $refarray)) ;; CHECK-NEXT: (local $c (ref null $sub-refarray-nn)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $bar (local $a (ref null $refarray)) @@ -735,7 +720,6 @@ ;; CHECK-NEXT: (local $a (ref null $func)) ;; CHECK-NEXT: (local $b (ref null $func)) ;; CHECK-NEXT: (local $c (ref null $sub-func-refined)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo ;; $func will remain the same. @@ -830,7 +814,6 @@ ;; CHECK: (func $foo (type $3) ;; CHECK-NEXT: (local $b (ref null $A')) ;; CHECK-NEXT: (local $x (ref null $X)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo (local $b (ref null $A')) diff --git a/test/lit/passes/type-refining.wast b/test/lit/passes/type-refining.wast index 8e8ccf24ccd..d045dbc1a62 100644 --- a/test/lit/passes/type-refining.wast +++ b/test/lit/passes/type-refining.wast @@ -168,7 +168,6 @@ ;; CHECK: (func $keepalive (type $4) ;; CHECK-NEXT: (local $temp (ref null $child-B)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $keepalive ;; Add a reference to $child-B just to keep it alive in the output for easier diff --git a/test/lit/string.as_wtf16.wast b/test/lit/string.as_wtf16.wast index 916e11d39a1..60bdcf5ecb3 100644 --- a/test/lit/string.as_wtf16.wast +++ b/test/lit/string.as_wtf16.wast @@ -9,7 +9,6 @@ (module ;; CHECK: (func $empty (type $2) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; RTRIP: (func $empty (type $2) ;; RTRIP-NEXT: ) diff --git a/test/lit/validation/nn-tuples.wast b/test/lit/validation/nn-tuples.wast index a673ec9003d..c3c5e4e4f63 100644 --- a/test/lit/validation/nn-tuples.wast +++ b/test/lit/validation/nn-tuples.wast @@ -8,7 +8,6 @@ (module ;; CHECK: (func $foo (type $0) ;; CHECK-NEXT: (local $tuple (tuple (ref any) (ref any))) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo (local $tuple (tuple (ref any) (ref any))) diff --git a/test/lit/wasm-split/passive.wast b/test/lit/wasm-split/passive.wast index 743d7d14e0c..d335d79a831 100644 --- a/test/lit/wasm-split/passive.wast +++ b/test/lit/wasm-split/passive.wast @@ -26,7 +26,6 @@ ;; PRIMARY: (export "table_1" (table $1)) ;; PRIMARY: (func $in-table (type $0) - ;; PRIMARY-NEXT: (nop) ;; PRIMARY-NEXT: ) (func $in-table ;; This is in a passive segment, but it is in the main module so we need no @@ -40,7 +39,6 @@ ;; SECONDARY: (elem $0 (i32.const 0) $second-in-table) ;; SECONDARY: (func $second-in-table (type $0) - ;; SECONDARY-NEXT: (nop) ;; SECONDARY-NEXT: ) (func $second-in-table ;; This is in a passive segment, and it is in the secondary module, so we will diff --git a/test/lit/wasm-split/ref.func.wast b/test/lit/wasm-split/ref.func.wast index d9a30890ac5..f97f790ff36 100644 --- a/test/lit/wasm-split/ref.func.wast +++ b/test/lit/wasm-split/ref.func.wast @@ -89,7 +89,6 @@ ) ;; PRIMARY: (func $in-table (type $0) - ;; PRIMARY-NEXT: (nop) ;; PRIMARY-NEXT: ) (func $in-table ;; This empty function is in the table. Just being present in the table is not @@ -98,7 +97,6 @@ ) ;; SECONDARY: (func $second-in-table (type $0) - ;; SECONDARY-NEXT: (nop) ;; SECONDARY-NEXT: ) (func $second-in-table ;; As above, but in the secondary module. We still don't need a trampoline diff --git a/test/lit/wat-kitchen-sink.wast b/test/lit/wat-kitchen-sink.wast index 3936354a15b..97d9f57e835 100644 --- a/test/lit/wat-kitchen-sink.wast +++ b/test/lit/wat-kitchen-sink.wast @@ -475,15 +475,12 @@ (func) ;; CHECK: (func $2 (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK: (func $f1 (type $18) (param $0 i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $f1 (param i32)) ;; CHECK: (func $f2 (type $18) (param $x i32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $f2 (param $x i32)) ;; CHECK: (func $f3 (type $1) (result i32) @@ -496,12 +493,10 @@ ;; CHECK-NEXT: (local $0 i32) ;; CHECK-NEXT: (local $1 i64) ;; CHECK-NEXT: (local $l f32) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $f4 (type 18) (local i32 i64) (local $l f32)) ;; CHECK: (func $"[quoted_name]" (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $"[quoted_name]") @@ -1138,10 +1133,8 @@ ;; CHECK-NEXT: (if ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: (then - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (else - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -1336,10 +1329,8 @@ ;; CHECK-NEXT: (if ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: (then - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (else - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -1507,10 +1498,8 @@ ;; CHECK-NEXT: (if ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: (then -;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (else -;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (if @@ -1518,10 +1507,8 @@ ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (then -;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (else -;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -1659,7 +1646,6 @@ ;; CHECK: (func $loop-empty (type $0) ;; CHECK-NEXT: (loop - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $loop-empty @@ -1755,7 +1741,6 @@ ;; CHECK: (func $loop-folded-empty (type $0) ;; CHECK-NEXT: (loop - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $loop-folded-empty @@ -1839,10 +1824,8 @@ ;; CHECK: (func $try-catch (type $0) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $empty - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -1898,10 +1881,8 @@ ;; CHECK: (func $try-catch_all (type $0) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -1914,16 +1895,12 @@ ;; CHECK: (func $try-catch-catch_all (type $0) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $empty - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $eimport$0 - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -1938,7 +1915,6 @@ ;; CHECK: (func $try-delegate (type $0) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (delegate 0) ;; CHECK-NEXT: ) @@ -1952,7 +1928,6 @@ ;; CHECK-NEXT: (block $l ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (delegate 1) ;; CHECK-NEXT: ) @@ -1969,7 +1944,6 @@ ;; CHECK-NEXT: (block $l ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (delegate 1) ;; CHECK-NEXT: ) @@ -1986,7 +1960,6 @@ ;; CHECK-NEXT: (block $l ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (delegate 1) ;; CHECK-NEXT: ) @@ -2004,7 +1977,6 @@ ;; CHECK-NEXT: (do ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (delegate $label) ;; CHECK-NEXT: ) @@ -2025,7 +1997,6 @@ ;; CHECK-NEXT: (do ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (delegate $l) ;; CHECK-NEXT: ) @@ -2046,7 +2017,6 @@ ;; CHECK-NEXT: (do ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (delegate $label) ;; CHECK-NEXT: ) @@ -2068,7 +2038,6 @@ ;; CHECK-NEXT: (block $l ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (delegate $label) ;; CHECK-NEXT: ) @@ -2091,7 +2060,6 @@ ;; CHECK-NEXT: (block $l0 ;; CHECK-NEXT: (try $l1 ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (delegate $l) ;; CHECK-NEXT: ) @@ -2113,12 +2081,10 @@ ;; CHECK-NEXT: (do ;; CHECK-NEXT: (try $l0 ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $empty ;; CHECK-NEXT: (try $l1 ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (delegate $l) ;; CHECK-NEXT: ) @@ -2143,12 +2109,10 @@ ;; CHECK-NEXT: (do ;; CHECK-NEXT: (try $l0 ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all ;; CHECK-NEXT: (try $l1 ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (delegate $l) ;; CHECK-NEXT: ) @@ -2262,7 +2226,6 @@ ;; CHECK: (func $try-delegate-folded (type $0) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (delegate 0) ;; CHECK-NEXT: ) @@ -2277,7 +2240,6 @@ ;; CHECK: (func $rethrow (type $0) ;; CHECK-NEXT: (try $label ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $empty ;; CHECK-NEXT: (rethrow $label) @@ -2294,7 +2256,6 @@ ;; CHECK: (func $rethrow-named (type $0) ;; CHECK-NEXT: (try $l ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $empty ;; CHECK-NEXT: (rethrow $l) @@ -2311,12 +2272,10 @@ ;; CHECK: (func $rethrow-nested (type $0) ;; CHECK-NEXT: (try $label ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $empty ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $empty ;; CHECK-NEXT: (rethrow $label) @@ -2340,12 +2299,10 @@ ;; CHECK: (func $rethrow-nested-named (type $0) ;; CHECK-NEXT: (try $l ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $empty ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $empty ;; CHECK-NEXT: (rethrow $l) @@ -2369,7 +2326,6 @@ ;; CHECK: (func $rethrow-try-nested (type $0) ;; CHECK-NEXT: (try $label ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $empty ;; CHECK-NEXT: (try @@ -2396,7 +2352,6 @@ ;; CHECK: (func $rethrow-try-nested-named (type $0) ;; CHECK-NEXT: (try $l ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $empty ;; CHECK-NEXT: (try @@ -5035,7 +4990,6 @@ ) ;; CHECK: (func $use-types (type $96) (param $0 (ref $s0)) (param $1 (ref $s1)) (param $2 (ref $s2)) (param $3 (ref $s3)) (param $4 (ref $s4)) (param $5 (ref $s5)) (param $6 (ref $s6)) (param $7 (ref $s7)) (param $8 (ref $s8)) (param $9 (ref $a0)) (param $10 (ref $a1)) (param $11 (ref $a2)) (param $12 (ref $a3)) (param $13 (ref $subvoid)) (param $14 (ref $submany)) (param $15 (ref $all-types)) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $use-types (param (ref $s0)) diff --git a/test/lld/basic_safe_stack.wat.out b/test/lld/basic_safe_stack.wat.out index 7d554cc8839..b92a3048c5a 100644 --- a/test/lld/basic_safe_stack.wat.out +++ b/test/lld/basic_safe_stack.wat.out @@ -15,7 +15,6 @@ (export "main" (func $main)) (export "__set_stack_limits" (func $__set_stack_limits)) (func $__wasm_call_ctors - (nop) ) (func $stackRestore (param $0 i32) (local $1 i32) @@ -81,7 +80,6 @@ (local.get $1) ) (func $main - (nop) ) (func $__set_stack_limits (param $0 i32) (param $1 i32) (global.set $__stack_base diff --git a/test/lld/duplicate_imports.wat.out b/test/lld/duplicate_imports.wat.out index 7e49b393cc4..e2d822f0da6 100644 --- a/test/lld/duplicate_imports.wat.out +++ b/test/lld/duplicate_imports.wat.out @@ -34,7 +34,6 @@ (i32.const 0) ) (func $__wasm_call_ctors - (nop) ) (func $dynCall_ffd (param $fptr i32) (param $0 f32) (param $1 f64) (result f32) (call_indirect (type $8) diff --git a/test/lld/em_asm.wat.out b/test/lld/em_asm.wat.out index 8ed3d72ba0b..3165aa75a62 100644 --- a/test/lld/em_asm.wat.out +++ b/test/lld/em_asm.wat.out @@ -17,7 +17,6 @@ (export "__start_em_asm" (global $global$1)) (export "__stop_em_asm" (global $global$2)) (func $__wasm_call_ctors - (nop) ) (func $__original_main (result i32) (local $0 i32) diff --git a/test/lld/em_asm64.wat.out b/test/lld/em_asm64.wat.out index 33e5bb1768b..297933163e4 100644 --- a/test/lld/em_asm64.wat.out +++ b/test/lld/em_asm64.wat.out @@ -17,7 +17,6 @@ (export "__start_em_asm" (global $global$1)) (export "__stop_em_asm" (global $global$2)) (func $__wasm_call_ctors - (nop) ) (func $__original_main (result i32) (local $0 i64) diff --git a/test/lld/em_asm_O0.wat.out b/test/lld/em_asm_O0.wat.out index fb2495476eb..6635354bfb2 100644 --- a/test/lld/em_asm_O0.wat.out +++ b/test/lld/em_asm_O0.wat.out @@ -16,7 +16,6 @@ (export "__start_em_asm" (global $global$1)) (export "__stop_em_asm" (global $global$2)) (func $__wasm_call_ctors - (nop) ) (func $__original_main (result i32) (local $0 i32) diff --git a/test/lld/em_asm_main_thread.wat.out b/test/lld/em_asm_main_thread.wat.out index 5d817ca8677..8ee66c6225b 100644 --- a/test/lld/em_asm_main_thread.wat.out +++ b/test/lld/em_asm_main_thread.wat.out @@ -23,7 +23,6 @@ (export "__data_end" (global $global$2)) (export "main" (func $main)) (func $__wasm_call_ctors - (nop) ) (func $__original_main (result i32) (local $0 i32) diff --git a/test/lld/em_asm_shared.wat.out b/test/lld/em_asm_shared.wat.out index 0962d350408..5b72ac8abee 100644 --- a/test/lld/em_asm_shared.wat.out +++ b/test/lld/em_asm_shared.wat.out @@ -28,10 +28,8 @@ (export "__start_em_asm" (global $global$3)) (export "__stop_em_asm" (global $global$4)) (func $__wasm_call_ctors - (nop) ) (func $__wasm_apply_data_relocs - (nop) ) (func $__original_main (result i32) (local $0 i32) diff --git a/test/lld/hello_world.wat.out b/test/lld/hello_world.wat.out index 8081048d867..0e105c4c024 100644 --- a/test/lld/hello_world.wat.out +++ b/test/lld/hello_world.wat.out @@ -12,7 +12,6 @@ (export "__wasm_call_ctors" (func $__wasm_call_ctors)) (export "main" (func $main)) (func $__wasm_call_ctors - (nop) ) (func $__original_main (result i32) (drop diff --git a/test/lld/longjmp.wat.out b/test/lld/longjmp.wat.out index a9a5ac76394..508ded29330 100644 --- a/test/lld/longjmp.wat.out +++ b/test/lld/longjmp.wat.out @@ -25,7 +25,6 @@ (export "main" (func $main)) (export "dynCall_vii" (func $dynCall_vii)) (func $__wasm_call_ctors - (nop) ) (func $__original_main (result i32) (local $0 i32) diff --git a/test/lld/main_module_table.wat.out b/test/lld/main_module_table.wat.out index 05675c911c1..b926e05e0a6 100644 --- a/test/lld/main_module_table.wat.out +++ b/test/lld/main_module_table.wat.out @@ -6,6 +6,5 @@ (export "__stdio_write" (func $__stdio_write)) (export "__data_end" (global $global)) (func $__stdio_write - (nop) ) ) diff --git a/test/lld/main_module_table_2.wat.out b/test/lld/main_module_table_2.wat.out index de7e5542a59..819ca321639 100644 --- a/test/lld/main_module_table_2.wat.out +++ b/test/lld/main_module_table_2.wat.out @@ -7,6 +7,5 @@ (export "__stdio_write" (func $__stdio_write)) (export "__data_end" (global $global)) (func $__stdio_write - (nop) ) ) diff --git a/test/lld/main_module_table_3.wat.out b/test/lld/main_module_table_3.wat.out index 0bd9dcd2ac1..06201f383dd 100644 --- a/test/lld/main_module_table_3.wat.out +++ b/test/lld/main_module_table_3.wat.out @@ -8,6 +8,5 @@ (export "__stdio_write" (func $__stdio_write)) (export "__data_end" (global $global)) (func $__stdio_write - (nop) ) ) diff --git a/test/lld/main_module_table_4.wat.out b/test/lld/main_module_table_4.wat.out index d144e688e2d..966ac588d2c 100644 --- a/test/lld/main_module_table_4.wat.out +++ b/test/lld/main_module_table_4.wat.out @@ -9,6 +9,5 @@ (export "__stdio_write" (func $__stdio_write)) (export "__data_end" (global $global)) (func $__stdio_write - (nop) ) ) diff --git a/test/lld/main_module_table_5.wat.out b/test/lld/main_module_table_5.wat.out index 04167c9b34a..38e4be98b87 100644 --- a/test/lld/main_module_table_5.wat.out +++ b/test/lld/main_module_table_5.wat.out @@ -11,13 +11,10 @@ (export "__data_end" (global $global)) (export "dynCall_v" (func $dynCall_v)) (func $__stdio_write - (nop) ) (func $other - (nop) ) (func $stuff - (nop) ) (func $dynCall_v (param $fptr i32) (call_indirect (type $0) diff --git a/test/lld/recursive.wat.out b/test/lld/recursive.wat.out index ae7945a2aae..47035fe7a06 100644 --- a/test/lld/recursive.wat.out +++ b/test/lld/recursive.wat.out @@ -11,7 +11,6 @@ (export "__wasm_call_ctors" (func $__wasm_call_ctors)) (export "main" (func $main)) (func $__wasm_call_ctors - (nop) ) (func $foo (param $0 i32) (param $1 i32) (result i32) (local $2 i32) diff --git a/test/lld/recursive_safe_stack.wat.out b/test/lld/recursive_safe_stack.wat.out index ad30dc776aa..f042d8e1522 100644 --- a/test/lld/recursive_safe_stack.wat.out +++ b/test/lld/recursive_safe_stack.wat.out @@ -21,7 +21,6 @@ (export "main" (func $main)) (export "__set_stack_limits" (func $__set_stack_limits)) (func $__wasm_call_ctors - (nop) ) (func $foo (param $0 i32) (param $1 i32) (result i32) (local $2 i32) diff --git a/test/lld/reserved_func_ptr.wat.out b/test/lld/reserved_func_ptr.wat.out index 5239ce510bb..554d6aa0606 100644 --- a/test/lld/reserved_func_ptr.wat.out +++ b/test/lld/reserved_func_ptr.wat.out @@ -17,13 +17,10 @@ (export "__main_argc_argv" (func $main)) (export "dynCall_viii" (func $dynCall_viii)) (func $__wasm_call_ctors - (nop) ) (func $address_taken_func\28int\2c\20int\2c\20int\29 (param $0 i32) (param $1 i32) (param $2 i32) - (nop) ) (func $address_taken_func2\28int\2c\20int\2c\20int\29 (param $0 i32) (param $1 i32) (param $2 i32) - (nop) ) (func $main (param $0 i32) (param $1 i32) (result i32) (local $2 i32) diff --git a/test/lld/safe_stack_standalone-wasm.wat.out b/test/lld/safe_stack_standalone-wasm.wat.out index 63d6c09d492..2820566b3ee 100644 --- a/test/lld/safe_stack_standalone-wasm.wat.out +++ b/test/lld/safe_stack_standalone-wasm.wat.out @@ -19,7 +19,6 @@ (export "main" (func $main)) (export "__set_stack_limits" (func $__set_stack_limits)) (func $__wasm_call_ctors - (nop) ) (func $foo (param $0 i32) (param $1 i32) (result i32) (local $2 i32) diff --git a/test/lld/shared.wat.out b/test/lld/shared.wat.out index 1a496e43650..6ce5b208e86 100644 --- a/test/lld/shared.wat.out +++ b/test/lld/shared.wat.out @@ -19,7 +19,6 @@ (export "ptr_puts" (global $global$0)) (export "ptr_local_func" (global $global$1)) (func $__wasm_call_ctors - (nop) ) (func $__wasm_apply_data_relocs (i32.store diff --git a/test/lld/shared_longjmp.wat.out b/test/lld/shared_longjmp.wat.out index 449714270ea..96ef571f779 100644 --- a/test/lld/shared_longjmp.wat.out +++ b/test/lld/shared_longjmp.wat.out @@ -32,10 +32,8 @@ (export "__threwValue" (global $global$1)) (export "dynCall_vii" (func $dynCall_vii)) (func $__wasm_call_ctors - (nop) ) (func $__wasm_apply_data_relocs - (nop) ) (func $_start (local $0 i32) diff --git a/test/metadce/name_collision.wast.dced b/test/metadce/name_collision.wast.dced index 50e7010dc45..6be2d6ecfab 100644 --- a/test/metadce/name_collision.wast.dced +++ b/test/metadce/name_collision.wast.dced @@ -2,6 +2,5 @@ (type $0 (func)) (export "test" (func $test)) (func $test (type $0) - (nop) ) ) diff --git a/test/metadce/outside.wast.dced b/test/metadce/outside.wast.dced index 6cc8b71d601..f5dc4e1e0b4 100644 --- a/test/metadce/outside.wast.dced +++ b/test/metadce/outside.wast.dced @@ -11,7 +11,6 @@ (elem $0 (global.get $from_segment_2) $table_func) (export "wasm_func" (func $a_wasm_func)) (func $table_func (type $0) - (nop) ) (func $a_wasm_func (type $0) (call $a_js_func) diff --git a/test/metadce/tag.wast.dced b/test/metadce/tag.wast.dced index 6f07a4e7571..f2d5cf6250b 100644 --- a/test/metadce/tag.wast.dced +++ b/test/metadce/tag.wast.dced @@ -9,7 +9,6 @@ (throw $t0) ) (catch $t1 - (nop) ) ) ) diff --git a/test/passes/duplicate-function-elimination_all-features.txt b/test/passes/duplicate-function-elimination_all-features.txt index 6867002bf0b..d46f4ed416f 100644 --- a/test/passes/duplicate-function-elimination_all-features.txt +++ b/test/passes/duplicate-function-elimination_all-features.txt @@ -16,7 +16,6 @@ (export "memory" (memory $foo)) (export "global" (global $bar)) (func $bar (type $0) - (nop) ) ) (module diff --git a/test/passes/func-metrics.txt b/test/passes/func-metrics.txt index b61e8146ec9..86eb8871f10 100644 --- a/test/passes/func-metrics.txt +++ b/test/passes/func-metrics.txt @@ -13,10 +13,10 @@ global Const : 3 RefFunc : 3 func: empty - [binary-bytes] : 3 + [binary-bytes] : 2 [total] : 1 [vars] : 0 - Nop : 1 + Block : 1 func: small [binary-bytes] : 9 [total] : 5 @@ -44,7 +44,6 @@ func: ifs (table $0 256 256 funcref) (elem $0 (i32.const 0) $ifs $ifs $ifs) (func $empty - (nop) ) (func $small (nop) diff --git a/test/passes/licm.txt b/test/passes/licm.txt index 83edd78c3d2..64d86c32efa 100644 --- a/test/passes/licm.txt +++ b/test/passes/licm.txt @@ -508,7 +508,6 @@ ) (func $after (loop $loop - (nop) ) (drop (i32.const 10) diff --git a/test/passes/minify-imports-and-exports_all-features.txt b/test/passes/minify-imports-and-exports_all-features.txt index 2d131416d48..87aa3c2f289 100644 --- a/test/passes/minify-imports-and-exports_all-features.txt +++ b/test/passes/minify-imports-and-exports_all-features.txt @@ -10020,9 +10020,7 @@ longname4880 => zza (export "OBa" (func $foo2)) (export "PBa" (tag $tag1)) (func $foo1 (type $0) - (nop) ) (func $foo2 (type $0) - (nop) ) ) diff --git a/test/passes/minify-imports_all-features.txt b/test/passes/minify-imports_all-features.txt index 536a6a042f6..ec25564396a 100644 --- a/test/passes/minify-imports_all-features.txt +++ b/test/passes/minify-imports_all-features.txt @@ -10014,9 +10014,7 @@ longname4880 => zza (export "foo2" (func $foo2)) (export "tag1" (tag $tag1)) (func $foo1 (type $0) - (nop) ) (func $foo2 (type $0) - (nop) ) ) diff --git a/test/passes/post-emscripten.txt b/test/passes/post-emscripten.txt index 186cdeb7675..6cefe366f8e 100644 --- a/test/passes/post-emscripten.txt +++ b/test/passes/post-emscripten.txt @@ -43,10 +43,8 @@ ) ) (func $other_safe (param $0 i32) (param $1 f32) - (nop) ) (func $other_unsafe (param $0 i32) (param $1 f32) - (nop) ) (func $deep_safe (param $0 i32) (param $1 f32) (call $other_safe @@ -84,7 +82,6 @@ ) ) (func $other_safe (param $0 i32) (param $1 f32) - (nop) ) ) (module diff --git a/test/passes/print-function-map.txt b/test/passes/print-function-map.txt index 228276e0635..5cf4c5843fb 100644 --- a/test/passes/print-function-map.txt +++ b/test/passes/print-function-map.txt @@ -5,9 +5,7 @@ (type $0 (func)) (import "env" "foo" (func $Foo)) (func $bar - (nop) ) (func $baz - (nop) ) ) diff --git a/test/passes/remove-unused-brs_enable-multivalue.txt b/test/passes/remove-unused-brs_enable-multivalue.txt index f3c1b7d7733..ee6efbf4dab 100644 --- a/test/passes/remove-unused-brs_enable-multivalue.txt +++ b/test/passes/remove-unused-brs_enable-multivalue.txt @@ -529,7 +529,6 @@ ) ) (loop $in2 - (nop) ) (loop $in3 (block $out2 diff --git a/test/passes/remove-unused-names_merge-blocks_all-features.txt b/test/passes/remove-unused-names_merge-blocks_all-features.txt index ec63edd5e01..2169d636b71 100644 --- a/test/passes/remove-unused-names_merge-blocks_all-features.txt +++ b/test/passes/remove-unused-names_merge-blocks_all-features.txt @@ -1657,7 +1657,6 @@ (type $1 (func (param i32))) (tag $e (param i32)) (func $foo (type $0) - (nop) ) (func $throw (type $0) (nop) diff --git a/test/passes/remove-unused-nonfunction-module-elements_all-features.txt b/test/passes/remove-unused-nonfunction-module-elements_all-features.txt index e125373d8d8..c56b99253d1 100644 --- a/test/passes/remove-unused-nonfunction-module-elements_all-features.txt +++ b/test/passes/remove-unused-nonfunction-module-elements_all-features.txt @@ -111,7 +111,6 @@ (data $0 (i32.const 1) "hello, world!") (elem $0 (i32.const 0) $waka) (func $waka (type $0) - (nop) ) ) (module @@ -228,7 +227,6 @@ (data $0 (global.get $memoryBase) "hello, world!") (elem $0 (global.get $tableBase) $waka) (func $waka (type $0) - (nop) ) ) (module @@ -347,6 +345,5 @@ (tag $e1 (param i64)) (export "e1" (tag $e1)) (func $f (type $0) (param $0 i32) - (nop) ) ) diff --git a/test/passes/spill-pointers.txt b/test/passes/spill-pointers.txt index 0c51683efdf..52d7b19a16b 100644 --- a/test/passes/spill-pointers.txt +++ b/test/passes/spill-pointers.txt @@ -12,7 +12,6 @@ (table $0 1 1 funcref) (elem $0 (i32.const 0)) (func $nothing - (nop) ) (func $not-alive (local $x i32) @@ -698,7 +697,6 @@ (global.get $stack_ptr) ) (func $nothing - (nop) ) (func $not-alive (local $x i32) From 5e0c0b9db0b2af8fc2e1a1182617bca740a45c45 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Thu, 14 Nov 2024 16:37:19 -0800 Subject: [PATCH 21/56] update source map test --- test/lit/debug/source-map-smearing.wast | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/lit/debug/source-map-smearing.wast b/test/lit/debug/source-map-smearing.wast index 875bec9d3f1..eeeb49fea07 100644 --- a/test/lit/debug/source-map-smearing.wast +++ b/test/lit/debug/source-map-smearing.wast @@ -11,7 +11,7 @@ ;; Check that the debug locations do not smear beyond a function ;; epilogue to the next function. The encoded segment 'C' means that ;; the previous segment is indeed one-byte long. -;; CHECK: {"version":3,"sources":["foo"],"names":[],"mappings":"yBAAC,C,GACC"} +;; CHECK: {"version":3,"sources":["foo"],"names":[],"mappings":"wBAAC,C,EACC"} (module (func $0 ;;@ foo:1:1 From 21ef873df4e84f259917e8716c3c463970d76b57 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Thu, 14 Nov 2024 16:34:14 -0800 Subject: [PATCH 22/56] Reset function context when ending a function in IRBuilder IRBuilder contains a pointer to the current function that is used to create scratch locals, look up the operand types for returns, etc. This pointer is nullable because IRBuilder can also be used in non-function contexts such as global initializers. Visiting the start of a function sets the function pointer, and after this change visiting the end of a function resets the pointer to null. This avoids potential problems where code outside a function would be able to incorrectly use scratch locals and returns if the IRBuilder had previously been used to build a function. This change requires some adjustments to Outlining, which visits code out of order, so ends up visiting code from inside a function after visiting the end of the function. To support this use case, add a `setFunction` method to IRBuilder that lets the user explicitly control its function context. Also remove the optional function pointer parameter to the IRBuilder constructor since it is less flexible and not used. --- src/passes/Outlining.cpp | 18 ++++++++++++------ src/wasm-ir-builder.h | 9 ++++++--- src/wasm/wasm-ir-builder.cpp | 1 + 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/passes/Outlining.cpp b/src/passes/Outlining.cpp index 68c3d039707..429511557e1 100644 --- a/src/passes/Outlining.cpp +++ b/src/passes/Outlining.cpp @@ -42,8 +42,8 @@ namespace wasm { struct ReconstructStringifyWalker : public StringifyWalker { - ReconstructStringifyWalker(Module* wasm) - : existingBuilder(*wasm), outlinedBuilder(*wasm) { + ReconstructStringifyWalker(Module* wasm, Function* func) + : existingBuilder(*wasm), outlinedBuilder(*wasm), func(func) { this->setModule(wasm); DBG(std::cerr << "\nexistingBuilder: " << &existingBuilder << " outlinedBuilder: " << &outlinedBuilder << "\n"); @@ -77,6 +77,9 @@ struct ReconstructStringifyWalker // contain repeat sequences found in the program. IRBuilder outlinedBuilder; + // The function we are outlining from. + Function* func; + void addUniqueSymbol(SeparatorReason reason) { if (auto curr = reason.getFuncStart()) { startExistingFunction(curr->func); @@ -108,6 +111,8 @@ struct ReconstructStringifyWalker DBG(desc = "Loop Start at "); } else if (reason.getEnd()) { ASSERT_OK(existingBuilder.visitEnd()); + // Reset the function in case we just ended the function scope. + existingBuilder.setFunction(func); // Outlining performs an unnested walk of the Wasm module, visiting // each scope one at a time. IRBuilder, in contrast, expects to // visit several nested scopes at a time. Thus, calling end() finalizes @@ -346,15 +351,16 @@ struct Outlining : public Pass { void outline(Module* module, Sequences seqByFunc) { // TODO: Make this a function-parallel sub-pass. - ReconstructStringifyWalker reconstruct(module); std::vector keys(seqByFunc.size()); std::transform(seqByFunc.begin(), seqByFunc.end(), keys.begin(), [](auto pair) { return pair.first; }); - for (auto func : keys) { - reconstruct.sequences = std::move(seqByFunc[func]); - reconstruct.doWalkFunction(module->getFunction(func)); + for (auto funcName : keys) { + auto* func = module->getFunction(funcName); + ReconstructStringifyWalker reconstruct(module, func); + reconstruct.sequences = std::move(seqByFunc[funcName]); + reconstruct.doWalkFunction(func); } } diff --git a/src/wasm-ir-builder.h b/src/wasm-ir-builder.h index 40689a879e6..0210c55e50b 100644 --- a/src/wasm-ir-builder.h +++ b/src/wasm-ir-builder.h @@ -40,8 +40,7 @@ namespace wasm { // globals, tables, functions, etc.) to already exist in the module. class IRBuilder : public UnifiedExpressionVisitor> { public: - IRBuilder(Module& wasm, Function* func = nullptr) - : wasm(wasm), func(func), builder(wasm) {} + IRBuilder(Module& wasm) : wasm(wasm), builder(wasm) {} // Get the valid Binaryen IR expression representing the sequence of visited // instructions. The IRBuilder is reset and can be used with a fresh sequence @@ -60,6 +59,10 @@ class IRBuilder : public UnifiedExpressionVisitor> { // pushed instruction. void setDebugLocation(const std::optional&); + // Set the function used to add scratch locals when constructing an isolated + // sequence of IR. + void setFunction(Function* func) { this->func = func; } + // Handle the boundaries of control flow structures. Users may choose to use // the corresponding `makeXYZ` function below instead of `visitXYZStart`, but // either way must call `visitEnd` and friends at the appropriate times. @@ -234,7 +237,7 @@ class IRBuilder : public UnifiedExpressionVisitor> { private: Module& wasm; - Function* func; + Function* func = nullptr; Builder builder; // The location lacks debug info as it was marked as not having it. diff --git a/src/wasm/wasm-ir-builder.cpp b/src/wasm/wasm-ir-builder.cpp index 5e5decca42b..398db68ff4f 100644 --- a/src/wasm/wasm-ir-builder.cpp +++ b/src/wasm/wasm-ir-builder.cpp @@ -981,6 +981,7 @@ Result<> IRBuilder::visitEnd() { if (scope.needsPopFixup()) { EHUtils::handleBlockNestedPops(func, wasm); } + this->func = nullptr; } else if (auto* block = scope.getBlock()) { assert(*expr == block); block->name = scope.label; From 54134fd0b2ac63528c771c7c5d9f35c1b56989a1 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Thu, 14 Nov 2024 16:58:28 -0800 Subject: [PATCH 23/56] fix gtest --- test/gtest/cfg.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/gtest/cfg.cpp b/test/gtest/cfg.cpp index b8d26caa4b6..35ccf855bb8 100644 --- a/test/gtest/cfg.cpp +++ b/test/gtest/cfg.cpp @@ -149,7 +149,7 @@ TEST_F(CFGTest, Empty) { ;; entry ;; exit 0: - 0: nop + 0: block )cfg"; Module wasm; From ab150cd2c1cce513929dd72b155fc75b59091331 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Thu, 14 Nov 2024 17:46:29 -0800 Subject: [PATCH 24/56] update binaryen.js tests --- test/binaryen.js/debug-info.js.txt | 3 --- test/binaryen.js/debug-names.js.txt | 3 --- 2 files changed, 6 deletions(-) diff --git a/test/binaryen.js/debug-info.js.txt b/test/binaryen.js/debug-info.js.txt index 7802e341539..027961741d2 100644 --- a/test/binaryen.js/debug-info.js.txt +++ b/test/binaryen.js/debug-info.js.txt @@ -5,7 +5,6 @@ debugInfo=false (memory $0 0) (export "test" (func $0)) (func $0 - (nop) ) ) @@ -16,7 +15,6 @@ debugInfo=true (memory $0 0) (export "test" (func $test)) (func $test - (nop) ) ) @@ -27,7 +25,6 @@ debugInfo=false (memory $0 0) (export "test" (func $0)) (func $0 - (nop) ) ) diff --git a/test/binaryen.js/debug-names.js.txt b/test/binaryen.js/debug-names.js.txt index dc66048ca80..34de198cd22 100644 --- a/test/binaryen.js/debug-names.js.txt +++ b/test/binaryen.js/debug-names.js.txt @@ -16,7 +16,6 @@ (table $wor 0 0 funcref) (func $of (param $wasm i32) (local $!#$%&'*+-./:<=>?@\^_`|~ f64) - (nop) ) ) @@ -28,7 +27,6 @@ (table $wor 0 0 funcref) (func $of (param $js i32) (local $!#$%&'*+-./:<=>?@\5c^_`|~ f64) - (nop) ) ) @@ -40,7 +38,6 @@ (table $wor 0 0 funcref) (func $of (param $js i32) (local $!#$%&'*+-./:<=>?@\5c^_`|~ f64) - (nop) ) ) From fa07c51252cb2f449bffeabf1a4b51a2d4ddd301 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Fri, 15 Nov 2024 10:34:21 -0800 Subject: [PATCH 25/56] Add missing CHECK_ERR --- src/parser/parsers.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parser/parsers.h b/src/parser/parsers.h index b6699aab6a9..4121788d75e 100644 --- a/src/parser/parsers.h +++ b/src/parser/parsers.h @@ -1143,7 +1143,7 @@ ifelse(Ctx& ctx, const std::vector& annotations, bool folded) { ctx.setSrcLoc(annotations); } - ctx.makeIf(pos, annotations, label, *type); + CHECK_ERR(ctx.makeIf(pos, annotations, label, *type)); if (folded && !ctx.in.takeSExprStart("then"sv)) { return ctx.in.err("expected 'then' before if instructions"); From c18d60a8fa961d2c297c73ad7518f9ea87166d1f Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Fri, 15 Nov 2024 17:22:29 -0800 Subject: [PATCH 26/56] [NFC] Finalize blocks with explicit breakability in IRBuilder Since IRBuilder already knows what labels are used by branches, it is easy for it to pass that information when finalizing blocks. This avoids finalization having to walk the blocks looking for branches, speeding up a future version of the binary parser that uses IRBuilder by 10%. --- src/passes/Outlining.cpp | 7 +++++++ src/wasm/wasm-ir-builder.cpp | 12 ++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/passes/Outlining.cpp b/src/passes/Outlining.cpp index 429511557e1..85abb57e422 100644 --- a/src/passes/Outlining.cpp +++ b/src/passes/Outlining.cpp @@ -304,6 +304,13 @@ struct Outlining : public Pass { // Position the outlined functions first in the functions vector to make // the outlining lit tests far more readable. moveOutlinedFunctions(module, substrings.size()); + + // Because we visit control flow in an odd order, IRBuilder is not able to + // properly track branches, so it may not have finalized blocks with the + // correct types. ReFinalize now to fix any issues. + PassRunner runner(getPassRunner()); + runner.add(std::make_unique()); + runner.run(); } Name addOutlinedFunction(Module* module, diff --git a/src/wasm/wasm-ir-builder.cpp b/src/wasm/wasm-ir-builder.cpp index 0d46156be28..5253c91ee5d 100644 --- a/src/wasm/wasm-ir-builder.cpp +++ b/src/wasm/wasm-ir-builder.cpp @@ -972,7 +972,12 @@ Result<> IRBuilder::visitEnd() { block->type = blockType; return block; } - return builder.makeBlock(label, {curr}, blockType); + auto* block = builder.makeBlock(); + block->name = label; + block->list.push_back(curr); + block->finalize(blockType, + scope.labelUsed ? Block::HasBreak : Block::NoBreak); + return block; }; if (auto* func = scope.getFunction()) { @@ -985,9 +990,8 @@ Result<> IRBuilder::visitEnd() { } else if (auto* block = scope.getBlock()) { assert(*expr == block); block->name = scope.label; - // TODO: Track branches so we can know whether this block is a target and - // finalize more efficiently. - block->finalize(block->type); + block->finalize(block->type, + scope.labelUsed ? Block::HasBreak : Block::NoBreak); push(block); } else if (auto* loop = scope.getLoop()) { loop->body = *expr; From 5b2c76f5607020dc7ce76e88d80c1e5f17227c40 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Mon, 18 Nov 2024 11:04:14 -0800 Subject: [PATCH 27/56] Use hints when generating fresh labels in IRBuilder IRBuilder often has to generate new label names for blocks and other scopes. Previously it would generate each new name by starting with "block" or "label" and incrementing a suffix until finding a fresh name, but this made name generation quadratic in the number of names to generate. To spend less time generating names, track a hint index at which to start looking for a fresh name and increment it every time a name is generated. This speeds up a version of the binary parser that uses IRBuilder by about 15%. --- src/wasm-ir-builder.h | 7 ++- src/wasm/wasm-ir-builder.cpp | 6 ++- test/lit/basic/reference-types.wast | 38 +++++++------- test/lit/passes/outlining.wast | 4 +- test/lit/wat-kitchen-sink.wast | 18 +++---- test/wasm2js/br_table_temp.2asm.js | 68 +++++++++++++------------- test/wasm2js/br_table_temp.2asm.js.opt | 20 ++++---- test/wasm2js/labels.2asm.js | 8 +-- 8 files changed, 87 insertions(+), 82 deletions(-) diff --git a/src/wasm-ir-builder.h b/src/wasm-ir-builder.h index d6e45314933..30e770e28dd 100644 --- a/src/wasm-ir-builder.h +++ b/src/wasm-ir-builder.h @@ -507,16 +507,19 @@ class IRBuilder : public UnifiedExpressionVisitor> { // its stack. std::unordered_map> labelDepths; - Name makeFresh(Name label) { + Name makeFresh(Name label, Index hint = 0) { return Names::getValidName( label, [&](Name candidate) { return labelDepths.insert({candidate, {}}).second; }, - 0, + hint, ""); } + Index blockHint = 0; + Index labelHint = 0; + void pushScope(ScopeCtx scope) { if (auto label = scope.getOriginalLabel()) { // Assign a fresh label to the scope, if necessary. diff --git a/src/wasm/wasm-ir-builder.cpp b/src/wasm/wasm-ir-builder.cpp index 5253c91ee5d..a73c7f2acb4 100644 --- a/src/wasm/wasm-ir-builder.cpp +++ b/src/wasm/wasm-ir-builder.cpp @@ -987,6 +987,8 @@ Result<> IRBuilder::visitEnd() { EHUtils::handleBlockNestedPops(func, wasm); } this->func = nullptr; + blockHint = 0; + labelHint = 0; } else if (auto* block = scope.getBlock()) { assert(*expr == block); block->name = scope.label; @@ -1073,9 +1075,9 @@ Result IRBuilder::getLabelName(Index label, bool forDelegate) { if (!scopeLabel) { // The scope does not already have a name, so we need to create one. if ((*scope)->getBlock()) { - scopeLabel = makeFresh("block"); + scopeLabel = makeFresh("block", blockHint++); } else { - scopeLabel = makeFresh("label"); + scopeLabel = makeFresh("label", labelHint++); } } if (!forDelegate) { diff --git a/test/lit/basic/reference-types.wast b/test/lit/basic/reference-types.wast index 6ef51c23d39..44494c80d97 100644 --- a/test/lit/basic/reference-types.wast +++ b/test/lit/basic/reference-types.wast @@ -361,25 +361,17 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (drop - ;; CHECK-TEXT-NEXT: (block $block0 (result eqref) - ;; CHECK-TEXT-NEXT: (br_if $block0 - ;; CHECK-TEXT-NEXT: (global.get $global_eqref) - ;; CHECK-TEXT-NEXT: (i32.const 1) - ;; CHECK-TEXT-NEXT: ) - ;; CHECK-TEXT-NEXT: ) - ;; CHECK-TEXT-NEXT: ) - ;; CHECK-TEXT-NEXT: (drop ;; CHECK-TEXT-NEXT: (block $block1 (result eqref) ;; CHECK-TEXT-NEXT: (br_if $block1 - ;; CHECK-TEXT-NEXT: (ref.null none) + ;; CHECK-TEXT-NEXT: (global.get $global_eqref) ;; CHECK-TEXT-NEXT: (i32.const 1) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (drop - ;; CHECK-TEXT-NEXT: (block $block2 (result funcref) + ;; CHECK-TEXT-NEXT: (block $block2 (result eqref) ;; CHECK-TEXT-NEXT: (br_if $block2 - ;; CHECK-TEXT-NEXT: (local.get $local_funcref) + ;; CHECK-TEXT-NEXT: (ref.null none) ;; CHECK-TEXT-NEXT: (i32.const 1) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) @@ -387,7 +379,7 @@ ;; CHECK-TEXT-NEXT: (drop ;; CHECK-TEXT-NEXT: (block $block3 (result funcref) ;; CHECK-TEXT-NEXT: (br_if $block3 - ;; CHECK-TEXT-NEXT: (global.get $global_funcref) + ;; CHECK-TEXT-NEXT: (local.get $local_funcref) ;; CHECK-TEXT-NEXT: (i32.const 1) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) @@ -395,7 +387,7 @@ ;; CHECK-TEXT-NEXT: (drop ;; CHECK-TEXT-NEXT: (block $block4 (result funcref) ;; CHECK-TEXT-NEXT: (br_if $block4 - ;; CHECK-TEXT-NEXT: (ref.null nofunc) + ;; CHECK-TEXT-NEXT: (global.get $global_funcref) ;; CHECK-TEXT-NEXT: (i32.const 1) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) @@ -403,15 +395,15 @@ ;; CHECK-TEXT-NEXT: (drop ;; CHECK-TEXT-NEXT: (block $block5 (result funcref) ;; CHECK-TEXT-NEXT: (br_if $block5 - ;; CHECK-TEXT-NEXT: (ref.func $foo) + ;; CHECK-TEXT-NEXT: (ref.null nofunc) ;; CHECK-TEXT-NEXT: (i32.const 1) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (drop - ;; CHECK-TEXT-NEXT: (block $block6 (result anyref) + ;; CHECK-TEXT-NEXT: (block $block6 (result funcref) ;; CHECK-TEXT-NEXT: (br_if $block6 - ;; CHECK-TEXT-NEXT: (local.get $local_anyref) + ;; CHECK-TEXT-NEXT: (ref.func $foo) ;; CHECK-TEXT-NEXT: (i32.const 1) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) @@ -419,7 +411,7 @@ ;; CHECK-TEXT-NEXT: (drop ;; CHECK-TEXT-NEXT: (block $block7 (result anyref) ;; CHECK-TEXT-NEXT: (br_if $block7 - ;; CHECK-TEXT-NEXT: (global.get $global_anyref) + ;; CHECK-TEXT-NEXT: (local.get $local_anyref) ;; CHECK-TEXT-NEXT: (i32.const 1) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) @@ -427,7 +419,7 @@ ;; CHECK-TEXT-NEXT: (drop ;; CHECK-TEXT-NEXT: (block $block8 (result anyref) ;; CHECK-TEXT-NEXT: (br_if $block8 - ;; CHECK-TEXT-NEXT: (ref.null none) + ;; CHECK-TEXT-NEXT: (global.get $global_anyref) ;; CHECK-TEXT-NEXT: (i32.const 1) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) @@ -435,7 +427,7 @@ ;; CHECK-TEXT-NEXT: (drop ;; CHECK-TEXT-NEXT: (block $block9 (result anyref) ;; CHECK-TEXT-NEXT: (br_if $block9 - ;; CHECK-TEXT-NEXT: (local.get $local_eqref) + ;; CHECK-TEXT-NEXT: (ref.null none) ;; CHECK-TEXT-NEXT: (i32.const 1) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) @@ -443,6 +435,14 @@ ;; CHECK-TEXT-NEXT: (drop ;; CHECK-TEXT-NEXT: (block $block10 (result anyref) ;; CHECK-TEXT-NEXT: (br_if $block10 + ;; CHECK-TEXT-NEXT: (local.get $local_eqref) + ;; CHECK-TEXT-NEXT: (i32.const 1) + ;; CHECK-TEXT-NEXT: ) + ;; CHECK-TEXT-NEXT: ) + ;; CHECK-TEXT-NEXT: ) + ;; CHECK-TEXT-NEXT: (drop + ;; CHECK-TEXT-NEXT: (block $block11 (result anyref) + ;; CHECK-TEXT-NEXT: (br_if $block11 ;; CHECK-TEXT-NEXT: (ref.null none) ;; CHECK-TEXT-NEXT: (i32.const 1) ;; CHECK-TEXT-NEXT: ) diff --git a/test/lit/passes/outlining.wast b/test/lit/passes/outlining.wast index 5119572b395..a02e6f2cd89 100644 --- a/test/lit/passes/outlining.wast +++ b/test/lit/passes/outlining.wast @@ -675,8 +675,8 @@ ;; CHECK: (func $a (type $1) (param $0 i32) (result i32) ;; CHECK-NEXT: (call $outline$) ;; CHECK-NEXT: (block $block - ;; CHECK-NEXT: (block $block0 - ;; CHECK-NEXT: (br_table $block $block0 + ;; CHECK-NEXT: (block $block1 + ;; CHECK-NEXT: (br_table $block $block1 ;; CHECK-NEXT: (local.get $0) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (return diff --git a/test/lit/wat-kitchen-sink.wast b/test/lit/wat-kitchen-sink.wast index 97d9f57e835..8b77de74dac 100644 --- a/test/lit/wat-kitchen-sink.wast +++ b/test/lit/wat-kitchen-sink.wast @@ -2570,14 +2570,14 @@ ) ;; CHECK: (func $label-index (type $0) - ;; CHECK-NEXT: (block $block1 + ;; CHECK-NEXT: (block $block2 ;; CHECK-NEXT: (block $block - ;; CHECK-NEXT: (block $block0 + ;; CHECK-NEXT: (block $block1 ;; CHECK-NEXT: (block $l ;; CHECK-NEXT: (br $block) - ;; CHECK-NEXT: (br $block0) - ;; CHECK-NEXT: (br $l) ;; CHECK-NEXT: (br $block1) + ;; CHECK-NEXT: (br $l) + ;; CHECK-NEXT: (br $block2) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -2844,9 +2844,9 @@ ;; CHECK: (func $br-table-index (type $0) ;; CHECK-NEXT: (block $block ;; CHECK-NEXT: (block $l - ;; CHECK-NEXT: (block $block1 - ;; CHECK-NEXT: (block $block0 - ;; CHECK-NEXT: (br_table $block $l $block0 $block1 + ;; CHECK-NEXT: (block $block2 + ;; CHECK-NEXT: (block $block1 + ;; CHECK-NEXT: (br_table $block $l $block1 $block2 ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -4821,9 +4821,9 @@ ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (block $block (result (ref $to-f32-cont)) ;; CHECK-NEXT: (tuple.drop 3 - ;; CHECK-NEXT: (block $block0 (type $34) (result i32 i64 (ref null $simple-cont)) + ;; CHECK-NEXT: (block $block1 (type $34) (result i32 i64 (ref null $simple-cont)) ;; CHECK-NEXT: (local.set $f - ;; CHECK-NEXT: (resume $simple-cont (on $empty $block) (on $tag-pair-to-pair $block0) + ;; CHECK-NEXT: (resume $simple-cont (on $empty $block) (on $tag-pair-to-pair $block1) ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: (i64.const 1) ;; CHECK-NEXT: (local.get $ct) diff --git a/test/wasm2js/br_table_temp.2asm.js b/test/wasm2js/br_table_temp.2asm.js index 9bc6cafa4f3..a8592a186c4 100644 --- a/test/wasm2js/br_table_temp.2asm.js +++ b/test/wasm2js/br_table_temp.2asm.js @@ -115,7 +115,7 @@ function asmFunc(imports) { function $11($0_1) { $0_1 = $0_1 | 0; var $2_1 = 0, $4_1 = 0, $3_1 = 0; - block0 : { + block1 : { block : { $2_1 = 33; $3_1 = $2_1; @@ -124,7 +124,7 @@ function asmFunc(imports) { case 0: break block; default: - break block0; + break block1; }; } $4_1 = 32; @@ -134,7 +134,7 @@ function asmFunc(imports) { function $12($0_1) { $0_1 = $0_1 | 0; - block3 : { + block4 : { switch ($0_1 | 0) { case 3: return 100 | 0; @@ -145,7 +145,7 @@ function asmFunc(imports) { case 0: return 103 | 0; default: - break block3; + break block4; }; } return 104 | 0; @@ -154,11 +154,11 @@ function asmFunc(imports) { function $13($0_1) { $0_1 = $0_1 | 0; var $1_1 = 0, $3_1 = 0, $4_1 = 0, $5_1 = 0, $6_1 = 0, $7_1 = 0, $8_1 = 0; - block3 : { + block4 : { block : { - block0 : { - block1 : { - block2 : { + block1 : { + block2 : { + block3 : { $3_1 = 200; $4_1 = $3_1; $5_1 = $3_1; @@ -169,13 +169,13 @@ function asmFunc(imports) { case 0: break block; case 1: - break block0; - case 2: break block1; - case 3: + case 2: break block2; - default: + case 3: break block3; + default: + break block4; }; } $1_1 = $7_1; @@ -196,7 +196,7 @@ function asmFunc(imports) { function $14($0_1) { $0_1 = $0_1 | 0; - block0 : { + block1 : { switch ($0_1 | 0) { case 0: case 2: @@ -12508,7 +12508,7 @@ function asmFunc(imports) { case 24614: return 0 | 0; default: - break block0; + break block1; }; } return 1 | 0; @@ -13052,8 +13052,8 @@ function asmFunc(imports) { function $58($0_1) { $0_1 = $0_1 | 0; var $2_1 = 0, $4_1 = 0, $5_1 = 0, $3_1 = 0; - block1 : { - block0 : { + block2 : { + block1 : { block : { $2_1 = 16; $3_1 = $2_1; @@ -13063,9 +13063,9 @@ function asmFunc(imports) { case 0: break block; case 1: - break block0; - default: break block1; + default: + break block2; }; } $4_1 = 2 + $3_1 | 0; @@ -13079,8 +13079,8 @@ function asmFunc(imports) { $0_1 = $0_1 | 0; var $2_1 = 0, $3_1 = 0, $4_1 = 0, $5_1 = 0; block : { - block0 : { - block1 : { + block1 : { + block2 : { $2_1 = 8; $3_1 = $2_1; $4_1 = $2_1; @@ -13089,9 +13089,9 @@ function asmFunc(imports) { case 0: break block; case 1: - break block0; - default: break block1; + default: + break block2; }; } $4_1 = 16; @@ -13104,8 +13104,8 @@ function asmFunc(imports) { function $60($0_1) { $0_1 = $0_1 | 0; var $2_1 = 0, $3_1 = 0, $4_1 = 0, $5_1 = 0; - block1 : { - block0 : { + block2 : { + block1 : { block : { $2_1 = 8; $3_1 = $2_1; @@ -13115,9 +13115,9 @@ function asmFunc(imports) { case 0: break block; case 1: - break block0; - default: break block1; + default: + break block2; }; } $4_1 = 16; @@ -13130,14 +13130,14 @@ function asmFunc(imports) { function $61($0_1) { $0_1 = $0_1 | 0; var $3_1 = 0, $2_1 = 0, $4_1 = 0; - block0 : { + block1 : { block : { $2_1 = 8; $3_1 = $2_1; $4_1 = $2_1; switch ($0_1 | 0) { case 1: - break block0; + break block1; default: break block; }; @@ -13150,8 +13150,8 @@ function asmFunc(imports) { function $62($0_1) { $0_1 = $0_1 | 0; var $2_1 = 0, $3_1 = 0, $4_1 = 0, $5_1 = 0; - block1 : { - block0 : { + block2 : { + block1 : { block : { $2_1 = 8; $3_1 = $2_1; @@ -13161,9 +13161,9 @@ function asmFunc(imports) { case 0: break block; case 1: - break block0; - default: break block1; + default: + break block2; }; } $4_1 = 16; @@ -13176,14 +13176,14 @@ function asmFunc(imports) { function $63($0_1) { $0_1 = $0_1 | 0; var $3_1 = 0, $2_1 = 0, $4_1 = 0; - block0 : { + block1 : { block : { $2_1 = 8; $3_1 = $2_1; $4_1 = $2_1; switch ($0_1 | 0) { case 1: - break block0; + break block1; default: break block; }; diff --git a/test/wasm2js/br_table_temp.2asm.js.opt b/test/wasm2js/br_table_temp.2asm.js.opt index b64e46a77a3..f1dad0ab274 100644 --- a/test/wasm2js/br_table_temp.2asm.js.opt +++ b/test/wasm2js/br_table_temp.2asm.js.opt @@ -60,7 +60,7 @@ function asmFunc(imports) { function $12($0) { $0 = $0 | 0; - block3 : { + block4 : { switch ($0 | 0) { case 3: return 100; @@ -71,7 +71,7 @@ function asmFunc(imports) { case 0: return 103; default: - break block3; + break block4; }; } return 104; @@ -79,7 +79,7 @@ function asmFunc(imports) { function $13($0) { $0 = $0 | 0; - block3 : { + block4 : { switch ($0 | 0) { case 3: return 210; @@ -90,7 +90,7 @@ function asmFunc(imports) { case 0: return 213; default: - break block3; + break block4; }; } return 214; @@ -98,7 +98,7 @@ function asmFunc(imports) { function $14($0) { $0 = $0 | 0; - block0 : { + block1 : { switch ($0 | 0) { case 0: case 2: @@ -12410,7 +12410,7 @@ function asmFunc(imports) { case 24614: return 0; default: - break block0; + break block1; }; } return 1; @@ -12554,7 +12554,7 @@ function asmFunc(imports) { $0 = $0 | 0; var $1 = 0; $1 = 16; - block1 : { + block2 : { switch ($0 | 0) { case 0: $1 = 18; @@ -12562,7 +12562,7 @@ function asmFunc(imports) { $1 = $1 + 1 | 0; break; default: - break block1; + break block2; }; } return $1 | 0; @@ -12590,7 +12590,7 @@ function asmFunc(imports) { $0 = $0 | 0; var $1 = 0; $1 = 8; - block1 : { + block2 : { switch ($0 | 0) { case 0: $1 = 16; @@ -12598,7 +12598,7 @@ function asmFunc(imports) { $1 = $1 + 1 | 0; break; default: - break block1; + break block2; }; } return $1 | 0; diff --git a/test/wasm2js/labels.2asm.js b/test/wasm2js/labels.2asm.js index ac29783006e..431e172d9f0 100644 --- a/test/wasm2js/labels.2asm.js +++ b/test/wasm2js/labels.2asm.js @@ -143,10 +143,6 @@ function asmFunc(imports) { break label; } i = i + 1 | 0; - label0 : { - break label0; - } - i = i + 1 | 0; label1 : { break label1; } @@ -159,6 +155,10 @@ function asmFunc(imports) { break label3; } i = i + 1 | 0; + label4 : { + break label4; + } + i = i + 1 | 0; return i | 0; } From a89dbc3fd2ea2dd68c33a5f60c234259ae49e1c8 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Mon, 18 Nov 2024 13:52:59 -0800 Subject: [PATCH 28/56] update tests for label name changes --- test/lit/basic/exception-handling-legacy.wast | 8 +- test/lit/basic/exception-handling.wast | 128 +- test/lit/basic/min.wast | 20 +- test/lit/basic/reference-types.wast | 152 +- test/lit/basic/unit.wat | 96 +- test/lit/downgrade-reftypes.wast | 12 +- test/lit/multivalue.wast | 4 +- test/lld/em_asm_pthread.wasm.out | 1664 ++++++++--------- .../dce_vacuum_remove-unused-names.bin.txt | 4 +- test/passes/dwarf-local-order.bin.txt | 16 +- test/passes/fannkuch0_dwarf.bin.txt | 156 +- test/passes/fannkuch3_dwarf.bin.txt | 206 +- test/passes/fannkuch3_manyopts_dwarf.bin.txt | 138 +- test/passes/reverse_dwarf_abbrevs.bin.txt | 74 +- 14 files changed, 1339 insertions(+), 1339 deletions(-) diff --git a/test/lit/basic/exception-handling-legacy.wast b/test/lit/basic/exception-handling-legacy.wast index ca4f9e31f75..791745b69ef 100644 --- a/test/lit/basic/exception-handling-legacy.wast +++ b/test/lit/basic/exception-handling-legacy.wast @@ -1084,14 +1084,14 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (try $label0 + ;; CHECK-BIN-NEXT: (try $label1 ;; CHECK-BIN-NEXT: (do ;; CHECK-BIN-NEXT: (call $foo) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (catch_all ;; CHECK-BIN-NEXT: (try ;; CHECK-BIN-NEXT: (do - ;; CHECK-BIN-NEXT: (rethrow $label0) + ;; CHECK-BIN-NEXT: (rethrow $label1) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (catch_all ;; CHECK-BIN-NEXT: ) @@ -1713,14 +1713,14 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (try $label0 +;; CHECK-BIN-NODEBUG-NEXT: (try $label1 ;; CHECK-BIN-NODEBUG-NEXT: (do ;; CHECK-BIN-NODEBUG-NEXT: (call $0) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (catch_all ;; CHECK-BIN-NODEBUG-NEXT: (try ;; CHECK-BIN-NODEBUG-NEXT: (do -;; CHECK-BIN-NODEBUG-NEXT: (rethrow $label0) +;; CHECK-BIN-NODEBUG-NEXT: (rethrow $label1) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (catch_all ;; CHECK-BIN-NODEBUG-NEXT: ) diff --git a/test/lit/basic/exception-handling.wast b/test/lit/basic/exception-handling.wast index ddea0a9135f..41c10f6311a 100644 --- a/test/lit/basic/exception-handling.wast +++ b/test/lit/basic/exception-handling.wast @@ -241,20 +241,20 @@ ;; CHECK-BIN-NEXT: (local $scratch_2 (tuple i32 i64 exnref)) ;; CHECK-BIN-NEXT: (local $scratch_3 i64) ;; CHECK-BIN-NEXT: (local $scratch_4 i32) - ;; CHECK-BIN-NEXT: (block $block1 + ;; CHECK-BIN-NEXT: (block $block2 ;; CHECK-BIN-NEXT: (drop ;; CHECK-BIN-NEXT: (block (result i32) ;; CHECK-BIN-NEXT: (local.set $scratch_4 ;; CHECK-BIN-NEXT: (tuple.extract 3 0 ;; CHECK-BIN-NEXT: (local.tee $scratch_2 - ;; CHECK-BIN-NEXT: (block $block0 (type $2) (result i32 i64 exnref) + ;; CHECK-BIN-NEXT: (block $block1 (type $2) (result i32 i64 exnref) ;; CHECK-BIN-NEXT: (drop ;; CHECK-BIN-NEXT: (block (result i32) ;; CHECK-BIN-NEXT: (local.set $scratch_1 ;; CHECK-BIN-NEXT: (tuple.extract 2 0 ;; CHECK-BIN-NEXT: (local.tee $scratch ;; CHECK-BIN-NEXT: (block $block (type $1) (result i32 i64) - ;; CHECK-BIN-NEXT: (try_table (catch $e-i32-i64 $block) (catch_ref $e-i32-i64 $block0) + ;; CHECK-BIN-NEXT: (try_table (catch $e-i32-i64 $block) (catch_ref $e-i32-i64 $block1) ;; CHECK-BIN-NEXT: (throw $e-i32-i64 ;; CHECK-BIN-NEXT: (i32.const 0) ;; CHECK-BIN-NEXT: (i64.const 0) @@ -273,7 +273,7 @@ ;; CHECK-BIN-NEXT: (local.get $scratch_1) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (br $block1) + ;; CHECK-BIN-NEXT: (br $block2) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -340,25 +340,25 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $try-table-all-catch-clauses-empty-tag (type $0) - ;; CHECK-BIN-NEXT: (block $block3 + ;; CHECK-BIN-NEXT: (block $block4 ;; CHECK-BIN-NEXT: (block $block ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $block0 (result exnref) - ;; CHECK-BIN-NEXT: (block $block1 + ;; CHECK-BIN-NEXT: (block $block1 (result exnref) + ;; CHECK-BIN-NEXT: (block $block2 ;; CHECK-BIN-NEXT: (throw_ref - ;; CHECK-BIN-NEXT: (block $block2 (result exnref) - ;; CHECK-BIN-NEXT: (try_table (catch $e-empty $block) (catch_ref $e-empty $block0) (catch_all $block1) (catch_all_ref $block2) + ;; CHECK-BIN-NEXT: (block $block3 (result exnref) + ;; CHECK-BIN-NEXT: (try_table (catch $e-empty $block) (catch_ref $e-empty $block1) (catch_all $block2) (catch_all_ref $block3) ;; CHECK-BIN-NEXT: (call $foo) ;; CHECK-BIN-NEXT: (call $foo) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (br $block3) + ;; CHECK-BIN-NEXT: (br $block4) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (br $block3) + ;; CHECK-BIN-NEXT: (br $block4) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (br $block3) + ;; CHECK-BIN-NEXT: (br $block4) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -419,7 +419,7 @@ ;; CHECK-BIN: (func $try-table-all-catch-clauses-i32-tag (type $0) ;; CHECK-BIN-NEXT: (local $scratch (tuple i32 exnref)) ;; CHECK-BIN-NEXT: (local $scratch_1 i32) - ;; CHECK-BIN-NEXT: (block $block3 + ;; CHECK-BIN-NEXT: (block $block4 ;; CHECK-BIN-NEXT: (drop ;; CHECK-BIN-NEXT: (block $block (result i32) ;; CHECK-BIN-NEXT: (drop @@ -427,19 +427,19 @@ ;; CHECK-BIN-NEXT: (local.set $scratch_1 ;; CHECK-BIN-NEXT: (tuple.extract 2 0 ;; CHECK-BIN-NEXT: (local.tee $scratch - ;; CHECK-BIN-NEXT: (block $block0 (type $5) (result i32 exnref) - ;; CHECK-BIN-NEXT: (block $block1 + ;; CHECK-BIN-NEXT: (block $block1 (type $5) (result i32 exnref) + ;; CHECK-BIN-NEXT: (block $block2 ;; CHECK-BIN-NEXT: (throw_ref - ;; CHECK-BIN-NEXT: (block $block2 (result exnref) - ;; CHECK-BIN-NEXT: (try_table (catch $e-i32 $block) (catch_ref $e-i32 $block0) (catch_all $block1) (catch_all_ref $block2) + ;; CHECK-BIN-NEXT: (block $block3 (result exnref) + ;; CHECK-BIN-NEXT: (try_table (catch $e-i32 $block) (catch_ref $e-i32 $block1) (catch_all $block2) (catch_all_ref $block3) ;; CHECK-BIN-NEXT: (call $foo) ;; CHECK-BIN-NEXT: (call $foo) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (br $block3) + ;; CHECK-BIN-NEXT: (br $block4) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (br $block3) + ;; CHECK-BIN-NEXT: (br $block4) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -452,7 +452,7 @@ ;; CHECK-BIN-NEXT: (local.get $scratch_1) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (br $block3) + ;; CHECK-BIN-NEXT: (br $block4) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -519,7 +519,7 @@ ;; CHECK-BIN-NEXT: (local $scratch_2 i32) ;; CHECK-BIN-NEXT: (local $scratch_3 (tuple i32 i64)) ;; CHECK-BIN-NEXT: (local $scratch_4 i32) - ;; CHECK-BIN-NEXT: (block $block3 + ;; CHECK-BIN-NEXT: (block $block4 ;; CHECK-BIN-NEXT: (drop ;; CHECK-BIN-NEXT: (block (result i32) ;; CHECK-BIN-NEXT: (local.set $scratch_4 @@ -531,19 +531,19 @@ ;; CHECK-BIN-NEXT: (local.set $scratch_2 ;; CHECK-BIN-NEXT: (tuple.extract 3 0 ;; CHECK-BIN-NEXT: (local.tee $scratch - ;; CHECK-BIN-NEXT: (block $block0 (type $2) (result i32 i64 exnref) - ;; CHECK-BIN-NEXT: (block $block1 + ;; CHECK-BIN-NEXT: (block $block1 (type $2) (result i32 i64 exnref) + ;; CHECK-BIN-NEXT: (block $block2 ;; CHECK-BIN-NEXT: (throw_ref - ;; CHECK-BIN-NEXT: (block $block2 (result exnref) - ;; CHECK-BIN-NEXT: (try_table (catch $e-i32-i64 $block) (catch_ref $e-i32-i64 $block0) (catch_all $block1) (catch_all_ref $block2) + ;; CHECK-BIN-NEXT: (block $block3 (result exnref) + ;; CHECK-BIN-NEXT: (try_table (catch $e-i32-i64 $block) (catch_ref $e-i32-i64 $block1) (catch_all $block2) (catch_all_ref $block3) ;; CHECK-BIN-NEXT: (call $foo) ;; CHECK-BIN-NEXT: (call $foo) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (br $block3) + ;; CHECK-BIN-NEXT: (br $block4) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (br $block3) + ;; CHECK-BIN-NEXT: (br $block4) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -566,7 +566,7 @@ ;; CHECK-BIN-NEXT: (local.get $scratch_2) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (br $block3) + ;; CHECK-BIN-NEXT: (br $block4) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -625,9 +625,9 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $try-table-with-label-and-br (type $4) (result i32) ;; CHECK-BIN-NEXT: (block $block (result i32) - ;; CHECK-BIN-NEXT: (block $block0 (result i32) + ;; CHECK-BIN-NEXT: (block $block1 (result i32) ;; CHECK-BIN-NEXT: (try_table (result i32) (catch $e-i32 $block) - ;; CHECK-BIN-NEXT: (br $block0 + ;; CHECK-BIN-NEXT: (br $block1 ;; CHECK-BIN-NEXT: (i32.const 0) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -671,9 +671,9 @@ ;; CHECK-BIN: (func $nested-try-table (type $3) (result exnref) ;; CHECK-BIN-NEXT: (block $block (result exnref) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $block0 (result i32) + ;; CHECK-BIN-NEXT: (block $block1 (result i32) ;; CHECK-BIN-NEXT: (try_table (catch_all_ref $block) - ;; CHECK-BIN-NEXT: (try_table (catch $e-i32 $block0) + ;; CHECK-BIN-NEXT: (try_table (catch $e-i32 $block1) ;; CHECK-BIN-NEXT: (if ;; CHECK-BIN-NEXT: (i32.const 0) ;; CHECK-BIN-NEXT: (then @@ -814,20 +814,20 @@ ;; CHECK-BIN-NODEBUG-NEXT: (local $scratch_2 (tuple i32 i64 exnref)) ;; CHECK-BIN-NODEBUG-NEXT: (local $scratch_3 i64) ;; CHECK-BIN-NODEBUG-NEXT: (local $scratch_4 i32) -;; CHECK-BIN-NODEBUG-NEXT: (block $block1 +;; CHECK-BIN-NODEBUG-NEXT: (block $block2 ;; CHECK-BIN-NODEBUG-NEXT: (drop ;; CHECK-BIN-NODEBUG-NEXT: (block (result i32) ;; CHECK-BIN-NODEBUG-NEXT: (local.set $scratch_4 ;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 3 0 ;; CHECK-BIN-NODEBUG-NEXT: (local.tee $scratch_2 -;; CHECK-BIN-NODEBUG-NEXT: (block $block0 (type $2) (result i32 i64 exnref) +;; CHECK-BIN-NODEBUG-NEXT: (block $block1 (type $2) (result i32 i64 exnref) ;; CHECK-BIN-NODEBUG-NEXT: (drop ;; CHECK-BIN-NODEBUG-NEXT: (block (result i32) ;; CHECK-BIN-NODEBUG-NEXT: (local.set $scratch_1 ;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 2 0 ;; CHECK-BIN-NODEBUG-NEXT: (local.tee $scratch ;; CHECK-BIN-NODEBUG-NEXT: (block $block (type $1) (result i32 i64) -;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch $tag$2 $block) (catch_ref $tag$2 $block0) +;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch $tag$2 $block) (catch_ref $tag$2 $block1) ;; CHECK-BIN-NODEBUG-NEXT: (throw $tag$2 ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0) ;; CHECK-BIN-NODEBUG-NEXT: (i64.const 0) @@ -846,7 +846,7 @@ ;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch_1) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (br $block1) +;; CHECK-BIN-NODEBUG-NEXT: (br $block2) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -873,25 +873,25 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $6 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (block $block3 +;; CHECK-BIN-NODEBUG-NEXT: (block $block4 ;; CHECK-BIN-NODEBUG-NEXT: (block $block ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $block0 (result exnref) -;; CHECK-BIN-NODEBUG-NEXT: (block $block1 +;; CHECK-BIN-NODEBUG-NEXT: (block $block1 (result exnref) +;; CHECK-BIN-NODEBUG-NEXT: (block $block2 ;; CHECK-BIN-NODEBUG-NEXT: (throw_ref -;; CHECK-BIN-NODEBUG-NEXT: (block $block2 (result exnref) -;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch $tag$4 $block) (catch_ref $tag$4 $block0) (catch_all $block1) (catch_all_ref $block2) +;; CHECK-BIN-NODEBUG-NEXT: (block $block3 (result exnref) +;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch $tag$4 $block) (catch_ref $tag$4 $block1) (catch_all $block2) (catch_all_ref $block3) ;; CHECK-BIN-NODEBUG-NEXT: (call $0) ;; CHECK-BIN-NODEBUG-NEXT: (call $0) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (br $block3) +;; CHECK-BIN-NODEBUG-NEXT: (br $block4) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (br $block3) +;; CHECK-BIN-NODEBUG-NEXT: (br $block4) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (br $block3) +;; CHECK-BIN-NODEBUG-NEXT: (br $block4) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -899,7 +899,7 @@ ;; CHECK-BIN-NODEBUG: (func $7 (type $0) ;; CHECK-BIN-NODEBUG-NEXT: (local $scratch (tuple i32 exnref)) ;; CHECK-BIN-NODEBUG-NEXT: (local $scratch_1 i32) -;; CHECK-BIN-NODEBUG-NEXT: (block $block3 +;; CHECK-BIN-NODEBUG-NEXT: (block $block4 ;; CHECK-BIN-NODEBUG-NEXT: (drop ;; CHECK-BIN-NODEBUG-NEXT: (block $block (result i32) ;; CHECK-BIN-NODEBUG-NEXT: (drop @@ -907,19 +907,19 @@ ;; CHECK-BIN-NODEBUG-NEXT: (local.set $scratch_1 ;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 2 0 ;; CHECK-BIN-NODEBUG-NEXT: (local.tee $scratch -;; CHECK-BIN-NODEBUG-NEXT: (block $block0 (type $5) (result i32 exnref) -;; CHECK-BIN-NODEBUG-NEXT: (block $block1 +;; CHECK-BIN-NODEBUG-NEXT: (block $block1 (type $5) (result i32 exnref) +;; CHECK-BIN-NODEBUG-NEXT: (block $block2 ;; CHECK-BIN-NODEBUG-NEXT: (throw_ref -;; CHECK-BIN-NODEBUG-NEXT: (block $block2 (result exnref) -;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch $tag$0 $block) (catch_ref $tag$0 $block0) (catch_all $block1) (catch_all_ref $block2) +;; CHECK-BIN-NODEBUG-NEXT: (block $block3 (result exnref) +;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch $tag$0 $block) (catch_ref $tag$0 $block1) (catch_all $block2) (catch_all_ref $block3) ;; CHECK-BIN-NODEBUG-NEXT: (call $0) ;; CHECK-BIN-NODEBUG-NEXT: (call $0) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (br $block3) +;; CHECK-BIN-NODEBUG-NEXT: (br $block4) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (br $block3) +;; CHECK-BIN-NODEBUG-NEXT: (br $block4) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -932,7 +932,7 @@ ;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch_1) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (br $block3) +;; CHECK-BIN-NODEBUG-NEXT: (br $block4) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -944,7 +944,7 @@ ;; CHECK-BIN-NODEBUG-NEXT: (local $scratch_2 i32) ;; CHECK-BIN-NODEBUG-NEXT: (local $scratch_3 (tuple i32 i64)) ;; CHECK-BIN-NODEBUG-NEXT: (local $scratch_4 i32) -;; CHECK-BIN-NODEBUG-NEXT: (block $block3 +;; CHECK-BIN-NODEBUG-NEXT: (block $block4 ;; CHECK-BIN-NODEBUG-NEXT: (drop ;; CHECK-BIN-NODEBUG-NEXT: (block (result i32) ;; CHECK-BIN-NODEBUG-NEXT: (local.set $scratch_4 @@ -956,19 +956,19 @@ ;; CHECK-BIN-NODEBUG-NEXT: (local.set $scratch_2 ;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 3 0 ;; CHECK-BIN-NODEBUG-NEXT: (local.tee $scratch -;; CHECK-BIN-NODEBUG-NEXT: (block $block0 (type $2) (result i32 i64 exnref) -;; CHECK-BIN-NODEBUG-NEXT: (block $block1 +;; CHECK-BIN-NODEBUG-NEXT: (block $block1 (type $2) (result i32 i64 exnref) +;; CHECK-BIN-NODEBUG-NEXT: (block $block2 ;; CHECK-BIN-NODEBUG-NEXT: (throw_ref -;; CHECK-BIN-NODEBUG-NEXT: (block $block2 (result exnref) -;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch $tag$2 $block) (catch_ref $tag$2 $block0) (catch_all $block1) (catch_all_ref $block2) +;; CHECK-BIN-NODEBUG-NEXT: (block $block3 (result exnref) +;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch $tag$2 $block) (catch_ref $tag$2 $block1) (catch_all $block2) (catch_all_ref $block3) ;; CHECK-BIN-NODEBUG-NEXT: (call $0) ;; CHECK-BIN-NODEBUG-NEXT: (call $0) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (br $block3) +;; CHECK-BIN-NODEBUG-NEXT: (br $block4) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (br $block3) +;; CHECK-BIN-NODEBUG-NEXT: (br $block4) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -991,7 +991,7 @@ ;; CHECK-BIN-NODEBUG-NEXT: (local.get $scratch_2) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (br $block3) +;; CHECK-BIN-NODEBUG-NEXT: (br $block4) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -1009,9 +1009,9 @@ ;; CHECK-BIN-NODEBUG: (func $9 (type $4) (result i32) ;; CHECK-BIN-NODEBUG-NEXT: (block $block (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (block $block0 (result i32) +;; CHECK-BIN-NODEBUG-NEXT: (block $block1 (result i32) ;; CHECK-BIN-NODEBUG-NEXT: (try_table (result i32) (catch $tag$0 $block) -;; CHECK-BIN-NODEBUG-NEXT: (br $block0 +;; CHECK-BIN-NODEBUG-NEXT: (br $block1 ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -1022,9 +1022,9 @@ ;; CHECK-BIN-NODEBUG: (func $10 (type $3) (result exnref) ;; CHECK-BIN-NODEBUG-NEXT: (block $block (result exnref) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $block0 (result i32) +;; CHECK-BIN-NODEBUG-NEXT: (block $block1 (result i32) ;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch_all_ref $block) -;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch $tag$0 $block0) +;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch $tag$0 $block1) ;; CHECK-BIN-NODEBUG-NEXT: (if ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0) ;; CHECK-BIN-NODEBUG-NEXT: (then diff --git a/test/lit/basic/min.wast b/test/lit/basic/min.wast index 3b26bc98a2a..e4de0018546 100644 --- a/test/lit/basic/min.wast +++ b/test/lit/basic/min.wast @@ -127,21 +127,21 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $littleswitch (type $2) (param $x i32) (result i32) - ;; CHECK-BIN-NEXT: (block $block1 (result i32) - ;; CHECK-BIN-NEXT: (block $block0 + ;; CHECK-BIN-NEXT: (block $block2 (result i32) + ;; CHECK-BIN-NEXT: (block $block1 ;; CHECK-BIN-NEXT: (block $block - ;; CHECK-BIN-NEXT: (br_table $block $block0 $block + ;; CHECK-BIN-NEXT: (br_table $block $block1 $block ;; CHECK-BIN-NEXT: (i32.sub ;; CHECK-BIN-NEXT: (local.get $x) ;; CHECK-BIN-NEXT: (i32.const 1) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (br $block1 + ;; CHECK-BIN-NEXT: (br $block2 ;; CHECK-BIN-NEXT: (i32.const 1) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (br $block1 + ;; CHECK-BIN-NEXT: (br $block2 ;; CHECK-BIN-NEXT: (i32.const 2) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -210,21 +210,21 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $2 (type $2) (param $0 i32) (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (block $block1 (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (block $block0 +;; CHECK-BIN-NODEBUG-NEXT: (block $block2 (result i32) +;; CHECK-BIN-NODEBUG-NEXT: (block $block1 ;; CHECK-BIN-NODEBUG-NEXT: (block $block -;; CHECK-BIN-NODEBUG-NEXT: (br_table $block $block0 $block +;; CHECK-BIN-NODEBUG-NEXT: (br_table $block $block1 $block ;; CHECK-BIN-NODEBUG-NEXT: (i32.sub ;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (br $block1 +;; CHECK-BIN-NODEBUG-NEXT: (br $block2 ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (br $block1 +;; CHECK-BIN-NODEBUG-NEXT: (br $block2 ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 2) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) diff --git a/test/lit/basic/reference-types.wast b/test/lit/basic/reference-types.wast index e4e76394aff..6278adb01a8 100644 --- a/test/lit/basic/reference-types.wast +++ b/test/lit/basic/reference-types.wast @@ -952,17 +952,17 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $block0 (result eqref) - ;; CHECK-BIN-NEXT: (br_if $block0 + ;; CHECK-BIN-NEXT: (block $block1 (result eqref) + ;; CHECK-BIN-NEXT: (br_if $block1 ;; CHECK-BIN-NEXT: (global.get $global_eqref) ;; CHECK-BIN-NEXT: (i32.const 1) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $block1 (result eqref) + ;; CHECK-BIN-NEXT: (block $block2 (result eqref) ;; CHECK-BIN-NEXT: (ref.cast nullref - ;; CHECK-BIN-NEXT: (br_if $block1 + ;; CHECK-BIN-NEXT: (br_if $block2 ;; CHECK-BIN-NEXT: (ref.null none) ;; CHECK-BIN-NEXT: (i32.const 1) ;; CHECK-BIN-NEXT: ) @@ -970,25 +970,25 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $block2 (result funcref) - ;; CHECK-BIN-NEXT: (br_if $block2 + ;; CHECK-BIN-NEXT: (block $block3 (result funcref) + ;; CHECK-BIN-NEXT: (br_if $block3 ;; CHECK-BIN-NEXT: (local.get $local_funcref) ;; CHECK-BIN-NEXT: (i32.const 1) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $block3 (result funcref) - ;; CHECK-BIN-NEXT: (br_if $block3 + ;; CHECK-BIN-NEXT: (block $block4 (result funcref) + ;; CHECK-BIN-NEXT: (br_if $block4 ;; CHECK-BIN-NEXT: (global.get $global_funcref) ;; CHECK-BIN-NEXT: (i32.const 1) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $block4 (result funcref) + ;; CHECK-BIN-NEXT: (block $block5 (result funcref) ;; CHECK-BIN-NEXT: (ref.cast nullfuncref - ;; CHECK-BIN-NEXT: (br_if $block4 + ;; CHECK-BIN-NEXT: (br_if $block5 ;; CHECK-BIN-NEXT: (ref.null nofunc) ;; CHECK-BIN-NEXT: (i32.const 1) ;; CHECK-BIN-NEXT: ) @@ -996,9 +996,9 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $block5 (result funcref) + ;; CHECK-BIN-NEXT: (block $block6 (result funcref) ;; CHECK-BIN-NEXT: (ref.cast (ref $3) - ;; CHECK-BIN-NEXT: (br_if $block5 + ;; CHECK-BIN-NEXT: (br_if $block6 ;; CHECK-BIN-NEXT: (ref.func $foo) ;; CHECK-BIN-NEXT: (i32.const 1) ;; CHECK-BIN-NEXT: ) @@ -1006,25 +1006,25 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $block6 (result anyref) - ;; CHECK-BIN-NEXT: (br_if $block6 + ;; CHECK-BIN-NEXT: (block $block7 (result anyref) + ;; CHECK-BIN-NEXT: (br_if $block7 ;; CHECK-BIN-NEXT: (local.get $local_anyref) ;; CHECK-BIN-NEXT: (i32.const 1) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $block7 (result anyref) - ;; CHECK-BIN-NEXT: (br_if $block7 + ;; CHECK-BIN-NEXT: (block $block8 (result anyref) + ;; CHECK-BIN-NEXT: (br_if $block8 ;; CHECK-BIN-NEXT: (global.get $global_anyref) ;; CHECK-BIN-NEXT: (i32.const 1) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $block8 (result anyref) + ;; CHECK-BIN-NEXT: (block $block9 (result anyref) ;; CHECK-BIN-NEXT: (ref.cast nullref - ;; CHECK-BIN-NEXT: (br_if $block8 + ;; CHECK-BIN-NEXT: (br_if $block9 ;; CHECK-BIN-NEXT: (ref.null none) ;; CHECK-BIN-NEXT: (i32.const 1) ;; CHECK-BIN-NEXT: ) @@ -1032,9 +1032,9 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $block9 (result anyref) + ;; CHECK-BIN-NEXT: (block $block10 (result anyref) ;; CHECK-BIN-NEXT: (ref.cast eqref - ;; CHECK-BIN-NEXT: (br_if $block9 + ;; CHECK-BIN-NEXT: (br_if $block10 ;; CHECK-BIN-NEXT: (local.get $local_eqref) ;; CHECK-BIN-NEXT: (i32.const 1) ;; CHECK-BIN-NEXT: ) @@ -1042,9 +1042,9 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $block10 (result anyref) + ;; CHECK-BIN-NEXT: (block $block11 (result anyref) ;; CHECK-BIN-NEXT: (ref.cast nullref - ;; CHECK-BIN-NEXT: (br_if $block10 + ;; CHECK-BIN-NEXT: (br_if $block11 ;; CHECK-BIN-NEXT: (ref.null none) ;; CHECK-BIN-NEXT: (i32.const 1) ;; CHECK-BIN-NEXT: ) @@ -1237,11 +1237,11 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $block12 (result eqref) + ;; CHECK-BIN-NEXT: (block $block13 (result eqref) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $block11 (result i32) - ;; CHECK-BIN-NEXT: (br $block12 - ;; CHECK-BIN-NEXT: (try_table (result eqref) (catch $e-i32 $block11) + ;; CHECK-BIN-NEXT: (block $block12 (result i32) + ;; CHECK-BIN-NEXT: (br $block13 + ;; CHECK-BIN-NEXT: (try_table (result eqref) (catch $e-i32 $block12) ;; CHECK-BIN-NEXT: (local.get $local_eqref) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -1251,11 +1251,11 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $block14 (result funcref) + ;; CHECK-BIN-NEXT: (block $block15 (result funcref) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $block13 (result i32) - ;; CHECK-BIN-NEXT: (br $block14 - ;; CHECK-BIN-NEXT: (try_table (result funcref) (catch $e-i32 $block13) + ;; CHECK-BIN-NEXT: (block $block14 (result i32) + ;; CHECK-BIN-NEXT: (br $block15 + ;; CHECK-BIN-NEXT: (try_table (result funcref) (catch $e-i32 $block14) ;; CHECK-BIN-NEXT: (ref.func $foo) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -1265,11 +1265,11 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $block16 (result anyref) + ;; CHECK-BIN-NEXT: (block $block17 (result anyref) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $block15 (result i32) - ;; CHECK-BIN-NEXT: (br $block16 - ;; CHECK-BIN-NEXT: (try_table (result anyref) (catch $e-i32 $block15) + ;; CHECK-BIN-NEXT: (block $block16 (result i32) + ;; CHECK-BIN-NEXT: (br $block17 + ;; CHECK-BIN-NEXT: (try_table (result anyref) (catch $e-i32 $block16) ;; CHECK-BIN-NEXT: (local.get $local_eqref) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -1279,11 +1279,11 @@ ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $block18 (result anyref) + ;; CHECK-BIN-NEXT: (block $block19 (result anyref) ;; CHECK-BIN-NEXT: (drop - ;; CHECK-BIN-NEXT: (block $block17 (result i32) - ;; CHECK-BIN-NEXT: (br $block18 - ;; CHECK-BIN-NEXT: (try_table (result anyref) (catch $e-i32 $block17) + ;; CHECK-BIN-NEXT: (block $block18 (result i32) + ;; CHECK-BIN-NEXT: (br $block19 + ;; CHECK-BIN-NEXT: (try_table (result anyref) (catch $e-i32 $block18) ;; CHECK-BIN-NEXT: (ref.null none) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) @@ -2289,17 +2289,17 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $block0 (result eqref) -;; CHECK-BIN-NODEBUG-NEXT: (br_if $block0 +;; CHECK-BIN-NODEBUG-NEXT: (block $block1 (result eqref) +;; CHECK-BIN-NODEBUG-NEXT: (br_if $block1 ;; CHECK-BIN-NODEBUG-NEXT: (global.get $global$0) ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $block1 (result eqref) +;; CHECK-BIN-NODEBUG-NEXT: (block $block2 (result eqref) ;; CHECK-BIN-NODEBUG-NEXT: (ref.cast nullref -;; CHECK-BIN-NODEBUG-NEXT: (br_if $block1 +;; CHECK-BIN-NODEBUG-NEXT: (br_if $block2 ;; CHECK-BIN-NODEBUG-NEXT: (ref.null none) ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -2307,25 +2307,25 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $block2 (result funcref) -;; CHECK-BIN-NODEBUG-NEXT: (br_if $block2 +;; CHECK-BIN-NODEBUG-NEXT: (block $block3 (result funcref) +;; CHECK-BIN-NODEBUG-NEXT: (br_if $block3 ;; CHECK-BIN-NODEBUG-NEXT: (local.get $1) ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $block3 (result funcref) -;; CHECK-BIN-NODEBUG-NEXT: (br_if $block3 +;; CHECK-BIN-NODEBUG-NEXT: (block $block4 (result funcref) +;; CHECK-BIN-NODEBUG-NEXT: (br_if $block4 ;; CHECK-BIN-NODEBUG-NEXT: (global.get $global$1) ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $block4 (result funcref) +;; CHECK-BIN-NODEBUG-NEXT: (block $block5 (result funcref) ;; CHECK-BIN-NODEBUG-NEXT: (ref.cast nullfuncref -;; CHECK-BIN-NODEBUG-NEXT: (br_if $block4 +;; CHECK-BIN-NODEBUG-NEXT: (br_if $block5 ;; CHECK-BIN-NODEBUG-NEXT: (ref.null nofunc) ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -2333,9 +2333,9 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $block5 (result funcref) +;; CHECK-BIN-NODEBUG-NEXT: (block $block6 (result funcref) ;; CHECK-BIN-NODEBUG-NEXT: (ref.cast (ref $3) -;; CHECK-BIN-NODEBUG-NEXT: (br_if $block5 +;; CHECK-BIN-NODEBUG-NEXT: (br_if $block6 ;; CHECK-BIN-NODEBUG-NEXT: (ref.func $3) ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -2343,25 +2343,25 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $block6 (result anyref) -;; CHECK-BIN-NODEBUG-NEXT: (br_if $block6 +;; CHECK-BIN-NODEBUG-NEXT: (block $block7 (result anyref) +;; CHECK-BIN-NODEBUG-NEXT: (br_if $block7 ;; CHECK-BIN-NODEBUG-NEXT: (local.get $2) ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $block7 (result anyref) -;; CHECK-BIN-NODEBUG-NEXT: (br_if $block7 +;; CHECK-BIN-NODEBUG-NEXT: (block $block8 (result anyref) +;; CHECK-BIN-NODEBUG-NEXT: (br_if $block8 ;; CHECK-BIN-NODEBUG-NEXT: (global.get $global$3) ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $block8 (result anyref) +;; CHECK-BIN-NODEBUG-NEXT: (block $block9 (result anyref) ;; CHECK-BIN-NODEBUG-NEXT: (ref.cast nullref -;; CHECK-BIN-NODEBUG-NEXT: (br_if $block8 +;; CHECK-BIN-NODEBUG-NEXT: (br_if $block9 ;; CHECK-BIN-NODEBUG-NEXT: (ref.null none) ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -2369,9 +2369,9 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $block9 (result anyref) +;; CHECK-BIN-NODEBUG-NEXT: (block $block10 (result anyref) ;; CHECK-BIN-NODEBUG-NEXT: (ref.cast eqref -;; CHECK-BIN-NODEBUG-NEXT: (br_if $block9 +;; CHECK-BIN-NODEBUG-NEXT: (br_if $block10 ;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -2379,9 +2379,9 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $block10 (result anyref) +;; CHECK-BIN-NODEBUG-NEXT: (block $block11 (result anyref) ;; CHECK-BIN-NODEBUG-NEXT: (ref.cast nullref -;; CHECK-BIN-NODEBUG-NEXT: (br_if $block10 +;; CHECK-BIN-NODEBUG-NEXT: (br_if $block11 ;; CHECK-BIN-NODEBUG-NEXT: (ref.null none) ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -2574,11 +2574,11 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $block12 (result eqref) +;; CHECK-BIN-NODEBUG-NEXT: (block $block13 (result eqref) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $block11 (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (br $block12 -;; CHECK-BIN-NODEBUG-NEXT: (try_table (result eqref) (catch $tag$0 $block11) +;; CHECK-BIN-NODEBUG-NEXT: (block $block12 (result i32) +;; CHECK-BIN-NODEBUG-NEXT: (br $block13 +;; CHECK-BIN-NODEBUG-NEXT: (try_table (result eqref) (catch $tag$0 $block12) ;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -2588,11 +2588,11 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $block14 (result funcref) +;; CHECK-BIN-NODEBUG-NEXT: (block $block15 (result funcref) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $block13 (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (br $block14 -;; CHECK-BIN-NODEBUG-NEXT: (try_table (result funcref) (catch $tag$0 $block13) +;; CHECK-BIN-NODEBUG-NEXT: (block $block14 (result i32) +;; CHECK-BIN-NODEBUG-NEXT: (br $block15 +;; CHECK-BIN-NODEBUG-NEXT: (try_table (result funcref) (catch $tag$0 $block14) ;; CHECK-BIN-NODEBUG-NEXT: (ref.func $3) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -2602,11 +2602,11 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $block16 (result anyref) +;; CHECK-BIN-NODEBUG-NEXT: (block $block17 (result anyref) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $block15 (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (br $block16 -;; CHECK-BIN-NODEBUG-NEXT: (try_table (result anyref) (catch $tag$0 $block15) +;; CHECK-BIN-NODEBUG-NEXT: (block $block16 (result i32) +;; CHECK-BIN-NODEBUG-NEXT: (br $block17 +;; CHECK-BIN-NODEBUG-NEXT: (try_table (result anyref) (catch $tag$0 $block16) ;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) @@ -2616,11 +2616,11 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $block18 (result anyref) +;; CHECK-BIN-NODEBUG-NEXT: (block $block19 (result anyref) ;; CHECK-BIN-NODEBUG-NEXT: (drop -;; CHECK-BIN-NODEBUG-NEXT: (block $block17 (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (br $block18 -;; CHECK-BIN-NODEBUG-NEXT: (try_table (result anyref) (catch $tag$0 $block17) +;; CHECK-BIN-NODEBUG-NEXT: (block $block18 (result i32) +;; CHECK-BIN-NODEBUG-NEXT: (br $block19 +;; CHECK-BIN-NODEBUG-NEXT: (try_table (result anyref) (catch $tag$0 $block18) ;; CHECK-BIN-NODEBUG-NEXT: (ref.null none) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) diff --git a/test/lit/basic/unit.wat b/test/lit/basic/unit.wat index 2bf67ff4b73..43901e3bc55 100644 --- a/test/lit/basic/unit.wat +++ b/test/lit/basic/unit.wat @@ -749,76 +749,76 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $switcher (type $6) (param $x i32) (result i32) - ;; CHECK-BIN-NEXT: (block $block2 (result i32) + ;; CHECK-BIN-NEXT: (block $block3 (result i32) ;; CHECK-BIN-NEXT: (block - ;; CHECK-BIN-NEXT: (block $block1 - ;; CHECK-BIN-NEXT: (block $block0 + ;; CHECK-BIN-NEXT: (block $block2 + ;; CHECK-BIN-NEXT: (block $block1 ;; CHECK-BIN-NEXT: (block $block - ;; CHECK-BIN-NEXT: (br_table $block $block0 $block1 + ;; CHECK-BIN-NEXT: (br_table $block $block1 $block2 ;; CHECK-BIN-NEXT: (i32.sub ;; CHECK-BIN-NEXT: (local.get $x) ;; CHECK-BIN-NEXT: (i32.const 1) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (br $block2 + ;; CHECK-BIN-NEXT: (br $block3 ;; CHECK-BIN-NEXT: (i32.const 1) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (br $block2 + ;; CHECK-BIN-NEXT: (br $block3 ;; CHECK-BIN-NEXT: (i32.const 2) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (block - ;; CHECK-BIN-NEXT: (block $block4 - ;; CHECK-BIN-NEXT: (block $block3 - ;; CHECK-BIN-NEXT: (block $block5 - ;; CHECK-BIN-NEXT: (br_table $block3 $block4 $block4 $block4 $block4 $block4 $block4 $block5 $block4 + ;; CHECK-BIN-NEXT: (block $block5 + ;; CHECK-BIN-NEXT: (block $block4 + ;; CHECK-BIN-NEXT: (block $block6 + ;; CHECK-BIN-NEXT: (br_table $block4 $block5 $block5 $block5 $block5 $block5 $block5 $block6 $block5 ;; CHECK-BIN-NEXT: (i32.sub ;; CHECK-BIN-NEXT: (local.get $x) ;; CHECK-BIN-NEXT: (i32.const 5) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (br $block2 + ;; CHECK-BIN-NEXT: (br $block3 ;; CHECK-BIN-NEXT: (i32.const 121) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (br $block2 + ;; CHECK-BIN-NEXT: (br $block3 ;; CHECK-BIN-NEXT: (i32.const 51) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (nop) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (block $block11 - ;; CHECK-BIN-NEXT: (block $block7 - ;; CHECK-BIN-NEXT: (block $block6 - ;; CHECK-BIN-NEXT: (block $block8 - ;; CHECK-BIN-NEXT: (block $block9 - ;; CHECK-BIN-NEXT: (block $block10 - ;; CHECK-BIN-NEXT: (br_table $block6 $block7 $block7 $block8 $block7 $block7 $block7 $block7 $block9 $block7 $block10 $block7 + ;; CHECK-BIN-NEXT: (block $block12 + ;; CHECK-BIN-NEXT: (block $block8 + ;; CHECK-BIN-NEXT: (block $block7 + ;; CHECK-BIN-NEXT: (block $block9 + ;; CHECK-BIN-NEXT: (block $block10 + ;; CHECK-BIN-NEXT: (block $block11 + ;; CHECK-BIN-NEXT: (br_table $block7 $block8 $block8 $block9 $block8 $block8 $block8 $block8 $block10 $block8 $block11 $block8 ;; CHECK-BIN-NEXT: (i32.sub ;; CHECK-BIN-NEXT: (local.get $x) ;; CHECK-BIN-NEXT: (i32.const 2) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (br $block11) + ;; CHECK-BIN-NEXT: (br $block12) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (br $block11) + ;; CHECK-BIN-NEXT: (br $block12) ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: (block $block12 + ;; CHECK-BIN-NEXT: (block $block13 ;; CHECK-BIN-NEXT: (loop - ;; CHECK-BIN-NEXT: (br $block12) + ;; CHECK-BIN-NEXT: (br $block13) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (unreachable) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (block ;; CHECK-BIN-NEXT: (loop - ;; CHECK-BIN-NEXT: (br $block11) + ;; CHECK-BIN-NEXT: (br $block12) ;; CHECK-BIN-NEXT: ) ;; CHECK-BIN-NEXT: (unreachable) ;; CHECK-BIN-NEXT: ) @@ -2051,76 +2051,76 @@ ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG: (func $7 (type $6) (param $0 i32) (result i32) -;; CHECK-BIN-NODEBUG-NEXT: (block $block2 (result i32) +;; CHECK-BIN-NODEBUG-NEXT: (block $block3 (result i32) ;; CHECK-BIN-NODEBUG-NEXT: (block -;; CHECK-BIN-NODEBUG-NEXT: (block $block1 -;; CHECK-BIN-NODEBUG-NEXT: (block $block0 +;; CHECK-BIN-NODEBUG-NEXT: (block $block2 +;; CHECK-BIN-NODEBUG-NEXT: (block $block1 ;; CHECK-BIN-NODEBUG-NEXT: (block $block -;; CHECK-BIN-NODEBUG-NEXT: (br_table $block $block0 $block1 +;; CHECK-BIN-NODEBUG-NEXT: (br_table $block $block1 $block2 ;; CHECK-BIN-NODEBUG-NEXT: (i32.sub ;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (br $block2 +;; CHECK-BIN-NODEBUG-NEXT: (br $block3 ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (br $block2 +;; CHECK-BIN-NODEBUG-NEXT: (br $block3 ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 2) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (block -;; CHECK-BIN-NODEBUG-NEXT: (block $block4 -;; CHECK-BIN-NODEBUG-NEXT: (block $block3 -;; CHECK-BIN-NODEBUG-NEXT: (block $block5 -;; CHECK-BIN-NODEBUG-NEXT: (br_table $block3 $block4 $block4 $block4 $block4 $block4 $block4 $block5 $block4 +;; CHECK-BIN-NODEBUG-NEXT: (block $block5 +;; CHECK-BIN-NODEBUG-NEXT: (block $block4 +;; CHECK-BIN-NODEBUG-NEXT: (block $block6 +;; CHECK-BIN-NODEBUG-NEXT: (br_table $block4 $block5 $block5 $block5 $block5 $block5 $block5 $block6 $block5 ;; CHECK-BIN-NODEBUG-NEXT: (i32.sub ;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 5) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (br $block2 +;; CHECK-BIN-NODEBUG-NEXT: (br $block3 ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 121) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (br $block2 +;; CHECK-BIN-NODEBUG-NEXT: (br $block3 ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 51) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (nop) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (block $block11 -;; CHECK-BIN-NODEBUG-NEXT: (block $block7 -;; CHECK-BIN-NODEBUG-NEXT: (block $block6 -;; CHECK-BIN-NODEBUG-NEXT: (block $block8 -;; CHECK-BIN-NODEBUG-NEXT: (block $block9 -;; CHECK-BIN-NODEBUG-NEXT: (block $block10 -;; CHECK-BIN-NODEBUG-NEXT: (br_table $block6 $block7 $block7 $block8 $block7 $block7 $block7 $block7 $block9 $block7 $block10 $block7 +;; CHECK-BIN-NODEBUG-NEXT: (block $block12 +;; CHECK-BIN-NODEBUG-NEXT: (block $block8 +;; CHECK-BIN-NODEBUG-NEXT: (block $block7 +;; CHECK-BIN-NODEBUG-NEXT: (block $block9 +;; CHECK-BIN-NODEBUG-NEXT: (block $block10 +;; CHECK-BIN-NODEBUG-NEXT: (block $block11 +;; CHECK-BIN-NODEBUG-NEXT: (br_table $block7 $block8 $block8 $block9 $block8 $block8 $block8 $block8 $block10 $block8 $block11 $block8 ;; CHECK-BIN-NODEBUG-NEXT: (i32.sub ;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) ;; CHECK-BIN-NODEBUG-NEXT: (i32.const 2) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (br $block11) +;; CHECK-BIN-NODEBUG-NEXT: (br $block12) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (br $block11) +;; CHECK-BIN-NODEBUG-NEXT: (br $block12) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: (block $block12 +;; CHECK-BIN-NODEBUG-NEXT: (block $block13 ;; CHECK-BIN-NODEBUG-NEXT: (loop -;; CHECK-BIN-NODEBUG-NEXT: (br $block12) +;; CHECK-BIN-NODEBUG-NEXT: (br $block13) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (unreachable) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (block ;; CHECK-BIN-NODEBUG-NEXT: (loop -;; CHECK-BIN-NODEBUG-NEXT: (br $block11) +;; CHECK-BIN-NODEBUG-NEXT: (br $block12) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: (unreachable) ;; CHECK-BIN-NODEBUG-NEXT: ) diff --git a/test/lit/downgrade-reftypes.wast b/test/lit/downgrade-reftypes.wast index 204bca2e7b1..71d009dee0c 100644 --- a/test/lit/downgrade-reftypes.wast +++ b/test/lit/downgrade-reftypes.wast @@ -20,22 +20,22 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (block $block0 (result funcref) - ;; CHECK-NEXT: (br $block0 + ;; CHECK-NEXT: (block $block1 (result funcref) + ;; CHECK-NEXT: (br $block1 ;; CHECK-NEXT: (ref.null nofunc) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (block $block1 (result externref) - ;; CHECK-NEXT: (br $block1 + ;; CHECK-NEXT: (block $block2 (result externref) + ;; CHECK-NEXT: (br $block2 ;; CHECK-NEXT: (ref.null noextern) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (block $block2 (result stringref) - ;; CHECK-NEXT: (br $block2 + ;; CHECK-NEXT: (block $block3 (result stringref) + ;; CHECK-NEXT: (br $block3 ;; CHECK-NEXT: (string.const "hello world") ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) diff --git a/test/lit/multivalue.wast b/test/lit/multivalue.wast index bb173c35343..d9cc14e05ab 100644 --- a/test/lit/multivalue.wast +++ b/test/lit/multivalue.wast @@ -482,8 +482,8 @@ ;; CHECK: (func $mv-switch (type $0) (result i32 i64) ;; CHECK-NEXT: (block $block (type $0) (result i32 i64) - ;; CHECK-NEXT: (block $block0 (type $0) (result i32 i64) - ;; CHECK-NEXT: (br_table $block $block0 + ;; CHECK-NEXT: (block $block1 (type $0) (result i32 i64) + ;; CHECK-NEXT: (br_table $block $block1 ;; CHECK-NEXT: (tuple.make 2 ;; CHECK-NEXT: (i32.const 42) ;; CHECK-NEXT: (i64.const 42) diff --git a/test/lld/em_asm_pthread.wasm.out b/test/lld/em_asm_pthread.wasm.out index e1cbcfde4c0..8284cc6dc59 100644 --- a/test/lld/em_asm_pthread.wasm.out +++ b/test/lld/em_asm_pthread.wasm.out @@ -348,7 +348,7 @@ (i32.const 2147483647) ) ) - (block $block0 + (block $block1 (block $block (br_if $block (i32.ne @@ -368,7 +368,7 @@ (local.set $6 (i32.const 6) ) - (br_if $block0 + (br_if $block1 (i32.gt_u (local.tee $5 (i32.load offset=20 @@ -392,14 +392,14 @@ (local.set $6 (i32.const 56) ) - (br_if $block0 + (br_if $block1 (i32.eq (local.get $5) (i32.const 2147483647) ) ) - (block $block1 - (br_if $block1 + (block $block2 + (br_if $block2 (i32.eqz (i32.and (i32.load8_u @@ -409,8 +409,8 @@ ) ) ) - (block $block2 - (br_if $block2 + (block $block3 + (br_if $block3 (i32.load (i32.add (local.get $2) @@ -449,15 +449,15 @@ ) ) ) - (block $block5 - (block $block4 - (block $block3 - (br_if $block3 + (block $block6 + (block $block5 + (block $block4 + (br_if $block4 (i32.eqz (local.get $5) ) ) - (br_if $block4 + (br_if $block5 (i32.eqz (i32.and (local.get $1) @@ -465,7 +465,7 @@ ) ) ) - (br_if $block4 + (br_if $block5 (i32.eqz (i32.and (local.get $4) @@ -474,7 +474,7 @@ ) ) ) - (br_if $block5 + (br_if $block6 (i32.eq (call $12 (i32.add @@ -523,8 +523,8 @@ (i32.const 16) ) ) - (block $block6 - (br_if $block6 + (block $block7 + (br_if $block7 (i32.eq (local.get $3) (local.get $6) @@ -552,7 +552,7 @@ ) (i32.const 0) ) - (br_if $block0 + (br_if $block1 (i32.eqz (local.get $5) ) @@ -683,8 +683,8 @@ (local.get $0) ) ) - (block $block1 - (block $block0 + (block $block2 + (block $block1 (block $block (br_if $block (local.tee $4 @@ -694,7 +694,7 @@ ) ) ) - (br $block0) + (br $block1) ) (local.set $5 (call $7) @@ -702,7 +702,7 @@ (local.set $6 (i32.const 63) ) - (br_if $block1 + (br_if $block2 (i32.ne (i32.and (i32.load offset=4 @@ -715,8 +715,8 @@ ) ) ) - (block $block2 - (br_if $block2 + (block $block3 + (br_if $block3 (i32.ne (i32.and (local.get $1) @@ -725,7 +725,7 @@ (i32.const 1) ) ) - (br_if $block2 + (br_if $block3 (i32.eqz (local.tee $6 (i32.load offset=20 @@ -745,8 +745,8 @@ (i32.const 0) ) ) - (block $block3 - (br_if $block3 + (block $block4 + (br_if $block4 (local.get $2) ) (i32.store @@ -773,7 +773,7 @@ ) ) ) - (br_if $block0 + (br_if $block1 (i32.eq (local.get $6) (i32.add @@ -810,13 +810,13 @@ ) ) ) - (block $block4 - (br_if $block4 + (block $block5 + (br_if $block5 (i32.eqz (local.get $4) ) ) - (br_if $block4 + (br_if $block5 (local.get $2) ) (i32.store @@ -831,11 +831,11 @@ (local.set $6 (i32.const 0) ) - (block $block5 - (br_if $block5 + (block $block6 + (br_if $block6 (local.get $3) ) - (br_if $block1 + (br_if $block2 (i32.gt_s (local.get $0) (i32.const -1) @@ -925,14 +925,14 @@ (local $1 i32) (local $2 i32) (local $3 i32) - (block $block0 + (block $block1 (block $block (br_if $block (i32.eqz (call $10) ) ) - (br_if $block0 + (br_if $block1 (i32.load8_u offset=1832 (i32.const 0) ) @@ -947,8 +947,8 @@ (i32.const 1804) ) ) - (block $block1 - (br_if $block1 + (block $block2 + (br_if $block2 (local.tee $0 (call $32 (call $14) @@ -960,7 +960,7 @@ (i32.const 1804) ) ) - (br_if $block0 + (br_if $block1 (i32.eqz (call $10) ) @@ -971,8 +971,8 @@ ) (return) ) - (block $block2 - (br_if $block2 + (block $block3 + (br_if $block3 (i32.eq (local.tee $2 (call $23 @@ -1053,7 +1053,7 @@ (i32.const 2147483647) ) ) - (br_if $block0 + (br_if $block1 (i32.eqz (call $10) ) @@ -1072,8 +1072,8 @@ (local.get $0) ) ) - (block $block0 - (br_if $block0 + (block $block1 + (br_if $block1 (i32.eqz (local.tee $1 (i32.load offset=1840 @@ -1083,8 +1083,8 @@ ) ) (loop $label - (block $block1 - (br_if $block1 + (block $block2 + (br_if $block2 (i32.ne (i32.load (local.get $1) @@ -1119,8 +1119,8 @@ ) (func $33 (param $0 i32) (local $1 i32) - (block $block8 - (block $block41 + (block $block9 + (block $block42 (block $block (br_if $block (i32.eq @@ -1135,67 +1135,67 @@ (i32.const 402653184) ) ) - (block $block7 - (block $block4 - (block $block12 - (block $block40 - (block $block39 - (block $block38 - (block $block36 - (block $block35 - (block $block32 - (block $block31 - (block $block30 - (block $block28 - (block $block27 - (block $block23 - (block $block22 - (block $block21 - (block $block20 - (block $block18 - (block $block16 - (block $block15 - (block $block13 - (block $block11 - (block $block10 - (block $block5 - (block $block3 - (block $block0 - (br_if $block0 + (block $block8 + (block $block5 + (block $block13 + (block $block41 + (block $block40 + (block $block39 + (block $block37 + (block $block36 + (block $block33 + (block $block32 + (block $block31 + (block $block29 + (block $block28 + (block $block24 + (block $block23 + (block $block22 + (block $block21 + (block $block19 + (block $block17 + (block $block16 + (block $block14 + (block $block12 + (block $block11 + (block $block6 + (block $block4 + (block $block1 + (br_if $block1 (i32.gt_s (local.get $1) (i32.const 234881023) ) ) - (block $block1 - (br_if $block1 + (block $block2 + (br_if $block2 (i32.gt_s (local.get $1) (i32.const 100663335) ) ) - (block $block2 - (br_if $block2 + (block $block3 + (br_if $block3 (i32.gt_s (local.get $1) (i32.const 67108863) ) ) - (block $block6 - (br_table $block3 $block4 $block5 $block6 + (block $block7 + (br_table $block4 $block5 $block6 $block7 (i32.add (local.get $1) (i32.const -33554432) ) ) ) - (br_if $block7 + (br_if $block8 (i32.eq (local.get $1) (i32.const -2126512128) ) ) - (br_if $block4 + (br_if $block5 (local.get $1) ) (call_indirect (type $2) @@ -1203,29 +1203,29 @@ (local.get $0) ) ) - (br $block8) + (br $block9) ) - (block $block9 - (br_if $block9 + (block $block10 + (br_if $block10 (i32.gt_s (local.get $1) (i32.const 100663295) ) ) - (br_table $block10 $block4 $block11 $block12 + (br_table $block11 $block5 $block12 $block13 (i32.add (local.get $1) (i32.const -67108872) ) ) ) - (br_if $block13 + (br_if $block14 (i32.eq (local.get $1) (i32.const 100663296) ) ) - (br_if $block4 + (br_if $block5 (i32.ne (local.get $1) (i32.const 100663328) @@ -1251,30 +1251,30 @@ (local.get $0) ) ) - (br $block8) + (br $block9) ) - (block $block14 - (br_if $block14 + (block $block15 + (br_if $block15 (i32.gt_s (local.get $1) (i32.const 134217895) ) ) - (block $block17 - (br_table $block15 $block4 $block16 $block17 + (block $block18 + (br_table $block16 $block5 $block17 $block18 (i32.add (local.get $1) (i32.const -100663336) ) ) ) - (br_if $block18 + (br_if $block19 (i32.eq (local.get $1) (i32.const 134217728) ) ) - (br_if $block4 + (br_if $block5 (i32.ne (local.get $1) (i32.const 134217760) @@ -1306,29 +1306,29 @@ (local.get $0) ) ) - (br $block8) + (br $block9) ) - (block $block19 - (br_if $block19 + (block $block20 + (br_if $block20 (i32.gt_s (local.get $1) (i32.const 167772839) ) ) - (br_table $block20 $block4 $block21 $block22 + (br_table $block21 $block5 $block22 $block23 (i32.add (local.get $1) (i32.const -134217896) ) ) ) - (br_if $block23 + (br_if $block24 (i32.eq (local.get $1) (i32.const 167772840) ) ) - (br_if $block4 + (br_if $block5 (i32.ne (local.get $1) (i32.const 201326592) @@ -1372,36 +1372,36 @@ (local.get $0) ) ) - (br $block8) + (br $block9) ) - (block $block24 - (br_if $block24 + (block $block25 + (br_if $block25 (i32.gt_s (local.get $1) (i32.const 637534207) ) ) - (block $block25 - (br_if $block25 + (block $block26 + (br_if $block26 (i32.gt_s (local.get $1) (i32.const 369098751) ) ) - (block $block26 - (br_if $block26 + (block $block27 + (br_if $block27 (i32.gt_s (local.get $1) (i32.const 301989887) ) ) - (br_if $block27 + (br_if $block28 (i32.eq (local.get $1) (i32.const 234881024) ) ) - (br_if $block4 + (br_if $block5 (i32.ne (local.get $1) (i32.const 268435456) @@ -1457,15 +1457,15 @@ (local.get $0) ) ) - (br $block8) + (br $block9) ) - (br_if $block28 + (br_if $block29 (i32.eq (local.get $1) (i32.const 301989888) ) ) - (br_if $block4 + (br_if $block5 (i32.ne (local.get $1) (i32.const 335544320) @@ -1533,22 +1533,22 @@ (local.get $0) ) ) - (br $block8) + (br $block9) ) - (block $block29 - (br_if $block29 + (block $block30 + (br_if $block30 (i32.gt_s (local.get $1) (i32.const 570425343) ) ) - (br_if $block30 + (br_if $block31 (i32.eq (local.get $1) (i32.const 369098752) ) ) - (br_if $block4 + (br_if $block5 (i32.ne (local.get $1) (i32.const 536870912) @@ -1562,21 +1562,21 @@ ) ) ) - (br $block8) + (br $block9) ) - (br_if $block31 + (br_if $block32 (i32.eq (local.get $1) (i32.const 570425344) ) ) - (br_if $block32 + (br_if $block33 (i32.eq (local.get $1) (i32.const 603979776) ) ) - (br_if $block4 + (br_if $block5 (i32.ne (local.get $1) (i32.const 622854144) @@ -1596,29 +1596,29 @@ ) ) ) - (br $block8) + (br $block9) ) - (block $block33 - (br_if $block33 + (block $block34 + (br_if $block34 (i32.gt_s (local.get $1) (i32.const 704643071) ) ) - (block $block34 - (br_if $block34 + (block $block35 + (br_if $block35 (i32.gt_s (local.get $1) (i32.const 671088639) ) ) - (br_if $block35 + (br_if $block36 (i32.eq (local.get $1) (i32.const 637534208) ) ) - (br_if $block4 + (br_if $block5 (i32.ne (local.get $1) (i32.const 657457152) @@ -1644,15 +1644,15 @@ ) ) ) - (br $block8) + (br $block9) ) - (br_if $block36 + (br_if $block37 (i32.eq (local.get $1) (i32.const 671088640) ) ) - (br_if $block4 + (br_if $block5 (i32.ne (local.get $1) (i32.const 687865856) @@ -1684,22 +1684,22 @@ ) ) ) - (br $block8) + (br $block9) ) - (block $block37 - (br_if $block37 + (block $block38 + (br_if $block38 (i32.gt_s (local.get $1) (i32.const 771751935) ) ) - (br_if $block38 + (br_if $block39 (i32.eq (local.get $1) (i32.const 704643072) ) ) - (br_if $block4 + (br_if $block5 (i32.ne (local.get $1) (i32.const 738197504) @@ -1746,21 +1746,21 @@ ) ) ) - (br $block8) + (br $block9) ) - (br_if $block39 + (br_if $block40 (i32.eq (local.get $1) (i32.const 771751936) ) ) - (br_if $block40 + (br_if $block41 (i32.eq (local.get $1) (i32.const 805306368) ) ) - (br_if $block4 + (br_if $block5 (i32.ne (local.get $1) (i32.const 838860800) @@ -1825,7 +1825,7 @@ ) ) ) - (br $block8) + (br $block9) ) (call_indirect (type $1) (i32.load offset=16 @@ -1835,7 +1835,7 @@ (local.get $0) ) ) - (br $block8) + (br $block9) ) (call_indirect (type $22) (f32.load offset=16 @@ -1845,7 +1845,7 @@ (local.get $0) ) ) - (br $block8) + (br $block9) ) (call_indirect (type $23) (i32.load offset=16 @@ -1861,7 +1861,7 @@ (local.get $0) ) ) - (br $block8) + (br $block9) ) (call_indirect (type $24) (f32.load offset=16 @@ -1877,7 +1877,7 @@ (local.get $0) ) ) - (br $block8) + (br $block9) ) (call_indirect (type $11) (i32.load offset=16 @@ -1899,7 +1899,7 @@ (local.get $0) ) ) - (br $block8) + (br $block9) ) (call_indirect (type $25) (i32.load offset=16 @@ -1921,7 +1921,7 @@ (local.get $0) ) ) - (br $block8) + (br $block9) ) (call_indirect (type $26) (f32.load offset=16 @@ -1943,7 +1943,7 @@ (local.get $0) ) ) - (br $block8) + (br $block9) ) (call_indirect (type $10) (i32.load offset=16 @@ -1971,7 +1971,7 @@ (local.get $0) ) ) - (br $block8) + (br $block9) ) (call_indirect (type $27) (i32.load offset=16 @@ -1999,7 +1999,7 @@ (local.get $0) ) ) - (br $block8) + (br $block9) ) (call_indirect (type $28) (f32.load offset=16 @@ -2027,9 +2027,9 @@ (local.get $0) ) ) - (br $block8) + (br $block9) ) - (br_if $block4 + (br_if $block5 (i32.ne (local.get $1) (i32.const 167772160) @@ -2067,7 +2067,7 @@ (local.get $0) ) ) - (br $block8) + (br $block9) ) (call_indirect (type $30) (i32.load offset=16 @@ -2101,7 +2101,7 @@ (local.get $0) ) ) - (br $block8) + (br $block9) ) (call_indirect (type $31) (i32.load offset=16 @@ -2147,7 +2147,7 @@ (local.get $0) ) ) - (br $block8) + (br $block9) ) (call_indirect (type $32) (i32.load offset=16 @@ -2205,7 +2205,7 @@ (local.get $0) ) ) - (br $block8) + (br $block9) ) (call_indirect (type $33) (i32.load offset=16 @@ -2275,7 +2275,7 @@ (local.get $0) ) ) - (br $block8) + (br $block9) ) (i32.store offset=176 (local.get $0) @@ -2288,7 +2288,7 @@ ) ) ) - (br $block8) + (br $block9) ) (i32.store offset=176 (local.get $0) @@ -2307,7 +2307,7 @@ ) ) ) - (br $block8) + (br $block9) ) (i32.store offset=176 (local.get $0) @@ -2332,7 +2332,7 @@ ) ) ) - (br $block8) + (br $block9) ) (i32.store offset=176 (local.get $0) @@ -2363,7 +2363,7 @@ ) ) ) - (br $block8) + (br $block9) ) (i32.store offset=176 (local.get $0) @@ -2400,7 +2400,7 @@ ) ) ) - (br $block8) + (br $block9) ) (i32.store offset=176 (local.get $0) @@ -2449,7 +2449,7 @@ ) ) ) - (br $block8) + (br $block9) ) (i32.store offset=176 (local.get $0) @@ -2504,9 +2504,9 @@ ) ) ) - (br $block8) + (br $block9) ) - (br_if $block41 + (br_if $block42 (i32.eq (local.get $1) (i32.const 67108864) @@ -2536,7 +2536,7 @@ ) ) ) - (br $block8) + (br $block9) ) (call $fimport$8 (i32.const 1254) @@ -2561,8 +2561,8 @@ ) ) ) - (block $block42 - (br_if $block42 + (block $block43 + (br_if $block43 (i32.eqz (i32.load offset=188 (local.get $0) @@ -2630,8 +2630,8 @@ (local.set $0 (i32.const 0) ) - (block $block0 - (br_if $block0 + (block $block1 + (br_if $block1 (i32.xor (f64.lt (local.get $3) @@ -2664,7 +2664,7 @@ (local.set $3 (call $fimport$4) ) - (br_if $block0 + (br_if $block1 (local.get $0) ) (br_if $label @@ -2703,18 +2703,18 @@ (local $5 i32) (local $6 i32) (local $7 i32) - (block $block9 - (block $block7 + (block $block10 + (block $block8 (block $block (br_if $block (i32.eqz (local.get $1) ) ) - (block $block2 - (block $block1 - (block $block0 - (br_table $block0 $block1 $block2 + (block $block3 + (block $block2 + (block $block1 + (br_table $block1 $block2 $block3 (local.get $0) ) ) @@ -2730,15 +2730,15 @@ (call $37) ) ) - (block $block4 - (block $block3 - (br_if $block3 + (block $block5 + (block $block4 + (br_if $block4 (i32.eq (local.get $0) (i32.const 2) ) ) - (br_if $block4 + (br_if $block5 (i32.ne (local.get $0) (call $14) @@ -2757,8 +2757,8 @@ (i32.const 1804) ) ) - (block $block5 - (br_if $block5 + (block $block6 + (br_if $block6 (i32.load offset=4 (local.tee $2 (call $39 @@ -2774,8 +2774,8 @@ ) ) ) - (block $block6 - (br_if $block6 + (block $block7 + (br_if $block7 (i32.ne (local.tee $4 (call $23 @@ -2813,7 +2813,7 @@ (i32.const 1804) ) ) - (br_if $block7 + (br_if $block8 (i32.ne (local.get $0) (call $37) @@ -2867,14 +2867,14 @@ ) (local.get $1) ) - (block $block8 - (br_if $block8 + (block $block9 + (br_if $block9 (i32.ne (local.get $4) (local.get $6) ) ) - (br_if $block8 + (br_if $block9 (call $fimport$10 (local.get $0) (call $37) @@ -2888,7 +2888,7 @@ (i32.const 1804) ) ) - (br $block9) + (br $block10) ) (drop (call $24 @@ -2901,7 +2901,7 @@ (i32.const 1804) ) ) - (br $block9) + (br $block10) ) (call $fimport$8 (i32.const 1090) @@ -2944,9 +2944,9 @@ (local.get $1) (local.get $0) ) - (block $block1 - (block $block0 - (br_if $block0 + (block $block2 + (block $block1 + (br_if $block1 (local.tee $0 (i32.load offset=1840 (i32.const 0) @@ -2956,7 +2956,7 @@ (local.set $0 (i32.const 1840) ) - (br $block1) + (br $block2) ) (loop $label (br_if $label @@ -3146,7 +3146,7 @@ ) ) ) - (block $block0 + (block $block1 (block $block (br_if $block (i32.eqz @@ -3164,7 +3164,7 @@ (local.set $5 (local.get $4) ) - (br $block0) + (br $block1) ) (local.set $5 (call $46) @@ -3185,8 +3185,8 @@ (local.get $3) ) ) - (block $block1 - (br_if $block1 + (block $block2 + (br_if $block2 (i32.ge_s (local.get $1) (i32.const 20) @@ -3199,8 +3199,8 @@ (local.set $0 (i32.const 0) ) - (block $block2 - (br_if $block2 + (block $block3 + (br_if $block3 (i32.le_s (local.get $1) (i32.const 0) @@ -3244,9 +3244,9 @@ ) ) ) - (block $block4 - (block $block3 - (br_if $block3 + (block $block5 + (block $block4 + (br_if $block4 (i32.eqz (local.get $3) ) @@ -3259,7 +3259,7 @@ (local.get $4) ) ) - (br $block4) + (br $block5) ) (call $40 (local.get $5) @@ -3349,8 +3349,8 @@ (local.get $6) (local.get $5) ) - (block $block0 - (br_if $block0 + (block $block1 + (br_if $block1 (i32.eqz (local.tee $4 (i32.and @@ -3373,12 +3373,12 @@ (i32.const 0) ) (loop $label - (block $block5 - (block $block4 - (block $block3 - (block $block2 - (block $block1 - (br_table $block1 $block2 $block3 $block4 $block1 + (block $block6 + (block $block5 + (block $block4 + (block $block3 + (block $block2 + (br_table $block2 $block3 $block4 $block5 $block2 (i32.and (local.get $2) (i32.const 3) @@ -3411,7 +3411,7 @@ (local.get $5) ) ) - (br $block5) + (br $block6) ) (i32.store offset=12 (local.get $6) @@ -3445,7 +3445,7 @@ (local.get $5) ) ) - (br $block5) + (br $block6) ) (i32.store offset=12 (local.get $6) @@ -3481,7 +3481,7 @@ ) ) ) - (br $block5) + (br $block6) ) (i32.store offset=12 (local.get $6) @@ -3539,9 +3539,9 @@ (local.get $7) (i32.const 1) ) - (block $block7 - (block $block6 - (br_if $block6 + (block $block8 + (block $block7 + (br_if $block7 (i32.eqz (local.get $0) ) @@ -3575,7 +3575,7 @@ (local.get $6) ) ) - (br $block7) + (br $block8) ) (local.set $2 (call $38 @@ -3617,8 +3617,8 @@ (local.set $2 (call $7) ) - (block $block0 - (br_if $block0 + (block $block1 + (br_if $block1 (i32.eqz (local.get $1) ) @@ -3653,9 +3653,9 @@ ) ) ) - (block $block1 - (block $block3 - (block $block0 + (block $block2 + (block $block4 + (block $block1 (block $block (br_if $block (local.get $3) @@ -3663,12 +3663,12 @@ (local.set $6 (f64.const inf) ) - (br $block0) + (br $block1) ) (local.set $7 (i32.const 28) ) - (br_if $block1 + (br_if $block2 (i32.gt_u (i32.load offset=4 (local.get $3) @@ -3676,7 +3676,7 @@ (i32.const 999999999) ) ) - (br_if $block1 + (br_if $block2 (call $fimport$3 (local.get $2) (i32.add @@ -3711,8 +3711,8 @@ ) ) ) - (block $block2 - (br_if $block2 + (block $block3 + (br_if $block3 (i32.gt_s (local.get $3) (i32.const -1) @@ -3737,7 +3737,7 @@ ) ) ) - (br_if $block3 + (br_if $block4 (i32.lt_s (local.get $7) (i32.const 0) @@ -3760,15 +3760,15 @@ ) ) ) - (block $block8 - (block $block5 - (block $block4 - (br_if $block4 + (block $block9 + (block $block6 + (block $block5 + (br_if $block5 (local.tee $3 (call $10) ) ) - (br_if $block4 + (br_if $block5 (i32.ne (i32.load offset=56 (call $14) @@ -3776,7 +3776,7 @@ (i32.const 1) ) ) - (br_if $block5 + (br_if $block6 (i32.ne (i32.load offset=60 (call $14) @@ -3792,8 +3792,8 @@ ) ) (loop $label - (block $block6 - (br_if $block6 + (block $block7 + (br_if $block7 (i32.eqz (call $30 (call $14) @@ -3803,17 +3803,17 @@ (local.set $7 (i32.const 11) ) - (br $block1) + (br $block2) ) - (block $block7 - (br_if $block7 + (block $block8 + (br_if $block8 (i32.eqz (local.get $3) ) ) (call $44) ) - (br_if $block3 + (br_if $block4 (f64.le (local.tee $6 (f64.sub @@ -3855,7 +3855,7 @@ (i32.const 73) ) ) - (br $block8) + (br $block9) ) ) (local.set $7 @@ -3869,19 +3869,19 @@ ) ) ) - (br_if $block1 + (br_if $block2 (i32.eq (local.get $7) (i32.const 11) ) ) - (br_if $block1 + (br_if $block2 (i32.eq (local.get $7) (i32.const 27) ) ) - (br_if $block1 + (br_if $block2 (i32.eq (local.get $7) (i32.const 73) @@ -3890,7 +3890,7 @@ (local.set $7 (i32.const 0) ) - (br $block1) + (br $block2) ) (local.set $7 (i32.const 73) @@ -3962,7 +3962,7 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (block $block0 + (block $block1 (block $block (br_if $block (i32.and @@ -3977,7 +3977,7 @@ (local.set $3 (i32.const 0) ) - (br_if $block0 + (br_if $block1 (i32.eqz (call $52 (i32.add @@ -3995,7 +3995,7 @@ ) ) ) - (br_if $block0 + (br_if $block1 (i32.ne (local.tee $3 (call $13 @@ -4029,14 +4029,14 @@ (local.set $3 (i32.const 100) ) - (block $block1 + (block $block2 (loop $label - (br_if $block1 + (br_if $block2 (i32.eqz (local.get $3) ) ) - (br_if $block1 + (br_if $block2 (i32.eqz (i32.load (local.get $2) @@ -4058,7 +4058,7 @@ ) ) ) - (br_if $block0 + (br_if $block1 (i32.ne (local.tee $3 (call $13 @@ -4068,9 +4068,9 @@ (i32.const 10) ) ) - (loop $label0 - (block $block2 - (br_if $block2 + (loop $label1 + (block $block3 + (br_if $block3 (i32.eqz (local.tee $3 (i32.load @@ -4084,8 +4084,8 @@ (local.get $0) ) ) - (block $block3 - (br_if $block3 + (block $block4 + (br_if $block4 (i32.eqz (i32.and (local.get $3) @@ -4093,15 +4093,15 @@ ) ) ) - (br_if $block2 + (br_if $block3 (i32.and (local.get $6) (i32.const 4) ) ) ) - (block $block4 - (br_if $block4 + (block $block5 + (br_if $block5 (i32.ne (i32.and (local.get $6) @@ -4110,7 +4110,7 @@ (i32.const 2) ) ) - (br_if $block4 + (br_if $block5 (i32.ne (i32.and (local.get $3) @@ -4152,19 +4152,19 @@ (call $54 (local.get $5) ) - (br_if $block2 + (br_if $block3 (i32.eqz (local.get $3) ) ) - (br_if $block0 + (br_if $block1 (i32.ne (local.get $3) (i32.const 27) ) ) ) - (br_if $label0 + (br_if $label1 (i32.eq (local.tee $3 (call $13 @@ -4354,9 +4354,9 @@ ) (call $61) ) - (block $block1 - (block $block0 - (br_if $block0 + (block $block2 + (block $block1 + (br_if $block1 (i32.eqz (i32.and (i32.load8_u offset=2312 @@ -4369,32 +4369,32 @@ (local.set $1 (i32.const 0) ) - (br_if $block1 + (br_if $block2 (call $55 (i32.const 2316) ) ) ) - (block $block6 - (block $block18 - (block $block30 - (block $block39 - (block $block49 - (block $block43 - (block $block50 - (block $block32 - (block $block20 - (block $block16 - (block $block7 - (block $block2 - (br_if $block2 + (block $block7 + (block $block19 + (block $block31 + (block $block40 + (block $block50 + (block $block44 + (block $block51 + (block $block33 + (block $block21 + (block $block17 + (block $block8 + (block $block3 + (br_if $block3 (i32.gt_u (local.get $0) (i32.const 244) ) ) - (block $block3 - (br_if $block3 + (block $block4 + (br_if $block4 (i32.eqz (i32.and (local.tee $0 @@ -4460,9 +4460,9 @@ (i32.const 8) ) ) - (block $block5 - (block $block4 - (br_if $block4 + (block $block6 + (block $block5 + (br_if $block5 (i32.ne (local.tee $3 (i32.load offset=8 @@ -4487,7 +4487,7 @@ ) ) ) - (br $block5) + (br $block6) ) (i32.store offset=12 (local.get $3) @@ -4524,9 +4524,9 @@ (i32.const 1) ) ) - (br $block6) + (br $block7) ) - (br_if $block7 + (br_if $block8 (i32.le_u (local.get $3) (local.tee $6 @@ -4536,15 +4536,15 @@ ) ) ) - (block $block8 - (br_if $block8 + (block $block9 + (br_if $block9 (i32.eqz (local.get $0) ) ) - (block $block10 - (block $block9 - (br_if $block9 + (block $block11 + (block $block10 + (br_if $block10 (i32.ne (local.tee $1 (i32.load offset=8 @@ -4693,7 +4693,7 @@ ) ) ) - (br $block10) + (br $block11) ) (i32.store offset=12 (local.get $1) @@ -4746,8 +4746,8 @@ ) (local.get $4) ) - (block $block11 - (br_if $block11 + (block $block12 + (br_if $block12 (i32.eqz (local.get $6) ) @@ -4771,9 +4771,9 @@ (i32.const 0) ) ) - (block $block13 - (block $block12 - (br_if $block12 + (block $block14 + (block $block13 + (br_if $block13 (i32.and (local.get $2) (local.tee $7 @@ -4794,7 +4794,7 @@ (local.set $7 (local.get $3) ) - (br $block13) + (br $block14) ) (local.set $7 (i32.load offset=8 @@ -4827,9 +4827,9 @@ (i32.const 0) (local.get $4) ) - (br $block6) + (br $block7) ) - (br_if $block7 + (br_if $block8 (i32.eqz (local.tee $8 (i32.load offset=1872 @@ -4951,17 +4951,17 @@ (local.set $4 (local.get $5) ) - (block $block15 + (block $block16 (loop $label - (block $block14 - (br_if $block14 + (block $block15 + (br_if $block15 (local.tee $0 (i32.load offset=16 (local.get $4) ) ) ) - (br_if $block15 + (br_if $block16 (i32.eqz (local.tee $0 (i32.load @@ -5009,7 +5009,7 @@ (br $label) ) ) - (br_if $block16 + (br_if $block17 (i32.le_u (local.tee $9 (i32.add @@ -5025,8 +5025,8 @@ (local.get $5) ) ) - (block $block17 - (br_if $block17 + (block $block18 + (br_if $block18 (i32.eq (local.tee $7 (i32.load offset=12 @@ -5056,10 +5056,10 @@ (local.get $7) (local.get $0) ) - (br $block18) + (br $block19) ) - (block $block19 - (br_if $block19 + (block $block20 + (br_if $block20 (local.tee $0 (i32.load (local.tee $4 @@ -5071,7 +5071,7 @@ ) ) ) - (br_if $block20 + (br_if $block21 (i32.eqz (local.tee $0 (i32.load offset=16 @@ -5087,11 +5087,11 @@ ) ) ) - (loop $label0 + (loop $label1 (local.set $11 (local.get $4) ) - (br_if $label0 + (br_if $label1 (local.tee $0 (i32.load (local.tee $4 @@ -5111,7 +5111,7 @@ (i32.const 16) ) ) - (br_if $label0 + (br_if $label1 (local.tee $0 (i32.load offset=16 (local.get $7) @@ -5123,12 +5123,12 @@ (local.get $11) (i32.const 0) ) - (br $block18) + (br $block19) ) (local.set $3 (i32.const -1) ) - (br_if $block7 + (br_if $block8 (i32.gt_u (local.get $0) (i32.const -65) @@ -5145,7 +5145,7 @@ (i32.const -8) ) ) - (br_if $block7 + (br_if $block8 (i32.eqz (local.tee $6 (i32.load offset=1872 @@ -5157,8 +5157,8 @@ (local.set $11 (i32.const 31) ) - (block $block21 - (br_if $block21 + (block $block22 + (br_if $block22 (i32.gt_u (local.get $3) (i32.const 16777215) @@ -5257,11 +5257,11 @@ (local.get $3) ) ) - (block $block27 - (block $block25 - (block $block23 - (block $block22 - (br_if $block22 + (block $block28 + (block $block26 + (block $block24 + (block $block23 + (br_if $block23 (local.tee $4 (i32.load (i32.add @@ -5280,7 +5280,7 @@ (local.set $7 (i32.const 0) ) - (br $block23) + (br $block24) ) (local.set $0 (i32.const 0) @@ -5307,9 +5307,9 @@ (local.set $7 (i32.const 0) ) - (loop $label1 - (block $block24 - (br_if $block24 + (loop $label2 + (block $block25 + (br_if $block25 (i32.ge_u (local.tee $2 (i32.sub @@ -5331,7 +5331,7 @@ (local.set $7 (local.get $4) ) - (br_if $block24 + (br_if $block25 (local.get $2) ) (local.set $1 @@ -5343,7 +5343,7 @@ (local.set $0 (local.get $4) ) - (br $block25) + (br $block26) ) (local.set $0 (select @@ -5388,19 +5388,19 @@ (i32.const 1) ) ) - (br_if $label1 + (br_if $label2 (local.get $4) ) ) ) - (block $block26 - (br_if $block26 + (block $block27 + (br_if $block27 (i32.or (local.get $0) (local.get $7) ) ) - (br_if $block7 + (br_if $block8 (i32.eqz (local.tee $0 (i32.and @@ -5522,13 +5522,13 @@ ) ) ) - (br_if $block27 + (br_if $block28 (i32.eqz (local.get $0) ) ) ) - (loop $label2 + (loop $label3 (local.set $5 (i32.lt_u (local.tee $2 @@ -5545,8 +5545,8 @@ (local.get $1) ) ) - (block $block28 - (br_if $block28 + (block $block29 + (br_if $block29 (local.tee $4 (i32.load offset=16 (local.get $0) @@ -5579,17 +5579,17 @@ (local.set $0 (local.get $4) ) - (br_if $label2 + (br_if $label3 (local.get $4) ) ) ) - (br_if $block7 + (br_if $block8 (i32.eqz (local.get $7) ) ) - (br_if $block7 + (br_if $block8 (i32.ge_u (local.get $1) (i32.sub @@ -5600,7 +5600,7 @@ ) ) ) - (br_if $block16 + (br_if $block17 (i32.le_u (local.tee $11 (i32.add @@ -5616,8 +5616,8 @@ (local.get $7) ) ) - (block $block29 - (br_if $block29 + (block $block30 + (br_if $block30 (i32.eq (local.tee $5 (i32.load offset=12 @@ -5647,10 +5647,10 @@ (local.get $5) (local.get $0) ) - (br $block30) + (br $block31) ) - (block $block31 - (br_if $block31 + (block $block32 + (br_if $block32 (local.tee $0 (i32.load (local.tee $4 @@ -5662,7 +5662,7 @@ ) ) ) - (br_if $block32 + (br_if $block33 (i32.eqz (local.tee $0 (i32.load offset=16 @@ -5678,11 +5678,11 @@ ) ) ) - (loop $label3 + (loop $label4 (local.set $2 (local.get $4) ) - (br_if $label3 + (br_if $label4 (local.tee $0 (i32.load (local.tee $4 @@ -5702,7 +5702,7 @@ (i32.const 16) ) ) - (br_if $label3 + (br_if $label4 (local.tee $0 (i32.load offset=16 (local.get $5) @@ -5714,10 +5714,10 @@ (local.get $2) (i32.const 0) ) - (br $block30) + (br $block31) ) - (block $block33 - (br_if $block33 + (block $block34 + (br_if $block34 (i32.lt_u (local.tee $0 (i32.load offset=1876 @@ -5732,9 +5732,9 @@ (i32.const 0) ) ) - (block $block35 - (block $block34 - (br_if $block34 + (block $block36 + (block $block35 + (br_if $block35 (i32.lt_u (local.tee $4 (i32.sub @@ -5779,7 +5779,7 @@ (i32.const 3) ) ) - (br $block35) + (br $block36) ) (i32.store offset=1888 (i32.const 0) @@ -5817,10 +5817,10 @@ (i32.const 8) ) ) - (br $block6) + (br $block7) ) - (block $block36 - (br_if $block36 + (block $block37 + (br_if $block37 (i32.le_u (local.tee $0 (i32.load offset=1880 @@ -5872,20 +5872,20 @@ (i32.const 8) ) ) - (br $block6) + (br $block7) ) (local.set $1 (i32.const 0) ) - (block $block37 - (br_if $block37 + (block $block38 + (br_if $block38 (i32.load offset=1844 (i32.const 0) ) ) (call $61) ) - (br_if $block6 + (br_if $block7 (i32.le_u (local.tee $7 (i32.and @@ -5914,8 +5914,8 @@ (local.set $1 (i32.const 0) ) - (block $block38 - (br_if $block38 + (block $block39 + (br_if $block39 (i32.eqz (local.tee $0 (i32.load offset=2308 @@ -5924,7 +5924,7 @@ ) ) ) - (br_if $block6 + (br_if $block7 (i32.le_u (local.tee $5 (i32.add @@ -5939,7 +5939,7 @@ (local.get $4) ) ) - (br_if $block6 + (br_if $block7 (i32.gt_u (local.get $5) (local.get $0) @@ -5952,7 +5952,7 @@ (local.set $5 (i32.const -1) ) - (br_if $block39 + (br_if $block40 (i32.and (i32.load8_u offset=2312 (i32.const 0) @@ -5963,10 +5963,10 @@ (local.set $6 (i32.const 0) ) - (block $block48 - (block $block42 - (block $block40 - (br_if $block40 + (block $block49 + (block $block43 + (block $block41 + (br_if $block41 (i32.eqz (local.tee $1 (i32.load offset=1892 @@ -5978,9 +5978,9 @@ (local.set $0 (i32.const 2344) ) - (loop $label4 - (block $block41 - (br_if $block41 + (loop $label5 + (block $block42 + (br_if $block42 (i32.gt_u (local.tee $4 (i32.load @@ -5990,7 +5990,7 @@ (local.get $1) ) ) - (br_if $block42 + (br_if $block43 (i32.gt_u (i32.add (local.get $4) @@ -6002,7 +6002,7 @@ ) ) ) - (br_if $label4 + (br_if $label5 (local.tee $0 (i32.load offset=8 (local.get $0) @@ -6016,7 +6016,7 @@ (i32.const 2368) ) ) - (br_if $block43 + (br_if $block44 (i32.eq (local.tee $5 (call $66 @@ -6029,8 +6029,8 @@ (local.set $2 (local.get $7) ) - (block $block44 - (br_if $block44 + (block $block45 + (br_if $block45 (i32.eqz (i32.and (local.tee $1 @@ -6066,8 +6066,8 @@ ) ) ) - (block $block45 - (br_if $block45 + (block $block46 + (br_if $block46 (i32.gt_u (local.get $2) (local.get $3) @@ -6076,10 +6076,10 @@ (local.set $6 (i32.const 0) ) - (br $block43) + (br $block44) ) - (block $block46 - (br_if $block46 + (block $block47 + (br_if $block47 (i32.le_u (local.get $2) (i32.const 2147483646) @@ -6088,13 +6088,13 @@ (local.set $6 (i32.const 0) ) - (br $block43) + (br $block44) ) (local.set $6 (i32.const 0) ) - (block $block47 - (br_if $block47 + (block $block48 + (br_if $block48 (i32.eqz (local.tee $0 (i32.load offset=2308 @@ -6103,7 +6103,7 @@ ) ) ) - (br_if $block43 + (br_if $block44 (i32.le_u (local.tee $4 (i32.add @@ -6118,14 +6118,14 @@ (local.get $1) ) ) - (br_if $block43 + (br_if $block44 (i32.gt_u (local.get $4) (local.get $0) ) ) ) - (br_if $block48 + (br_if $block49 (i32.ne (local.tee $0 (call $66 @@ -6135,7 +6135,7 @@ (local.get $5) ) ) - (br $block49) + (br $block50) ) (drop (call $55 @@ -6145,7 +6145,7 @@ (local.set $6 (i32.const 0) ) - (br_if $block43 + (br_if $block44 (i32.gt_u (local.tee $2 (i32.and @@ -6171,7 +6171,7 @@ (i32.const 2147483646) ) ) - (br_if $block50 + (br_if $block51 (i32.eq (local.tee $5 (call $66 @@ -6195,8 +6195,8 @@ (local.set $6 (i32.const 0) ) - (block $block51 - (br_if $block51 + (block $block52 + (br_if $block52 (i32.le_u (i32.add (local.get $3) @@ -6205,14 +6205,14 @@ (local.get $2) ) ) - (br_if $block51 + (br_if $block52 (i32.eq (local.get $0) (i32.const -1) ) ) - (block $block52 - (br_if $block52 + (block $block53 + (br_if $block53 (i32.le_u (local.tee $1 (i32.and @@ -6239,10 +6239,10 @@ (local.set $5 (local.get $0) ) - (br $block49) + (br $block50) ) - (block $block53 - (br_if $block53 + (block $block54 + (br_if $block54 (i32.eq (call $66 (local.get $1) @@ -6259,7 +6259,7 @@ (local.set $5 (local.get $0) ) - (br $block49) + (br $block50) ) (drop (call $66 @@ -6272,18 +6272,18 @@ (local.set $6 (i32.const 0) ) - (br $block43) + (br $block44) ) (local.set $5 (local.get $0) ) - (br_if $block49 + (br_if $block50 (i32.ne (local.get $0) (i32.const -1) ) ) - (br $block43) + (br $block44) ) (unreachable) (unreachable) @@ -6291,17 +6291,17 @@ (local.set $7 (i32.const 0) ) - (br $block18) + (br $block19) ) (local.set $5 (i32.const 0) ) - (br $block30) + (br $block31) ) (local.set $6 (local.get $2) ) - (br_if $block49 + (br_if $block50 (i32.ne (local.get $5) (i32.const -1) @@ -6330,16 +6330,16 @@ ) ) ) - (block $block55 - (block $block56 - (block $block54 - (br_if $block54 + (block $block56 + (block $block57 + (block $block55 + (br_if $block55 (i32.gt_u (local.get $7) (i32.const 2147483646) ) ) - (br_if $block54 + (br_if $block55 (i32.ne (local.get $5) (i32.const -1) @@ -6365,25 +6365,25 @@ (i32.const 2368) ) ) - (br_if $block55 + (br_if $block56 (i32.ge_u (local.get $5) (local.get $0) ) ) - (br_if $block55 + (br_if $block56 (i32.eq (local.get $5) (i32.const -1) ) ) - (br_if $block55 + (br_if $block56 (i32.eq (local.get $0) (i32.const -1) ) ) - (br_if $block56 + (br_if $block57 (i32.gt_u (local.tee $2 (i32.sub @@ -6397,9 +6397,9 @@ ) ) ) - (br $block55) + (br $block56) ) - (br_if $block55 + (br_if $block56 (i32.eq (local.get $5) (i32.const -1) @@ -6417,8 +6417,8 @@ ) ) ) - (block $block57 - (br_if $block57 + (block $block58 + (br_if $block58 (i32.le_u (local.get $0) (i32.load offset=2304 @@ -6431,11 +6431,11 @@ (local.get $0) ) ) - (block $block63 - (block $block60 - (block $block59 - (block $block58 - (br_if $block58 + (block $block64 + (block $block61 + (block $block60 + (block $block59 + (br_if $block59 (i32.eqz (local.tee $1 (i32.load offset=1892 @@ -6447,8 +6447,8 @@ (local.set $0 (i32.const 2344) ) - (loop $label5 - (br_if $block59 + (loop $label6 + (br_if $block60 (i32.eq (local.get $5) (i32.add @@ -6465,19 +6465,19 @@ ) ) ) - (br_if $label5 + (br_if $label6 (local.tee $0 (i32.load offset=8 (local.get $0) ) ) ) - (br $block60) + (br $block61) ) ) - (block $block62 - (block $block61 - (br_if $block61 + (block $block63 + (block $block62 + (br_if $block62 (i32.eqz (local.tee $0 (i32.load offset=1884 @@ -6486,7 +6486,7 @@ ) ) ) - (br_if $block62 + (br_if $block63 (i32.ge_u (local.get $5) (local.get $0) @@ -6523,7 +6523,7 @@ (i32.const 0) (i32.const 0) ) - (loop $label6 + (loop $label7 (i32.store (i32.add (local.tee $1 @@ -6548,7 +6548,7 @@ ) (local.get $4) ) - (br_if $label6 + (br_if $label7 (i32.ne (local.tee $0 (i32.add @@ -6621,21 +6621,21 @@ (i32.const 0) ) ) - (br $block63) + (br $block64) ) - (br_if $block60 + (br_if $block61 (i32.le_u (local.get $5) (local.get $1) ) ) - (br_if $block60 + (br_if $block61 (i32.gt_u (local.get $4) (local.get $1) ) ) - (br_if $block60 + (br_if $block61 (i32.and (i32.load offset=12 (local.get $0) @@ -6713,10 +6713,10 @@ (i32.const 0) ) ) - (br $block63) + (br $block64) ) - (block $block64 - (br_if $block64 + (block $block65 + (br_if $block65 (i32.ge_u (local.get $5) (local.tee $7 @@ -6743,15 +6743,15 @@ (local.set $0 (i32.const 2344) ) - (block $block96 - (block $block71 - (block $block89 - (block $block69 - (block $block67 - (block $block66 - (block $block65 - (loop $label7 - (br_if $block65 + (block $block97 + (block $block72 + (block $block90 + (block $block70 + (block $block68 + (block $block67 + (block $block66 + (loop $label8 + (br_if $block66 (i32.eq (i32.load (local.get $0) @@ -6759,17 +6759,17 @@ (local.get $4) ) ) - (br_if $label7 + (br_if $label8 (local.tee $0 (i32.load offset=8 (local.get $0) ) ) ) - (br $block66) + (br $block67) ) ) - (br_if $block67 + (br_if $block68 (i32.eqz (i32.and (i32.load8_u offset=12 @@ -6783,9 +6783,9 @@ (local.set $0 (i32.const 2344) ) - (loop $label8 - (block $block68 - (br_if $block68 + (loop $label9 + (block $block69 + (br_if $block69 (i32.gt_u (local.tee $4 (i32.load @@ -6795,7 +6795,7 @@ (local.get $1) ) ) - (br_if $block69 + (br_if $block70 (i32.gt_u (local.tee $4 (i32.add @@ -6814,7 +6814,7 @@ (local.get $0) ) ) - (br $label8) + (br $label9) ) ) (i32.store @@ -6894,8 +6894,8 @@ (local.get $3) ) ) - (block $block70 - (br_if $block70 + (block $block71 + (br_if $block71 (i32.ne (local.get $1) (local.get $2) @@ -6923,10 +6923,10 @@ (i32.const 1) ) ) - (br $block71) + (br $block72) ) - (block $block72 - (br_if $block72 + (block $block73 + (br_if $block73 (i32.ne (i32.load offset=1888 (i32.const 0) @@ -6963,10 +6963,10 @@ ) (local.get $0) ) - (br $block71) + (br $block72) ) - (block $block73 - (br_if $block73 + (block $block74 + (br_if $block74 (i32.ne (i32.and (local.tee $0 @@ -6985,9 +6985,9 @@ (i32.const -8) ) ) - (block $block76 - (block $block74 - (br_if $block74 + (block $block77 + (block $block75 + (br_if $block75 (i32.gt_u (local.get $0) (i32.const 255) @@ -7016,8 +7016,8 @@ ) ) ) - (block $block75 - (br_if $block75 + (block $block76 + (br_if $block76 (i32.ne (local.tee $0 (i32.load offset=12 @@ -7039,7 +7039,7 @@ ) ) ) - (br $block76) + (br $block77) ) (drop (i32.eq @@ -7055,16 +7055,16 @@ (local.get $0) (local.get $1) ) - (br $block76) + (br $block77) ) (local.set $8 (i32.load offset=24 (local.get $2) ) ) - (block $block78 - (block $block77 - (br_if $block77 + (block $block79 + (block $block78 + (br_if $block78 (i32.eq (local.tee $5 (i32.load offset=12 @@ -7092,10 +7092,10 @@ (local.get $5) (local.get $0) ) - (br $block78) + (br $block79) ) - (block $block79 - (br_if $block79 + (block $block80 + (br_if $block80 (local.tee $1 (i32.load (local.tee $0 @@ -7107,7 +7107,7 @@ ) ) ) - (br_if $block79 + (br_if $block80 (local.tee $1 (i32.load (local.tee $0 @@ -7122,13 +7122,13 @@ (local.set $5 (i32.const 0) ) - (br $block78) + (br $block79) ) - (loop $label9 + (loop $label10 (local.set $7 (local.get $0) ) - (br_if $label9 + (br_if $label10 (local.tee $1 (i32.load (local.tee $0 @@ -7148,7 +7148,7 @@ (i32.const 16) ) ) - (br_if $label9 + (br_if $label10 (local.tee $1 (i32.load offset=16 (local.get $5) @@ -7161,14 +7161,14 @@ (i32.const 0) ) ) - (br_if $block76 + (br_if $block77 (i32.eqz (local.get $8) ) ) - (block $block81 - (block $block80 - (br_if $block80 + (block $block82 + (block $block81 + (br_if $block81 (i32.ne (i32.load (local.tee $0 @@ -7192,7 +7192,7 @@ (local.get $0) (local.get $5) ) - (br_if $block81 + (br_if $block82 (local.get $5) ) (i32.store offset=1872 @@ -7207,7 +7207,7 @@ ) ) ) - (br $block76) + (br $block77) ) (i32.store (i32.add @@ -7225,7 +7225,7 @@ ) (local.get $5) ) - (br_if $block76 + (br_if $block77 (i32.eqz (local.get $5) ) @@ -7235,8 +7235,8 @@ (local.get $5) (local.get $8) ) - (block $block82 - (br_if $block82 + (block $block83 + (br_if $block83 (i32.eqz (local.tee $0 (i32.load offset=16 @@ -7254,7 +7254,7 @@ (local.get $5) ) ) - (br_if $block76 + (br_if $block77 (i32.eqz (local.tee $0 (i32.load offset=20 @@ -7311,8 +7311,8 @@ ) (local.get $4) ) - (block $block83 - (br_if $block83 + (block $block84 + (br_if $block84 (i32.gt_u (local.get $4) (i32.const 255) @@ -7332,9 +7332,9 @@ (i32.const 1908) ) ) - (block $block85 - (block $block84 - (br_if $block84 + (block $block86 + (block $block85 + (br_if $block85 (i32.and (local.tee $4 (i32.load offset=1868 @@ -7359,7 +7359,7 @@ (local.set $1 (local.get $0) ) - (br $block85) + (br $block86) ) (local.set $1 (i32.load offset=8 @@ -7383,13 +7383,13 @@ (local.get $3) (local.get $1) ) - (br $block71) + (br $block72) ) (local.set $0 (i32.const 31) ) - (block $block86 - (br_if $block86 + (block $block87 + (br_if $block87 (i32.gt_u (local.get $4) (i32.const 16777215) @@ -7499,9 +7499,9 @@ (i32.const 2172) ) ) - (block $block88 - (block $block87 - (br_if $block87 + (block $block89 + (block $block88 + (br_if $block88 (i32.and (local.tee $5 (i32.load offset=1872 @@ -7531,7 +7531,7 @@ (local.get $3) (local.get $1) ) - (br $block88) + (br $block89) ) (local.set $0 (i32.shl @@ -7557,8 +7557,8 @@ (local.get $1) ) ) - (loop $label10 - (br_if $block89 + (loop $label11 + (br_if $block90 (i32.eq (i32.and (i32.load offset=4 @@ -7583,7 +7583,7 @@ (i32.const 1) ) ) - (br_if $label10 + (br_if $label11 (local.tee $5 (i32.load (local.tee $7 @@ -7619,7 +7619,7 @@ (local.get $3) (local.get $3) ) - (br $block71) + (br $block72) ) (i32.store offset=1880 (i32.const 0) @@ -7762,7 +7762,7 @@ (i32.const 24) ) ) - (loop $label11 + (loop $label12 (i32.store offset=4 (local.get $0) (i32.const 7) @@ -7779,14 +7779,14 @@ (i32.const 4) ) ) - (br_if $label11 + (br_if $label12 (i32.gt_u (local.get $4) (local.get $5) ) ) ) - (br_if $block63 + (br_if $block64 (i32.eq (local.get $7) (local.get $1) @@ -7817,8 +7817,8 @@ (local.get $7) (local.get $2) ) - (block $block90 - (br_if $block90 + (block $block91 + (br_if $block91 (i32.gt_u (local.get $2) (i32.const 255) @@ -7838,9 +7838,9 @@ (i32.const 1908) ) ) - (block $block92 - (block $block91 - (br_if $block91 + (block $block93 + (block $block92 + (br_if $block92 (i32.and (local.tee $5 (i32.load offset=1868 @@ -7865,7 +7865,7 @@ (local.set $4 (local.get $0) ) - (br $block92) + (br $block93) ) (local.set $4 (i32.load offset=8 @@ -7889,13 +7889,13 @@ (local.get $1) (local.get $4) ) - (br $block63) + (br $block64) ) (local.set $0 (i32.const 31) ) - (block $block93 - (br_if $block93 + (block $block94 + (br_if $block94 (i32.gt_u (local.get $2) (i32.const 16777215) @@ -8008,9 +8008,9 @@ (i32.const 2172) ) ) - (block $block95 - (block $block94 - (br_if $block94 + (block $block96 + (block $block95 + (br_if $block95 (i32.and (local.tee $5 (i32.load offset=1872 @@ -8043,7 +8043,7 @@ ) (local.get $4) ) - (br $block95) + (br $block96) ) (local.set $0 (i32.shl @@ -8069,8 +8069,8 @@ (local.get $4) ) ) - (loop $label12 - (br_if $block96 + (loop $label13 + (br_if $block97 (i32.eq (i32.and (i32.load offset=4 @@ -8095,7 +8095,7 @@ (i32.const 1) ) ) - (br_if $label12 + (br_if $label13 (local.tee $5 (i32.load (local.tee $7 @@ -8134,7 +8134,7 @@ (local.get $1) (local.get $1) ) - (br $block63) + (br $block64) ) (i32.store offset=12 (local.tee $0 @@ -8167,7 +8167,7 @@ (i32.const 8) ) ) - (br $block6) + (br $block7) ) (i32.store offset=12 (local.tee $0 @@ -8197,7 +8197,7 @@ (local.get $0) ) ) - (br_if $block55 + (br_if $block56 (i32.le_u (local.tee $0 (i32.load offset=1880 @@ -8249,7 +8249,7 @@ (i32.const 8) ) ) - (br $block6) + (br $block7) ) (i32.store (call $25) @@ -8258,17 +8258,17 @@ (local.set $1 (i32.const 0) ) - (br $block6) + (br $block7) ) - (block $block97 - (br_if $block97 + (block $block98 + (br_if $block98 (i32.eqz (local.get $8) ) ) - (block $block99 - (block $block98 - (br_if $block98 + (block $block100 + (block $block99 + (br_if $block99 (i32.ne (local.get $7) (i32.load @@ -8292,7 +8292,7 @@ (local.get $0) (local.get $5) ) - (br_if $block99 + (br_if $block100 (local.get $5) ) (i32.store offset=1872 @@ -8307,7 +8307,7 @@ ) ) ) - (br $block97) + (br $block98) ) (i32.store (i32.add @@ -8325,7 +8325,7 @@ ) (local.get $5) ) - (br_if $block97 + (br_if $block98 (i32.eqz (local.get $5) ) @@ -8335,8 +8335,8 @@ (local.get $5) (local.get $8) ) - (block $block100 - (br_if $block100 + (block $block101 + (br_if $block101 (i32.eqz (local.tee $0 (i32.load offset=16 @@ -8354,7 +8354,7 @@ (local.get $5) ) ) - (br_if $block97 + (br_if $block98 (i32.eqz (local.tee $0 (i32.load @@ -8378,9 +8378,9 @@ (local.get $5) ) ) - (block $block102 - (block $block101 - (br_if $block101 + (block $block103 + (block $block102 + (br_if $block102 (i32.gt_u (local.get $1) (i32.const 15) @@ -8412,7 +8412,7 @@ (i32.const 1) ) ) - (br $block102) + (br $block103) ) (i32.store offset=4 (local.get $7) @@ -8435,8 +8435,8 @@ ) (local.get $1) ) - (block $block103 - (br_if $block103 + (block $block104 + (br_if $block104 (i32.gt_u (local.get $1) (i32.const 255) @@ -8456,9 +8456,9 @@ (i32.const 1908) ) ) - (block $block105 - (block $block104 - (br_if $block104 + (block $block106 + (block $block105 + (br_if $block105 (i32.and (local.tee $4 (i32.load offset=1868 @@ -8483,7 +8483,7 @@ (local.set $1 (local.get $0) ) - (br $block105) + (br $block106) ) (local.set $1 (i32.load offset=8 @@ -8507,13 +8507,13 @@ (local.get $11) (local.get $1) ) - (br $block102) + (br $block103) ) (local.set $0 (i32.const 31) ) - (block $block106 - (br_if $block106 + (block $block107 + (br_if $block107 (i32.gt_u (local.get $1) (i32.const 16777215) @@ -8623,10 +8623,10 @@ (i32.const 2172) ) ) - (block $block109 - (block $block108 - (block $block107 - (br_if $block107 + (block $block110 + (block $block109 + (block $block108 + (br_if $block108 (i32.and (local.get $6) (local.tee $3 @@ -8652,7 +8652,7 @@ (local.get $11) (local.get $4) ) - (br $block108) + (br $block109) ) (local.set $0 (i32.shl @@ -8678,8 +8678,8 @@ (local.get $4) ) ) - (loop $label13 - (br_if $block109 + (loop $label14 + (br_if $block110 (i32.eq (i32.and (i32.load offset=4 @@ -8704,7 +8704,7 @@ (i32.const 1) ) ) - (br_if $label13 + (br_if $label14 (local.tee $3 (i32.load (local.tee $5 @@ -8740,7 +8740,7 @@ (local.get $11) (local.get $11) ) - (br $block102) + (br $block103) ) (i32.store offset=12 (local.tee $0 @@ -8773,17 +8773,17 @@ (i32.const 8) ) ) - (br $block6) + (br $block7) ) - (block $block110 - (br_if $block110 + (block $block111 + (br_if $block111 (i32.eqz (local.get $10) ) ) - (block $block112 - (block $block111 - (br_if $block111 + (block $block113 + (block $block112 + (br_if $block112 (i32.ne (local.get $5) (i32.load @@ -8807,7 +8807,7 @@ (local.get $0) (local.get $7) ) - (br_if $block112 + (br_if $block113 (local.get $7) ) (i32.store offset=1872 @@ -8820,7 +8820,7 @@ ) ) ) - (br $block110) + (br $block111) ) (i32.store (i32.add @@ -8838,7 +8838,7 @@ ) (local.get $7) ) - (br_if $block110 + (br_if $block111 (i32.eqz (local.get $7) ) @@ -8848,8 +8848,8 @@ (local.get $7) (local.get $10) ) - (block $block113 - (br_if $block113 + (block $block114 + (br_if $block114 (i32.eqz (local.tee $0 (i32.load offset=16 @@ -8867,7 +8867,7 @@ (local.get $7) ) ) - (br_if $block110 + (br_if $block111 (i32.eqz (local.tee $0 (i32.load @@ -8891,9 +8891,9 @@ (local.get $7) ) ) - (block $block115 - (block $block114 - (br_if $block114 + (block $block116 + (block $block115 + (br_if $block115 (i32.gt_u (local.get $1) (i32.const 15) @@ -8925,7 +8925,7 @@ (i32.const 1) ) ) - (br $block115) + (br $block116) ) (i32.store offset=4 (local.get $5) @@ -8948,8 +8948,8 @@ ) (local.get $1) ) - (block $block116 - (br_if $block116 + (block $block117 + (br_if $block117 (i32.eqz (local.get $6) ) @@ -8973,9 +8973,9 @@ (i32.const 0) ) ) - (block $block118 - (block $block117 - (br_if $block117 + (block $block119 + (block $block118 + (br_if $block118 (i32.and (local.tee $3 (i32.shl @@ -8996,7 +8996,7 @@ (local.set $3 (local.get $4) ) - (br $block118) + (br $block119) ) (local.set $3 (i32.load offset=8 @@ -9037,7 +9037,7 @@ ) ) ) - (br_if $block1 + (br_if $block2 (i32.eqz (i32.and (i32.load8_u offset=2312 @@ -9092,8 +9092,8 @@ (i32.const 0) (i32.const 2) ) - (block $block0 - (br_if $block0 + (block $block1 + (br_if $block1 (call $57 (i32.add (local.get $0) @@ -9101,7 +9101,7 @@ ) ) ) - (br_if $block0 + (br_if $block1 (call $58 (i32.const 2316) (i32.add @@ -9159,8 +9159,8 @@ (local.get $0) ) ) - (block $block0 - (br_if $block0 + (block $block1 + (br_if $block1 (i32.eqz (i32.and (i32.load8_u offset=2312 @@ -9199,15 +9199,15 @@ ) ) ) - (block $block2 - (block $block1 - (br_if $block1 + (block $block3 + (block $block2 + (br_if $block2 (i32.and (local.get $2) (i32.const 1) ) ) - (br_if $block2 + (br_if $block3 (i32.eqz (i32.and (local.get $2) @@ -9215,7 +9215,7 @@ ) ) ) - (br_if $block2 + (br_if $block3 (i32.lt_u (local.tee $1 (i32.sub @@ -9240,8 +9240,8 @@ (local.get $0) ) ) - (block $block3 - (br_if $block3 + (block $block4 + (br_if $block4 (i32.eq (i32.load offset=1888 (i32.const 0) @@ -9249,8 +9249,8 @@ (local.get $1) ) ) - (block $block4 - (br_if $block4 + (block $block5 + (br_if $block5 (i32.gt_u (local.get $2) (i32.const 255) @@ -9279,8 +9279,8 @@ ) ) ) - (block $block5 - (br_if $block5 + (block $block6 + (br_if $block6 (i32.ne (local.tee $2 (i32.load offset=12 @@ -9302,7 +9302,7 @@ ) ) ) - (br $block1) + (br $block2) ) (drop (i32.eq @@ -9318,16 +9318,16 @@ (local.get $2) (local.get $4) ) - (br $block1) + (br $block2) ) (local.set $7 (i32.load offset=24 (local.get $1) ) ) - (block $block7 - (block $block6 - (br_if $block6 + (block $block8 + (block $block7 + (br_if $block7 (i32.eq (local.tee $6 (i32.load offset=12 @@ -9355,10 +9355,10 @@ (local.get $6) (local.get $2) ) - (br $block7) + (br $block8) ) - (block $block8 - (br_if $block8 + (block $block9 + (br_if $block9 (local.tee $4 (i32.load (local.tee $2 @@ -9370,7 +9370,7 @@ ) ) ) - (br_if $block8 + (br_if $block9 (local.tee $4 (i32.load (local.tee $2 @@ -9385,7 +9385,7 @@ (local.set $6 (i32.const 0) ) - (br $block7) + (br $block8) ) (loop $label (local.set $5 @@ -9424,14 +9424,14 @@ (i32.const 0) ) ) - (br_if $block1 + (br_if $block2 (i32.eqz (local.get $7) ) ) - (block $block10 - (block $block9 - (br_if $block9 + (block $block11 + (block $block10 + (br_if $block10 (i32.ne (i32.load (local.tee $2 @@ -9455,7 +9455,7 @@ (local.get $2) (local.get $6) ) - (br_if $block10 + (br_if $block11 (local.get $6) ) (i32.store offset=1872 @@ -9470,7 +9470,7 @@ ) ) ) - (br $block1) + (br $block2) ) (i32.store (i32.add @@ -9488,7 +9488,7 @@ ) (local.get $6) ) - (br_if $block1 + (br_if $block2 (i32.eqz (local.get $6) ) @@ -9498,8 +9498,8 @@ (local.get $6) (local.get $7) ) - (block $block11 - (br_if $block11 + (block $block12 + (br_if $block12 (i32.eqz (local.tee $2 (i32.load offset=16 @@ -9517,7 +9517,7 @@ (local.get $6) ) ) - (br_if $block1 + (br_if $block2 (i32.eqz (local.tee $2 (i32.load offset=20 @@ -9537,9 +9537,9 @@ (local.get $2) (local.get $6) ) - (br $block1) + (br $block2) ) - (br_if $block1 + (br_if $block2 (i32.ne (i32.and (local.tee $2 @@ -9577,15 +9577,15 @@ ) (local.get $0) ) - (br $block2) + (br $block3) ) - (br_if $block2 + (br_if $block3 (i32.le_u (local.get $3) (local.get $1) ) ) - (br_if $block2 + (br_if $block3 (i32.eqz (i32.and (local.tee $2 @@ -9597,16 +9597,16 @@ ) ) ) - (block $block24 - (block $block12 - (br_if $block12 + (block $block25 + (block $block13 + (br_if $block13 (i32.and (local.get $2) (i32.const 2) ) ) - (block $block13 - (br_if $block13 + (block $block14 + (br_if $block14 (i32.ne (i32.load offset=1892 (i32.const 0) @@ -9636,7 +9636,7 @@ (i32.const 1) ) ) - (br_if $block2 + (br_if $block3 (i32.ne (local.get $1) (i32.load offset=1888 @@ -9652,10 +9652,10 @@ (i32.const 0) (i32.const 0) ) - (br $block2) + (br $block3) ) - (block $block14 - (br_if $block14 + (block $block15 + (br_if $block15 (i32.ne (i32.load offset=1888 (i32.const 0) @@ -9692,7 +9692,7 @@ ) (local.get $0) ) - (br $block2) + (br $block3) ) (local.set $0 (i32.add @@ -9703,9 +9703,9 @@ (local.get $0) ) ) - (block $block17 - (block $block15 - (br_if $block15 + (block $block18 + (block $block16 + (br_if $block16 (i32.gt_u (local.get $2) (i32.const 255) @@ -9734,8 +9734,8 @@ ) ) ) - (block $block16 - (br_if $block16 + (block $block17 + (br_if $block17 (i32.ne (local.tee $2 (i32.load offset=12 @@ -9757,7 +9757,7 @@ ) ) ) - (br $block17) + (br $block18) ) (drop (i32.eq @@ -9773,16 +9773,16 @@ (local.get $2) (local.get $4) ) - (br $block17) + (br $block18) ) (local.set $7 (i32.load offset=24 (local.get $3) ) ) - (block $block19 - (block $block18 - (br_if $block18 + (block $block20 + (block $block19 + (br_if $block19 (i32.eq (local.tee $6 (i32.load offset=12 @@ -9812,10 +9812,10 @@ (local.get $6) (local.get $2) ) - (br $block19) + (br $block20) ) - (block $block20 - (br_if $block20 + (block $block21 + (br_if $block21 (local.tee $2 (i32.load (local.tee $4 @@ -9827,7 +9827,7 @@ ) ) ) - (br_if $block20 + (br_if $block21 (local.tee $2 (i32.load (local.tee $4 @@ -9842,13 +9842,13 @@ (local.set $6 (i32.const 0) ) - (br $block19) + (br $block20) ) - (loop $label0 + (loop $label1 (local.set $5 (local.get $4) ) - (br_if $label0 + (br_if $label1 (local.tee $2 (i32.load (local.tee $4 @@ -9868,7 +9868,7 @@ (i32.const 16) ) ) - (br_if $label0 + (br_if $label1 (local.tee $2 (i32.load offset=16 (local.get $6) @@ -9881,14 +9881,14 @@ (i32.const 0) ) ) - (br_if $block17 + (br_if $block18 (i32.eqz (local.get $7) ) ) - (block $block22 - (block $block21 - (br_if $block21 + (block $block23 + (block $block22 + (br_if $block22 (i32.ne (i32.load (local.tee $2 @@ -9912,7 +9912,7 @@ (local.get $2) (local.get $6) ) - (br_if $block22 + (br_if $block23 (local.get $6) ) (i32.store offset=1872 @@ -9927,7 +9927,7 @@ ) ) ) - (br $block17) + (br $block18) ) (i32.store (i32.add @@ -9945,7 +9945,7 @@ ) (local.get $6) ) - (br_if $block17 + (br_if $block18 (i32.eqz (local.get $6) ) @@ -9955,8 +9955,8 @@ (local.get $6) (local.get $7) ) - (block $block23 - (br_if $block23 + (block $block24 + (br_if $block24 (i32.eqz (local.tee $2 (i32.load offset=16 @@ -9974,7 +9974,7 @@ (local.get $6) ) ) - (br_if $block17 + (br_if $block18 (i32.eqz (local.tee $2 (i32.load offset=20 @@ -10009,7 +10009,7 @@ ) (local.get $0) ) - (br_if $block24 + (br_if $block25 (i32.ne (local.get $1) (i32.load offset=1888 @@ -10021,7 +10021,7 @@ (i32.const 0) (local.get $0) ) - (br $block2) + (br $block3) ) (i32.store offset=4 (local.get $3) @@ -10045,8 +10045,8 @@ (local.get $0) ) ) - (block $block25 - (br_if $block25 + (block $block26 + (br_if $block26 (i32.gt_u (local.get $0) (i32.const 255) @@ -10066,9 +10066,9 @@ (i32.const 1908) ) ) - (block $block27 - (block $block26 - (br_if $block26 + (block $block28 + (block $block27 + (br_if $block27 (i32.and (local.tee $4 (i32.load offset=1868 @@ -10093,7 +10093,7 @@ (local.set $2 (local.get $0) ) - (br $block27) + (br $block28) ) (local.set $2 (i32.load offset=8 @@ -10117,13 +10117,13 @@ (local.get $1) (local.get $2) ) - (br $block2) + (br $block3) ) (local.set $2 (i32.const 31) ) - (block $block28 - (br_if $block28 + (block $block29 + (br_if $block29 (i32.gt_u (local.get $0) (i32.const 16777215) @@ -10236,11 +10236,11 @@ (i32.const 2172) ) ) - (block $block32 - (block $block31 - (block $block30 - (block $block29 - (br_if $block29 + (block $block33 + (block $block32 + (block $block31 + (block $block30 + (br_if $block30 (i32.and (local.tee $6 (i32.load offset=1872 @@ -10273,7 +10273,7 @@ ) (local.get $4) ) - (br $block30) + (br $block31) ) (local.set $2 (i32.shl @@ -10299,8 +10299,8 @@ (local.get $4) ) ) - (loop $label1 - (br_if $block31 + (loop $label2 + (br_if $block32 (i32.eq (i32.and (i32.load offset=4 @@ -10325,7 +10325,7 @@ (i32.const 1) ) ) - (br_if $label1 + (br_if $label2 (local.tee $6 (i32.load (local.tee $3 @@ -10364,7 +10364,7 @@ (local.get $1) (local.get $1) ) - (br $block32) + (br $block33) ) (i32.store offset=12 (local.tee $0 @@ -10455,7 +10455,7 @@ (local.set $2 (i32.const 16) ) - (block $block0 + (block $block1 (block $block (br_if $block (i32.and @@ -10478,7 +10478,7 @@ (local.set $0 (local.get $3) ) - (br $block0) + (br $block1) ) (loop $label (local.set $2 @@ -10497,8 +10497,8 @@ ) ) ) - (block $block1 - (br_if $block1 + (block $block2 + (br_if $block2 (i32.gt_u (i32.sub (i32.const -64) @@ -10515,8 +10515,8 @@ (i32.const 0) ) ) - (block $block2 - (br_if $block2 + (block $block3 + (br_if $block3 (local.tee $3 (call $60 (i32.add @@ -10551,9 +10551,9 @@ (local.set $2 (i32.const 0) ) - (block $block4 - (block $block3 - (br_if $block3 + (block $block5 + (block $block4 + (br_if $block4 (i32.eqz (i32.and (i32.load8_u offset=2312 @@ -10563,7 +10563,7 @@ ) ) ) - (br_if $block4 + (br_if $block5 (call $55 (i32.const 2316) ) @@ -10575,8 +10575,8 @@ (i32.const -8) ) ) - (block $block5 - (br_if $block5 + (block $block6 + (br_if $block6 (i32.eqz (i32.and (i32.add @@ -10642,9 +10642,9 @@ ) ) ) - (block $block7 - (block $block6 - (br_if $block6 + (block $block8 + (block $block7 + (br_if $block7 (i32.and (local.get $5) (i32.const 3) @@ -10666,7 +10666,7 @@ (local.get $3) ) ) - (br $block7) + (br $block8) ) (i32.store offset=4 (local.get $0) @@ -10735,8 +10735,8 @@ (local.get $0) ) ) - (block $block8 - (br_if $block8 + (block $block9 + (br_if $block9 (i32.eqz (i32.and (local.tee $0 @@ -10748,7 +10748,7 @@ ) ) ) - (br_if $block8 + (br_if $block9 (i32.le_u (local.tee $3 (i32.and @@ -10817,7 +10817,7 @@ (i32.const 8) ) ) - (br_if $block4 + (br_if $block5 (i32.eqz (i32.and (i32.load8_u offset=2312 @@ -10848,7 +10848,7 @@ (local.get $1) ) ) - (block $block0 + (block $block1 (block $block (br_if $block (i32.and @@ -10860,7 +10860,7 @@ (i32.const 1) ) ) - (br_if $block0 + (br_if $block1 (i32.eqz (i32.and (local.get $3) @@ -10878,9 +10878,9 @@ (local.get $1) ) ) - (block $block3 - (block $block1 - (br_if $block1 + (block $block4 + (block $block2 + (br_if $block2 (i32.eq (i32.load offset=1888 (i32.const 0) @@ -10893,8 +10893,8 @@ ) ) ) - (block $block2 - (br_if $block2 + (block $block3 + (br_if $block3 (i32.gt_u (local.get $3) (i32.const 255) @@ -10923,7 +10923,7 @@ ) ) ) - (br_if $block3 + (br_if $block4 (i32.ne (local.tee $3 (i32.load offset=12 @@ -10952,9 +10952,9 @@ (local.get $0) ) ) - (block $block5 - (block $block4 - (br_if $block4 + (block $block6 + (block $block5 + (br_if $block5 (i32.eq (local.tee $6 (i32.load offset=12 @@ -10984,10 +10984,10 @@ (local.get $6) (local.get $3) ) - (br $block5) + (br $block6) ) - (block $block6 - (br_if $block6 + (block $block7 + (br_if $block7 (local.tee $4 (i32.load (local.tee $3 @@ -10999,7 +10999,7 @@ ) ) ) - (br_if $block6 + (br_if $block7 (local.tee $4 (i32.load (local.tee $3 @@ -11014,7 +11014,7 @@ (local.set $6 (i32.const 0) ) - (br $block5) + (br $block6) ) (loop $label (local.set $5 @@ -11058,9 +11058,9 @@ (local.get $7) ) ) - (block $block8 - (block $block7 - (br_if $block7 + (block $block9 + (block $block8 + (br_if $block8 (i32.ne (i32.load (local.tee $3 @@ -11084,7 +11084,7 @@ (local.get $3) (local.get $6) ) - (br_if $block8 + (br_if $block9 (local.get $6) ) (i32.store offset=1872 @@ -11127,8 +11127,8 @@ (local.get $6) (local.get $7) ) - (block $block9 - (br_if $block9 + (block $block10 + (br_if $block10 (i32.eqz (local.tee $3 (i32.load offset=16 @@ -11220,9 +11220,9 @@ (local.get $4) ) ) - (block $block22 - (block $block10 - (br_if $block10 + (block $block23 + (block $block11 + (br_if $block11 (i32.and (local.tee $3 (i32.load offset=4 @@ -11232,8 +11232,8 @@ (i32.const 2) ) ) - (block $block11 - (br_if $block11 + (block $block12 + (br_if $block12 (i32.ne (i32.load offset=1892 (i32.const 0) @@ -11263,7 +11263,7 @@ (i32.const 1) ) ) - (br_if $block0 + (br_if $block1 (i32.ne (local.get $0) (i32.load offset=1888 @@ -11281,8 +11281,8 @@ ) (return) ) - (block $block12 - (br_if $block12 + (block $block13 + (br_if $block13 (i32.ne (i32.load offset=1888 (i32.const 0) @@ -11330,9 +11330,9 @@ (local.get $1) ) ) - (block $block15 - (block $block13 - (br_if $block13 + (block $block16 + (block $block14 + (br_if $block14 (i32.gt_u (local.get $3) (i32.const 255) @@ -11361,8 +11361,8 @@ ) ) ) - (block $block14 - (br_if $block14 + (block $block15 + (br_if $block15 (i32.ne (local.tee $3 (i32.load offset=12 @@ -11384,7 +11384,7 @@ ) ) ) - (br $block15) + (br $block16) ) (drop (i32.eq @@ -11400,16 +11400,16 @@ (local.get $3) (local.get $4) ) - (br $block15) + (br $block16) ) (local.set $7 (i32.load offset=24 (local.get $2) ) ) - (block $block17 - (block $block16 - (br_if $block16 + (block $block18 + (block $block17 + (br_if $block17 (i32.eq (local.tee $6 (i32.load offset=12 @@ -11439,10 +11439,10 @@ (local.get $6) (local.get $3) ) - (br $block17) + (br $block18) ) - (block $block18 - (br_if $block18 + (block $block19 + (br_if $block19 (local.tee $3 (i32.load (local.tee $4 @@ -11454,7 +11454,7 @@ ) ) ) - (br_if $block18 + (br_if $block19 (local.tee $3 (i32.load (local.tee $4 @@ -11469,13 +11469,13 @@ (local.set $6 (i32.const 0) ) - (br $block17) + (br $block18) ) - (loop $label0 + (loop $label1 (local.set $5 (local.get $4) ) - (br_if $label0 + (br_if $label1 (local.tee $3 (i32.load (local.tee $4 @@ -11495,7 +11495,7 @@ (i32.const 16) ) ) - (br_if $label0 + (br_if $label1 (local.tee $3 (i32.load offset=16 (local.get $6) @@ -11508,14 +11508,14 @@ (i32.const 0) ) ) - (br_if $block15 + (br_if $block16 (i32.eqz (local.get $7) ) ) - (block $block20 - (block $block19 - (br_if $block19 + (block $block21 + (block $block20 + (br_if $block20 (i32.ne (i32.load (local.tee $3 @@ -11539,7 +11539,7 @@ (local.get $3) (local.get $6) ) - (br_if $block20 + (br_if $block21 (local.get $6) ) (i32.store offset=1872 @@ -11554,7 +11554,7 @@ ) ) ) - (br $block15) + (br $block16) ) (i32.store (i32.add @@ -11572,7 +11572,7 @@ ) (local.get $6) ) - (br_if $block15 + (br_if $block16 (i32.eqz (local.get $6) ) @@ -11582,8 +11582,8 @@ (local.get $6) (local.get $7) ) - (block $block21 - (br_if $block21 + (block $block22 + (br_if $block22 (i32.eqz (local.tee $3 (i32.load offset=16 @@ -11601,7 +11601,7 @@ (local.get $6) ) ) - (br_if $block15 + (br_if $block16 (i32.eqz (local.tee $3 (i32.load offset=20 @@ -11636,7 +11636,7 @@ ) (local.get $1) ) - (br_if $block22 + (br_if $block23 (i32.ne (local.get $0) (i32.load offset=1888 @@ -11672,8 +11672,8 @@ (local.get $1) ) ) - (block $block23 - (br_if $block23 + (block $block24 + (br_if $block24 (i32.gt_u (local.get $1) (i32.const 255) @@ -11693,9 +11693,9 @@ (i32.const 1908) ) ) - (block $block25 - (block $block24 - (br_if $block24 + (block $block26 + (block $block25 + (br_if $block25 (i32.and (local.tee $4 (i32.load offset=1868 @@ -11720,7 +11720,7 @@ (local.set $3 (local.get $1) ) - (br $block25) + (br $block26) ) (local.set $3 (i32.load offset=8 @@ -11749,8 +11749,8 @@ (local.set $3 (i32.const 31) ) - (block $block26 - (br_if $block26 + (block $block27 + (br_if $block27 (i32.gt_u (local.get $1) (i32.const 16777215) @@ -11863,10 +11863,10 @@ (i32.const 2172) ) ) - (block $block29 - (block $block28 - (block $block27 - (br_if $block27 + (block $block30 + (block $block29 + (block $block28 + (br_if $block28 (i32.and (local.tee $6 (i32.load offset=1872 @@ -11899,7 +11899,7 @@ ) (local.get $4) ) - (br $block28) + (br $block29) ) (local.set $3 (i32.shl @@ -11925,8 +11925,8 @@ (local.get $4) ) ) - (loop $label1 - (br_if $block29 + (loop $label2 + (br_if $block30 (i32.eq (i32.and (i32.load offset=4 @@ -11951,7 +11951,7 @@ (i32.const 1) ) ) - (br_if $label1 + (br_if $label2 (local.tee $6 (i32.load (local.tee $2 @@ -12039,7 +12039,7 @@ (i32.const 1) ) ) - (block $block0 + (block $block1 (loop $label (local.set $0 (i32.add @@ -12055,15 +12055,15 @@ (br_if $block (local.get $2) ) - (br_if $block0 + (br_if $block1 (i32.le_u (local.get $0) (local.get $3) ) ) ) - (block $block1 - (br_if $block1 + (block $block2 + (br_if $block2 (i32.le_u (local.get $0) (i32.shl @@ -12072,7 +12072,7 @@ ) ) ) - (br_if $block0 + (br_if $block1 (i32.eqz (call $fimport$15 (local.get $0) @@ -12192,9 +12192,9 @@ (i32.const 16) ) ) - (block $block2 - (block $block1 - (block $block0 + (block $block3 + (block $block2 + (block $block1 (block $block (br_if $block (call $71 @@ -12215,7 +12215,7 @@ ) ) (loop $label - (br_if $block0 + (br_if $block1 (i32.eq (local.get $6) (local.tee $4 @@ -12225,7 +12225,7 @@ ) ) ) - (br_if $block1 + (br_if $block2 (i32.le_s (local.get $4) (i32.const -1) @@ -12323,7 +12323,7 @@ ) ) ) - (br_if $block1 + (br_if $block2 (i32.ne (local.get $6) (i32.const -1) @@ -12354,7 +12354,7 @@ (local.set $4 (local.get $2) ) - (br $block2) + (br $block3) ) (local.set $4 (i32.const 0) @@ -12376,7 +12376,7 @@ (i32.const 32) ) ) - (br_if $block2 + (br_if $block3 (i32.eq (local.get $7) (i32.const 2) @@ -12437,15 +12437,15 @@ (func $80 (param $0 i32) (result i32) (local $1 i32) (local $2 i32) - (block $block1 + (block $block2 (block $block (br_if $block (i32.eqz (local.get $0) ) ) - (block $block0 - (br_if $block0 + (block $block1 + (br_if $block1 (i32.gt_s (i32.load offset=76 (local.get $0) @@ -12469,7 +12469,7 @@ (local.get $0) ) ) - (br_if $block1 + (br_if $block2 (i32.eqz (local.get $1) ) @@ -12484,8 +12484,8 @@ (local.set $2 (i32.const 0) ) - (block $block2 - (br_if $block2 + (block $block3 + (br_if $block3 (i32.eqz (i32.load offset=1584 (i32.const 0) @@ -12500,8 +12500,8 @@ ) ) ) - (block $block3 - (br_if $block3 + (block $block4 + (br_if $block4 (i32.eqz (local.tee $0 (i32.load @@ -12514,8 +12514,8 @@ (local.set $1 (i32.const 0) ) - (block $block4 - (br_if $block4 + (block $block5 + (br_if $block5 (i32.lt_s (i32.load offset=76 (local.get $0) @@ -12529,8 +12529,8 @@ ) ) ) - (block $block5 - (br_if $block5 + (block $block6 + (br_if $block6 (i32.le_u (i32.load offset=20 (local.get $0) @@ -12549,8 +12549,8 @@ ) ) ) - (block $block6 - (br_if $block6 + (block $block7 + (br_if $block7 (i32.eqz (local.get $1) ) @@ -12605,8 +12605,8 @@ (i32.const -1) ) ) - (block $block0 - (br_if $block0 + (block $block1 + (br_if $block1 (i32.ge_u (local.tee $1 (i32.load offset=4 @@ -12684,7 +12684,7 @@ (local.set $1 (i32.const 0) ) - (loop $label0 + (loop $label1 (local.set $2 (i32.const 0) ) @@ -12692,8 +12692,8 @@ (i32.const 0) ) (loop $label - (block $block0 - (br_if $block0 + (block $block1 + (br_if $block1 (i32.eqz (local.tee $6 (i32.load @@ -12714,7 +12714,7 @@ ) ) ) - (br_if $block0 + (br_if $block1 (i32.eqz (i32.load (local.tee $4 @@ -12764,7 +12764,7 @@ (i32.const 1) ) ) - (br_if $label0 + (br_if $label1 (local.get $3) ) ) diff --git a/test/passes/dce_vacuum_remove-unused-names.bin.txt b/test/passes/dce_vacuum_remove-unused-names.bin.txt index 3befa47b3c7..72bdb2a9ca9 100644 --- a/test/passes/dce_vacuum_remove-unused-names.bin.txt +++ b/test/passes/dce_vacuum_remove-unused-names.bin.txt @@ -67,8 +67,8 @@ ) ) ) - (loop $label0 - (br_if $label0 + (loop $label1 + (br_if $label1 (f64.ne (f64.sub (f64.sub diff --git a/test/passes/dwarf-local-order.bin.txt b/test/passes/dwarf-local-order.bin.txt index accf478e6a8..8fc6cfbbe82 100644 --- a/test/passes/dwarf-local-order.bin.txt +++ b/test/passes/dwarf-local-order.bin.txt @@ -122,7 +122,7 @@ (local.get $15) ) ) - (block $block0 + (block $block1 (block $block (br_if $block (local.get $16) @@ -135,7 +135,7 @@ (local.set $18 (local.get $17) ) - (br $block0) + (br $block1) ) (local.set $19 (i32.const -2147483648) @@ -340,7 +340,7 @@ ) ) ;; code offset: 0xa9 - (block $block0 + (block $block1 ;; code offset: 0xab (block $block ;; code offset: 0xaf @@ -362,7 +362,7 @@ (local.get $17) ) ;; code offset: 0xba - (br $block0) + (br $block1) ) ;; code offset: 0xc3 (local.set $19 @@ -516,7 +516,7 @@ (local.get $7) ) ) - (block $block0 + (block $block1 (block $block (br_if $block (local.get $8) @@ -529,7 +529,7 @@ (local.set $10 (local.get $9) ) - (br $block0) + (br $block1) ) (local.set $11 (i32.const -2147483648) @@ -671,7 +671,7 @@ (local.get $7) ) ) - (block $block0 + (block $block1 (block $block (br_if $block (local.get $8) @@ -684,7 +684,7 @@ (local.set $10 (local.get $9) ) - (br $block0) + (br $block1) ) (local.set $11 (i32.const -2147483648) diff --git a/test/passes/fannkuch0_dwarf.bin.txt b/test/passes/fannkuch0_dwarf.bin.txt index f44a706a9fb..9e9bb853743 100644 --- a/test/passes/fannkuch0_dwarf.bin.txt +++ b/test/passes/fannkuch0_dwarf.bin.txt @@ -5986,11 +5986,11 @@ file_names[ 3]: (local.get $54) ) ;; code offset: 0x3a8 - (loop $label6 (result i32) + (loop $label7 (result i32) ;; code offset: 0x3aa - (block $block0 + (block $block1 ;; code offset: 0x3ac - (loop $label0 + (loop $label1 ;; code offset: 0x3b0 (local.set $55 ;; code offset: 0x3ae @@ -6040,7 +6040,7 @@ file_names[ 3]: ) ) ;; code offset: 0x3d6 - (br_if $block0 + (br_if $block1 ;; code offset: 0x3d5 (i32.eqz ;; code offset: 0x3d3 @@ -6149,7 +6149,7 @@ file_names[ 3]: (local.get $72) ) ;; code offset: 0x42a - (br $label0) + (br $label1) ) ;; code offset: 0x42d (unreachable) @@ -6171,9 +6171,9 @@ file_names[ 3]: ) ) ;; code offset: 0x43d - (block $block1 + (block $block2 ;; code offset: 0x442 - (br_if $block1 + (br_if $block2 ;; code offset: 0x441 (i32.eqz ;; code offset: 0x43f @@ -6303,7 +6303,7 @@ file_names[ 3]: ) ) ;; code offset: 0x4a5 - (br_if $block1 + (br_if $block2 ;; code offset: 0x4a4 (i32.eqz ;; code offset: 0x4a2 @@ -6323,9 +6323,9 @@ file_names[ 3]: (local.get $91) ) ;; code offset: 0x4b2 - (block $block2 + (block $block3 ;; code offset: 0x4b4 - (loop $label1 + (loop $label2 ;; code offset: 0x4bb (local.set $92 ;; code offset: 0x4b8 @@ -6378,7 +6378,7 @@ file_names[ 3]: ) ) ;; code offset: 0x4e1 - (br_if $block2 + (br_if $block3 ;; code offset: 0x4e0 (i32.eqz ;; code offset: 0x4de @@ -6513,7 +6513,7 @@ file_names[ 3]: (local.get $112) ) ;; code offset: 0x54a - (br $label1) + (br $label2) ) ;; code offset: 0x54d (unreachable) @@ -6554,7 +6554,7 @@ file_names[ 3]: (local.get $115) ) ;; code offset: 0x56f - (loop $label3 + (loop $label4 ;; code offset: 0x573 (local.set $116 ;; code offset: 0x571 @@ -6598,9 +6598,9 @@ file_names[ 3]: (local.get $119) ) ;; code offset: 0x595 - (block $block3 + (block $block4 ;; code offset: 0x597 - (loop $label2 + (loop $label3 ;; code offset: 0x59e (local.set $120 ;; code offset: 0x59b @@ -6653,7 +6653,7 @@ file_names[ 3]: ) ) ;; code offset: 0x5c4 - (br_if $block3 + (br_if $block4 ;; code offset: 0x5c3 (i32.eqz ;; code offset: 0x5c1 @@ -6930,7 +6930,7 @@ file_names[ 3]: (local.get $155) ) ;; code offset: 0x6da - (br $label2) + (br $label3) ) ;; code offset: 0x6dd (unreachable) @@ -7101,7 +7101,7 @@ file_names[ 3]: ) ) ;; code offset: 0x78d - (br_if $label3 + (br_if $label4 ;; code offset: 0x78a (local.get $172) ) @@ -7158,9 +7158,9 @@ file_names[ 3]: ) ) ;; code offset: 0x7c5 - (block $block4 + (block $block5 ;; code offset: 0x7cb - (br_if $block4 + (br_if $block5 ;; code offset: 0x7ca (i32.eqz ;; code offset: 0x7c7 @@ -7185,7 +7185,7 @@ file_names[ 3]: ) ) ;; code offset: 0x7df - (loop $label5 + (loop $label6 ;; code offset: 0x7e6 (local.set $181 ;; code offset: 0x7e3 @@ -7253,9 +7253,9 @@ file_names[ 3]: ) ) ;; code offset: 0x825 - (block $block5 + (block $block6 ;; code offset: 0x82b - (br_if $block5 + (br_if $block6 ;; code offset: 0x82a (i32.eqz ;; code offset: 0x827 @@ -7371,9 +7371,9 @@ file_names[ 3]: (local.get $196) ) ;; code offset: 0x89b - (block $block6 + (block $block7 ;; code offset: 0x89d - (loop $label4 + (loop $label5 ;; code offset: 0x8a4 (local.set $199 ;; code offset: 0x8a1 @@ -7426,7 +7426,7 @@ file_names[ 3]: ) ) ;; code offset: 0x8d8 - (br_if $block6 + (br_if $block7 ;; code offset: 0x8d7 (i32.eqz ;; code offset: 0x8d4 @@ -7576,7 +7576,7 @@ file_names[ 3]: (local.get $221) ) ;; code offset: 0x96c - (br $label4) + (br $label5) ) ;; code offset: 0x96f (unreachable) @@ -7749,11 +7749,11 @@ file_names[ 3]: ) ) ;; code offset: 0xa1f - (block $block8 + (block $block9 ;; code offset: 0xa21 - (block $block7 + (block $block8 ;; code offset: 0xa27 - (br_if $block7 + (br_if $block8 ;; code offset: 0xa26 (i32.eqz ;; code offset: 0xa23 @@ -7761,7 +7761,7 @@ file_names[ 3]: ) ) ;; code offset: 0xa29 - (br $block8) + (br $block9) ) ;; code offset: 0xa31 (local.set $242 @@ -7794,11 +7794,11 @@ file_names[ 3]: (local.get $244) ) ;; code offset: 0xa4b - (br $label5) + (br $label6) ) ) ;; code offset: 0xa4f - (br $label6) + (br $label7) ) ) (func $main (param $0 i32) (param $1 i32) (result i32) @@ -7937,7 +7937,7 @@ file_names[ 3]: ) ) ;; code offset: 0xaed - (block $block0 + (block $block1 ;; code offset: 0xaef (block $block ;; code offset: 0xaf4 @@ -7978,7 +7978,7 @@ file_names[ 3]: (local.get $15) ) ;; code offset: 0xb0e - (br $block0) + (br $block1) ) ;; code offset: 0xb13 (local.set $17 @@ -8052,11 +8052,11 @@ file_names[ 3]: ) ) ;; code offset: 0xb4a - (block $block2 + (block $block3 ;; code offset: 0xb4c - (block $block1 + (block $block2 ;; code offset: 0xb51 - (br_if $block1 + (br_if $block2 ;; code offset: 0xb50 (i32.eqz ;; code offset: 0xb4e @@ -8096,7 +8096,7 @@ file_names[ 3]: (local.get $28) ) ;; code offset: 0xb6e - (br $block2) + (br $block3) ) ;; code offset: 0xb76 (local.set $29 @@ -8748,9 +8748,9 @@ file_names[ 3]: (local.get $27) ) ;; code offset: 0xe67 - (block $block0 + (block $block1 ;; code offset: 0xe69 - (loop $label0 + (loop $label1 ;; code offset: 0xe70 (local.set $36 ;; code offset: 0xe6d @@ -8803,7 +8803,7 @@ file_names[ 3]: ) ) ;; code offset: 0xe96 - (br_if $block0 + (br_if $block1 ;; code offset: 0xe95 (i32.eqz ;; code offset: 0xe93 @@ -8897,7 +8897,7 @@ file_names[ 3]: (local.get $51) ) ;; code offset: 0xedf - (br $label0) + (br $label1) ) ;; code offset: 0xee2 (unreachable) @@ -8918,9 +8918,9 @@ file_names[ 3]: (local.get $52) ) ;; code offset: 0xef2 - (block $block4 + (block $block5 ;; code offset: 0xef4 - (loop $label5 + (loop $label6 ;; code offset: 0xefb (local.set $53 ;; code offset: 0xef8 @@ -8930,11 +8930,11 @@ file_names[ 3]: ) ) ;; code offset: 0xefd - (block $block3 + (block $block4 ;; code offset: 0xeff - (block $block1 + (block $block2 ;; code offset: 0xf04 - (br_if $block1 + (br_if $block2 ;; code offset: 0xf03 (i32.eqz ;; code offset: 0xf01 @@ -8954,9 +8954,9 @@ file_names[ 3]: (local.get $54) ) ;; code offset: 0xf11 - (block $block2 + (block $block3 ;; code offset: 0xf13 - (loop $label1 + (loop $label2 ;; code offset: 0xf1a (local.set $55 ;; code offset: 0xf17 @@ -9009,7 +9009,7 @@ file_names[ 3]: ) ) ;; code offset: 0xf40 - (br_if $block2 + (br_if $block3 ;; code offset: 0xf3f (i32.eqz ;; code offset: 0xf3d @@ -9133,7 +9133,7 @@ file_names[ 3]: (local.get $73) ) ;; code offset: 0xfa0 - (br $label1) + (br $label2) ) ;; code offset: 0xfa3 (unreachable) @@ -9189,15 +9189,15 @@ file_names[ 3]: (local.get $78) ) ;; code offset: 0xfce - (br $block3) + (br $block4) ) ;; code offset: 0xfd1 - (br $block4) + (br $block5) ) ;; code offset: 0xfd4 - (block $block5 + (block $block6 ;; code offset: 0xfd6 - (loop $label2 + (loop $label3 ;; code offset: 0xfda (local.set $79 ;; code offset: 0xfd8 @@ -9247,7 +9247,7 @@ file_names[ 3]: ) ) ;; code offset: 0x1000 - (br_if $block5 + (br_if $block6 ;; code offset: 0xfff (i32.eqz ;; code offset: 0xffd @@ -9356,13 +9356,13 @@ file_names[ 3]: (local.get $96) ) ;; code offset: 0x1054 - (br $label2) + (br $label3) ) ;; code offset: 0x1057 (unreachable) ) ;; code offset: 0x1059 - (loop $label4 + (loop $label5 ;; code offset: 0x1060 (local.set $97 ;; code offset: 0x105d @@ -9415,9 +9415,9 @@ file_names[ 3]: ) ) ;; code offset: 0x1083 - (block $block6 + (block $block7 ;; code offset: 0x1088 - (br_if $block6 + (br_if $block7 ;; code offset: 0x1087 (i32.eqz ;; code offset: 0x1085 @@ -9425,7 +9425,7 @@ file_names[ 3]: ) ) ;; code offset: 0x108a - (br $block4) + (br $block5) ) ;; code offset: 0x108f (local.set $104 @@ -9463,9 +9463,9 @@ file_names[ 3]: (local.get $104) ) ;; code offset: 0x10ad - (block $block7 + (block $block8 ;; code offset: 0x10af - (loop $label3 + (loop $label4 ;; code offset: 0x10b6 (local.set $107 ;; code offset: 0x10b3 @@ -9518,7 +9518,7 @@ file_names[ 3]: ) ) ;; code offset: 0x10dc - (br_if $block7 + (br_if $block8 ;; code offset: 0x10db (i32.eqz ;; code offset: 0x10d9 @@ -9668,7 +9668,7 @@ file_names[ 3]: (local.get $129) ) ;; code offset: 0x1154 - (br $label3) + (br $label4) ) ;; code offset: 0x1157 (unreachable) @@ -9841,11 +9841,11 @@ file_names[ 3]: ) ) ;; code offset: 0x1207 - (block $block9 + (block $block10 ;; code offset: 0x1209 - (block $block8 + (block $block9 ;; code offset: 0x120f - (br_if $block8 + (br_if $block9 ;; code offset: 0x120e (i32.eqz ;; code offset: 0x120b @@ -9853,7 +9853,7 @@ file_names[ 3]: ) ) ;; code offset: 0x1211 - (br $block9) + (br $block10) ) ;; code offset: 0x1219 (local.set $150 @@ -9886,11 +9886,11 @@ file_names[ 3]: (local.get $152) ) ;; code offset: 0x1233 - (br $label4) + (br $label5) ) ) ;; code offset: 0x1237 - (br $label5) + (br $label6) ) ;; code offset: 0x123a (unreachable) @@ -9934,9 +9934,9 @@ file_names[ 3]: (local.get $153) ) ;; code offset: 0x1263 - (block $block10 + (block $block11 ;; code offset: 0x1265 - (loop $label6 + (loop $label7 ;; code offset: 0x1269 (local.set $156 ;; code offset: 0x1267 @@ -9986,7 +9986,7 @@ file_names[ 3]: ) ) ;; code offset: 0x129d - (br_if $block10 + (br_if $block11 ;; code offset: 0x129c (i32.eqz ;; code offset: 0x1299 @@ -10068,9 +10068,9 @@ file_names[ 3]: ) ) ;; code offset: 0x12ec - (block $block11 + (block $block12 ;; code offset: 0x12f2 - (br_if $block11 + (br_if $block12 ;; code offset: 0x12f1 (i32.eqz ;; code offset: 0x12ee @@ -10145,7 +10145,7 @@ file_names[ 3]: (local.get $176) ) ;; code offset: 0x133b - (br $label6) + (br $label7) ) ;; code offset: 0x133e (unreachable) diff --git a/test/passes/fannkuch3_dwarf.bin.txt b/test/passes/fannkuch3_dwarf.bin.txt index 2917c4e781a..b2e61acfa7d 100644 --- a/test/passes/fannkuch3_dwarf.bin.txt +++ b/test/passes/fannkuch3_dwarf.bin.txt @@ -4873,9 +4873,9 @@ file_names[ 4]: ) ) ;; code offset: 0x47 - (block $block4 + (block $block5 ;; code offset: 0x49 - (block $block0 + (block $block1 ;; code offset: 0x4b (block $block ;; code offset: 0x52 @@ -4983,7 +4983,7 @@ file_names[ 4]: (i32.const 0) ) ;; code offset: 0x9f - (br_if $block0 + (br_if $block1 ;; code offset: 0x9e (i32.le_s ;; code offset: 0x9a @@ -4993,11 +4993,11 @@ file_names[ 4]: ) ) ;; code offset: 0xa1 - (loop $label4 + (loop $label5 ;; code offset: 0xa3 - (block $block1 + (block $block2 ;; code offset: 0xaa - (br_if $block1 + (br_if $block2 ;; code offset: 0xa9 (i32.le_s ;; code offset: 0xa5 @@ -5007,7 +5007,7 @@ file_names[ 4]: ) ) ;; code offset: 0xac - (loop $label0 + (loop $label1 ;; code offset: 0xbd (i32.store ;; code offset: 0xba @@ -5049,16 +5049,16 @@ file_names[ 4]: (local.get $1) ) ;; code offset: 0xcd - (br_if $label0 + (br_if $label1 ;; code offset: 0xcb (local.get $0) ) ) ) ;; code offset: 0xd1 - (block $block2 + (block $block3 ;; code offset: 0xdb - (br_if $block2 + (br_if $block3 ;; code offset: 0xda (i32.eqz ;; code offset: 0xd8 @@ -5072,7 +5072,7 @@ file_names[ 4]: ) ) ;; code offset: 0xe5 - (br_if $block2 + (br_if $block3 ;; code offset: 0xe4 (i32.eq ;; code offset: 0xdf @@ -5108,16 +5108,16 @@ file_names[ 4]: (i32.const 0) ) ;; code offset: 0xfa - (loop $label2 + (loop $label3 ;; code offset: 0xfe (local.set $13 ;; code offset: 0xfc (local.get $0) ) ;; code offset: 0x100 - (block $block3 + (block $block4 ;; code offset: 0x107 - (br_if $block3 + (br_if $block4 ;; code offset: 0x106 (i32.lt_s ;; code offset: 0x102 @@ -5142,7 +5142,7 @@ file_names[ 4]: (i32.const 1) ) ;; code offset: 0x114 - (loop $label1 + (loop $label2 ;; code offset: 0x123 (local.set $15 ;; code offset: 0x120 @@ -5195,7 +5195,7 @@ file_names[ 4]: (local.get $15) ) ;; code offset: 0x14d - (br_if $label1 + (br_if $label2 ;; code offset: 0x14c (i32.lt_s ;; code offset: 0x143 @@ -5266,7 +5266,7 @@ file_names[ 4]: (local.get $1) ) ;; code offset: 0x174 - (br_if $label2 + (br_if $label3 ;; code offset: 0x172 (local.get $1) ) @@ -5290,7 +5290,7 @@ file_names[ 4]: ) ) ;; code offset: 0x189 - (br_if $block4 + (br_if $block5 ;; code offset: 0x188 (i32.ge_s ;; code offset: 0x184 @@ -5300,16 +5300,16 @@ file_names[ 4]: ) ) ;; code offset: 0x18b - (loop $label5 + (loop $label6 ;; code offset: 0x18f (local.set $1 ;; code offset: 0x18d (i32.const 0) ) ;; code offset: 0x191 - (block $block5 + (block $block6 ;; code offset: 0x198 - (br_if $block5 + (br_if $block6 ;; code offset: 0x197 (i32.le_s ;; code offset: 0x193 @@ -5319,7 +5319,7 @@ file_names[ 4]: ) ) ;; code offset: 0x19a - (loop $label3 + (loop $label4 ;; code offset: 0x1b4 (i32.store ;; code offset: 0x1a3 @@ -5359,7 +5359,7 @@ file_names[ 4]: ) ) ;; code offset: 0x1bc - (br_if $label3 + (br_if $label4 ;; code offset: 0x1bb (i32.ne ;; code offset: 0x1b7 @@ -5424,7 +5424,7 @@ file_names[ 4]: ) ) ;; code offset: 0x1ed - (br_if $label4 + (br_if $label5 ;; code offset: 0x1ec (i32.gt_s ;; code offset: 0x1e8 @@ -5434,7 +5434,7 @@ file_names[ 4]: ) ) ;; code offset: 0x1f9 - (br_if $block4 + (br_if $block5 ;; code offset: 0x1f8 (i32.eq ;; code offset: 0x1f4 @@ -5460,7 +5460,7 @@ file_names[ 4]: ) ) ;; code offset: 0x202 - (br $label5) + (br $label6) ) ;; code offset: 0x205 (unreachable) @@ -5526,11 +5526,11 @@ file_names[ 4]: (i32.const 0) ) ;; code offset: 0x234 - (loop $label10 + (loop $label11 ;; code offset: 0x236 - (block $block6 + (block $block7 ;; code offset: 0x23d - (br_if $block6 + (br_if $block7 ;; code offset: 0x23c (i32.lt_s ;; code offset: 0x238 @@ -5540,7 +5540,7 @@ file_names[ 4]: ) ) ;; code offset: 0x23f - (loop $label6 + (loop $label7 ;; code offset: 0x250 (i32.store ;; code offset: 0x24d @@ -5582,16 +5582,16 @@ file_names[ 4]: (local.get $1) ) ;; code offset: 0x260 - (br_if $label6 + (br_if $label7 ;; code offset: 0x25e (local.get $0) ) ) ) ;; code offset: 0x264 - (block $block7 + (block $block8 ;; code offset: 0x26e - (br_if $block7 + (br_if $block8 ;; code offset: 0x26d (i32.eqz ;; code offset: 0x26b @@ -5605,7 +5605,7 @@ file_names[ 4]: ) ) ;; code offset: 0x278 - (br_if $block7 + (br_if $block8 ;; code offset: 0x277 (i32.eq ;; code offset: 0x272 @@ -5631,16 +5631,16 @@ file_names[ 4]: (i32.const 0) ) ;; code offset: 0x285 - (loop $label8 + (loop $label9 ;; code offset: 0x289 (local.set $10 ;; code offset: 0x287 (local.get $0) ) ;; code offset: 0x28b - (block $block8 + (block $block9 ;; code offset: 0x292 - (br_if $block8 + (br_if $block9 ;; code offset: 0x291 (i32.lt_s ;; code offset: 0x28d @@ -5665,7 +5665,7 @@ file_names[ 4]: (i32.const 1) ) ;; code offset: 0x29f - (loop $label7 + (loop $label8 ;; code offset: 0x2ae (local.set $14 ;; code offset: 0x2ab @@ -5718,7 +5718,7 @@ file_names[ 4]: (local.get $14) ) ;; code offset: 0x2d8 - (br_if $label7 + (br_if $label8 ;; code offset: 0x2d7 (i32.lt_s ;; code offset: 0x2ce @@ -5789,7 +5789,7 @@ file_names[ 4]: (local.get $1) ) ;; code offset: 0x2ff - (br_if $label8 + (br_if $label9 ;; code offset: 0x2fd (local.get $1) ) @@ -5813,7 +5813,7 @@ file_names[ 4]: ) ) ;; code offset: 0x314 - (br_if $block4 + (br_if $block5 ;; code offset: 0x313 (i32.ge_s ;; code offset: 0x30f @@ -5823,16 +5823,16 @@ file_names[ 4]: ) ) ;; code offset: 0x316 - (loop $label11 + (loop $label12 ;; code offset: 0x31a (local.set $1 ;; code offset: 0x318 (i32.const 0) ) ;; code offset: 0x31c - (block $block9 + (block $block10 ;; code offset: 0x323 - (br_if $block9 + (br_if $block10 ;; code offset: 0x322 (i32.lt_s ;; code offset: 0x31e @@ -5842,7 +5842,7 @@ file_names[ 4]: ) ) ;; code offset: 0x325 - (loop $label9 + (loop $label10 ;; code offset: 0x33f (i32.store ;; code offset: 0x32e @@ -5882,7 +5882,7 @@ file_names[ 4]: ) ) ;; code offset: 0x347 - (br_if $label9 + (br_if $label10 ;; code offset: 0x346 (i32.ne ;; code offset: 0x342 @@ -5947,7 +5947,7 @@ file_names[ 4]: ) ) ;; code offset: 0x378 - (br_if $label10 + (br_if $label11 ;; code offset: 0x377 (i32.gt_s ;; code offset: 0x373 @@ -5957,7 +5957,7 @@ file_names[ 4]: ) ) ;; code offset: 0x384 - (br_if $block4 + (br_if $block5 ;; code offset: 0x383 (i32.eq ;; code offset: 0x37f @@ -5983,7 +5983,7 @@ file_names[ 4]: ) ) ;; code offset: 0x38d - (br $label11) + (br $label12) ) ;; code offset: 0x390 (unreachable) @@ -6031,9 +6031,9 @@ file_names[ 4]: ) ) ;; code offset: 0x3bd - (block $block1 + (block $block2 ;; code offset: 0x3bf - (block $block0 + (block $block1 ;; code offset: 0x3c1 (block $block ;; code offset: 0x3c8 @@ -6052,7 +6052,7 @@ file_names[ 4]: (i32.const 0) ) ;; code offset: 0x3da - (br_if $block0 + (br_if $block1 ;; code offset: 0x3d9 (i32.gt_s ;; code offset: 0x3d5 @@ -6085,12 +6085,12 @@ file_names[ 4]: (i32.const 1) ) ;; code offset: 0x3e7 - (br $block1) + (br $block2) ) ;; code offset: 0x3ea - (block $block2 + (block $block3 ;; code offset: 0x3f1 - (br_if $block2 + (br_if $block3 ;; code offset: 0x3f0 (i32.eq ;; code offset: 0x3ec @@ -6203,15 +6203,15 @@ file_names[ 4]: ) ) ;; code offset: 0x444 - (block $block7 + (block $block8 ;; code offset: 0x446 - (block $block5 + (block $block6 ;; code offset: 0x448 - (block $block4 + (block $block5 ;; code offset: 0x44a - (block $block3 + (block $block4 ;; code offset: 0x451 - (br_if $block3 + (br_if $block4 ;; code offset: 0x450 (i32.le_s ;; code offset: 0x44c @@ -6221,7 +6221,7 @@ file_names[ 4]: ) ) ;; code offset: 0x453 - (loop $label0 + (loop $label1 ;; code offset: 0x45f (i32.store ;; code offset: 0x45c @@ -6240,7 +6240,7 @@ file_names[ 4]: (local.get $0) ) ;; code offset: 0x46c - (br_if $label0 + (br_if $label1 ;; code offset: 0x46b (i32.ne ;; code offset: 0x467 @@ -6269,7 +6269,7 @@ file_names[ 4]: (local.get $4) ) ;; code offset: 0x477 - (br $block4) + (br $block5) ) ;; code offset: 0x47c (local.set $7 @@ -6282,17 +6282,17 @@ file_names[ 4]: (local.get $4) ) ;; code offset: 0x482 - (br $block5) + (br $block6) ) ;; code offset: 0x485 - (loop $label5 + (loop $label6 ;; code offset: 0x489 (local.set $0 ;; code offset: 0x487 (i32.const 0) ) ;; code offset: 0x48b - (loop $label1 + (loop $label2 ;; code offset: 0x49d (i32.store offset=16 ;; code offset: 0x48d @@ -6334,7 +6334,7 @@ file_names[ 4]: ) ) ;; code offset: 0x4b5 - (br_if $label1 + (br_if $label2 ;; code offset: 0x4b4 (i32.ne ;; code offset: 0x4b0 @@ -6361,9 +6361,9 @@ file_names[ 4]: ) ) ;; code offset: 0x4bd - (block $block6 + (block $block7 ;; code offset: 0x4c4 - (br_if $block6 + (br_if $block7 ;; code offset: 0x4c3 (i32.le_s ;; code offset: 0x4bf @@ -6373,7 +6373,7 @@ file_names[ 4]: ) ) ;; code offset: 0x4c6 - (loop $label2 + (loop $label3 ;; code offset: 0x4d7 (i32.store ;; code offset: 0x4d4 @@ -6415,14 +6415,14 @@ file_names[ 4]: (local.get $0) ) ;; code offset: 0x4e7 - (br_if $label2 + (br_if $label3 ;; code offset: 0x4e5 (local.get $8) ) ) ) ;; code offset: 0x4f0 - (br_if $block7 + (br_if $block8 ;; code offset: 0x4ef (i32.eq ;; code offset: 0x4eb @@ -6442,7 +6442,7 @@ file_names[ 4]: ) ) ;; code offset: 0x4f9 - (loop $label4 + (loop $label5 ;; code offset: 0x4fd (local.set $0 ;; code offset: 0x4fb @@ -6457,9 +6457,9 @@ file_names[ 4]: ) ) ;; code offset: 0x506 - (block $block8 + (block $block9 ;; code offset: 0x50d - (br_if $block8 + (br_if $block9 ;; code offset: 0x50c (i32.le_s ;; code offset: 0x508 @@ -6469,7 +6469,7 @@ file_names[ 4]: ) ) ;; code offset: 0x50f - (loop $label3 + (loop $label4 ;; code offset: 0x529 (i32.store ;; code offset: 0x518 @@ -6509,7 +6509,7 @@ file_names[ 4]: ) ) ;; code offset: 0x531 - (br_if $label3 + (br_if $label4 ;; code offset: 0x530 (i32.ne ;; code offset: 0x52c @@ -6574,9 +6574,9 @@ file_names[ 4]: ) ) ;; code offset: 0x55d - (block $block9 + (block $block10 ;; code offset: 0x564 - (br_if $block9 + (br_if $block10 ;; code offset: 0x563 (i32.gt_s ;; code offset: 0x55f @@ -6586,7 +6586,7 @@ file_names[ 4]: ) ) ;; code offset: 0x570 - (br_if $label4 + (br_if $label5 ;; code offset: 0x56f (i32.ne ;; code offset: 0x56b @@ -6604,11 +6604,11 @@ file_names[ 4]: ) ) ;; code offset: 0x572 - (br $block7) + (br $block8) ) ) ;; code offset: 0x579 - (br_if $block7 + (br_if $block8 ;; code offset: 0x578 (i32.eqz ;; code offset: 0x576 @@ -6616,13 +6616,13 @@ file_names[ 4]: ) ) ;; code offset: 0x57b - (br $label5) + (br $label6) ) ;; code offset: 0x57e (unreachable) ) ;; code offset: 0x580 - (loop $label9 + (loop $label10 ;; code offset: 0x586 (drop ;; code offset: 0x584 @@ -6632,9 +6632,9 @@ file_names[ 4]: ) ) ;; code offset: 0x587 - (block $block10 + (block $block11 ;; code offset: 0x58e - (br_if $block10 + (br_if $block11 ;; code offset: 0x58d (i32.le_s ;; code offset: 0x589 @@ -6644,7 +6644,7 @@ file_names[ 4]: ) ) ;; code offset: 0x590 - (loop $label6 + (loop $label7 ;; code offset: 0x5a1 (i32.store ;; code offset: 0x59e @@ -6686,14 +6686,14 @@ file_names[ 4]: (local.get $0) ) ;; code offset: 0x5b1 - (br_if $label6 + (br_if $label7 ;; code offset: 0x5af (local.get $8) ) ) ) ;; code offset: 0x5ba - (br_if $block7 + (br_if $block8 ;; code offset: 0x5b9 (i32.eq ;; code offset: 0x5b5 @@ -6713,7 +6713,7 @@ file_names[ 4]: ) ) ;; code offset: 0x5c3 - (loop $label8 + (loop $label9 ;; code offset: 0x5ca (local.set $8 ;; code offset: 0x5c7 @@ -6728,9 +6728,9 @@ file_names[ 4]: (i32.const 0) ) ;; code offset: 0x5d0 - (block $block11 + (block $block12 ;; code offset: 0x5d7 - (br_if $block11 + (br_if $block12 ;; code offset: 0x5d6 (i32.lt_s ;; code offset: 0x5d2 @@ -6740,7 +6740,7 @@ file_names[ 4]: ) ) ;; code offset: 0x5d9 - (loop $label7 + (loop $label8 ;; code offset: 0x5f3 (i32.store ;; code offset: 0x5e2 @@ -6780,7 +6780,7 @@ file_names[ 4]: ) ) ;; code offset: 0x5fb - (br_if $label7 + (br_if $label8 ;; code offset: 0x5fa (i32.ne ;; code offset: 0x5f6 @@ -6845,9 +6845,9 @@ file_names[ 4]: ) ) ;; code offset: 0x627 - (block $block12 + (block $block13 ;; code offset: 0x62e - (br_if $block12 + (br_if $block13 ;; code offset: 0x62d (i32.gt_s ;; code offset: 0x629 @@ -6857,7 +6857,7 @@ file_names[ 4]: ) ) ;; code offset: 0x63a - (br_if $label8 + (br_if $label9 ;; code offset: 0x639 (i32.ne ;; code offset: 0x635 @@ -6875,11 +6875,11 @@ file_names[ 4]: ) ) ;; code offset: 0x63c - (br $block7) + (br $block8) ) ) ;; code offset: 0x642 - (br_if $label9 + (br_if $label10 ;; code offset: 0x640 (local.get $7) ) @@ -6906,9 +6906,9 @@ file_names[ 4]: (i32.const 0) ) ;; code offset: 0x656 - (block $block13 + (block $block14 ;; code offset: 0x65b - (br_if $block13 + (br_if $block14 ;; code offset: 0x65a (i32.eqz ;; code offset: 0x658 @@ -6921,7 +6921,7 @@ file_names[ 4]: (i32.const 0) ) ;; code offset: 0x661 - (loop $label10 + (loop $label11 ;; code offset: 0x667 (local.set $1 ;; code offset: 0x665 @@ -6966,7 +6966,7 @@ file_names[ 4]: (local.get $6) ) ;; code offset: 0x686 - (br_if $label10 + (br_if $label11 ;; code offset: 0x684 (local.get $6) ) diff --git a/test/passes/fannkuch3_manyopts_dwarf.bin.txt b/test/passes/fannkuch3_manyopts_dwarf.bin.txt index 8c57326f569..6feceabfffc 100644 --- a/test/passes/fannkuch3_manyopts_dwarf.bin.txt +++ b/test/passes/fannkuch3_manyopts_dwarf.bin.txt @@ -4751,7 +4751,7 @@ file_names[ 4]: ) ) ;; code offset: 0x43 - (block $block1 + (block $block2 ;; code offset: 0x45 (block $block ;; code offset: 0x4c @@ -4864,7 +4864,7 @@ file_names[ 4]: ) ) ;; code offset: 0x97 - (loop $label4 + (loop $label5 ;; code offset: 0x9e (if ;; code offset: 0x9d @@ -4876,7 +4876,7 @@ file_names[ 4]: ) (then ;; code offset: 0xa0 - (loop $label0 + (loop $label1 ;; code offset: 0xb1 (i32.store ;; code offset: 0xae @@ -4902,7 +4902,7 @@ file_names[ 4]: ;; code offset: 0xaf (local.get $2) ) - (br_if $label0 + (br_if $label1 (block (result i32) (local.set $scratch ;; code offset: 0xb8 @@ -4926,9 +4926,9 @@ file_names[ 4]: ) ) ;; code offset: 0xc1 - (block $block0 + (block $block1 ;; code offset: 0xcb - (br_if $block0 + (br_if $block1 ;; code offset: 0xca (i32.eqz ;; code offset: 0xc8 @@ -4942,7 +4942,7 @@ file_names[ 4]: ) ) ;; code offset: 0xd5 - (br_if $block0 + (br_if $block1 ;; code offset: 0xd4 (i32.eq ;; code offset: 0xcf @@ -4978,7 +4978,7 @@ file_names[ 4]: (i32.const 0) ) ;; code offset: 0xea - (loop $label2 + (loop $label3 ;; code offset: 0xee (local.set $16 ;; code offset: 0xec @@ -5010,7 +5010,7 @@ file_names[ 4]: (i32.const 1) ) ;; code offset: 0x102 - (loop $label1 + (loop $label2 ;; code offset: 0x111 (local.set $15 ;; code offset: 0x10e @@ -5063,7 +5063,7 @@ file_names[ 4]: (local.get $15) ) ;; code offset: 0x13b - (br_if $label1 + (br_if $label2 ;; code offset: 0x13a (i32.lt_s ;; code offset: 0x131 @@ -5135,7 +5135,7 @@ file_names[ 4]: (local.get $1) ) ;; code offset: 0x162 - (br_if $label2 + (br_if $label3 ;; code offset: 0x160 (local.get $1) ) @@ -5159,7 +5159,7 @@ file_names[ 4]: ) ) ;; code offset: 0x177 - (br_if $block1 + (br_if $block2 ;; code offset: 0x176 (i32.ge_s ;; code offset: 0x172 @@ -5169,7 +5169,7 @@ file_names[ 4]: ) ) ;; code offset: 0x179 - (loop $label5 + (loop $label6 ;; code offset: 0x17d (local.set $1 ;; code offset: 0x17b @@ -5186,7 +5186,7 @@ file_names[ 4]: ) (then ;; code offset: 0x186 - (loop $label3 + (loop $label4 ;; code offset: 0x1a0 (i32.store ;; code offset: 0x18f @@ -5226,7 +5226,7 @@ file_names[ 4]: ) ) ;; code offset: 0x1a8 - (br_if $label3 + (br_if $label4 ;; code offset: 0x1a7 (i32.ne ;; code offset: 0x1a3 @@ -5292,7 +5292,7 @@ file_names[ 4]: ) ) ;; code offset: 0x1d9 - (br_if $label4 + (br_if $label5 ;; code offset: 0x1d8 (i32.gt_s ;; code offset: 0x1d4 @@ -5302,7 +5302,7 @@ file_names[ 4]: ) ) ;; code offset: 0x1e5 - (br_if $block1 + (br_if $block2 ;; code offset: 0x1e4 (i32.eq ;; code offset: 0x1e0 @@ -5328,7 +5328,7 @@ file_names[ 4]: ) ) ;; code offset: 0x1ee - (br $label5) + (br $label6) ) ;; code offset: 0x1f1 (unreachable) @@ -5390,7 +5390,7 @@ file_names[ 4]: ) ) ;; code offset: 0x21c - (loop $label10 + (loop $label11 ;; code offset: 0x223 (if ;; code offset: 0x222 @@ -5402,7 +5402,7 @@ file_names[ 4]: ) (then ;; code offset: 0x225 - (loop $label6 + (loop $label7 ;; code offset: 0x236 (i32.store ;; code offset: 0x233 @@ -5428,7 +5428,7 @@ file_names[ 4]: ;; code offset: 0x234 (local.get $2) ) - (br_if $label6 + (br_if $label7 (block (result i32) (local.set $scratch_18 ;; code offset: 0x23d @@ -5452,9 +5452,9 @@ file_names[ 4]: ) ) ;; code offset: 0x246 - (block $block2 + (block $block3 ;; code offset: 0x250 - (br_if $block2 + (br_if $block3 ;; code offset: 0x24f (i32.eqz ;; code offset: 0x24d @@ -5468,7 +5468,7 @@ file_names[ 4]: ) ) ;; code offset: 0x25a - (br_if $block2 + (br_if $block3 ;; code offset: 0x259 (i32.eq ;; code offset: 0x254 @@ -5494,7 +5494,7 @@ file_names[ 4]: (i32.const 0) ) ;; code offset: 0x267 - (loop $label8 + (loop $label9 ;; code offset: 0x26b (local.set $10 ;; code offset: 0x269 @@ -5526,7 +5526,7 @@ file_names[ 4]: (i32.const 1) ) ;; code offset: 0x27f - (loop $label7 + (loop $label8 ;; code offset: 0x28e (local.set $14 ;; code offset: 0x28b @@ -5579,7 +5579,7 @@ file_names[ 4]: (local.get $14) ) ;; code offset: 0x2b8 - (br_if $label7 + (br_if $label8 ;; code offset: 0x2b7 (i32.lt_s ;; code offset: 0x2ae @@ -5651,7 +5651,7 @@ file_names[ 4]: (local.get $1) ) ;; code offset: 0x2df - (br_if $label8 + (br_if $label9 ;; code offset: 0x2dd (local.get $1) ) @@ -5675,7 +5675,7 @@ file_names[ 4]: ) ) ;; code offset: 0x2f4 - (br_if $block1 + (br_if $block2 ;; code offset: 0x2f3 (i32.ge_s ;; code offset: 0x2ef @@ -5685,7 +5685,7 @@ file_names[ 4]: ) ) ;; code offset: 0x2f6 - (loop $label11 + (loop $label12 ;; code offset: 0x2fa (local.set $1 ;; code offset: 0x2f8 @@ -5702,7 +5702,7 @@ file_names[ 4]: ) (then ;; code offset: 0x303 - (loop $label9 + (loop $label10 ;; code offset: 0x31d (i32.store ;; code offset: 0x30c @@ -5742,7 +5742,7 @@ file_names[ 4]: ) ) ;; code offset: 0x325 - (br_if $label9 + (br_if $label10 ;; code offset: 0x324 (i32.ne ;; code offset: 0x320 @@ -5808,7 +5808,7 @@ file_names[ 4]: ) ) ;; code offset: 0x356 - (br_if $label10 + (br_if $label11 ;; code offset: 0x355 (i32.gt_s ;; code offset: 0x351 @@ -5818,7 +5818,7 @@ file_names[ 4]: ) ) ;; code offset: 0x362 - (br_if $block1 + (br_if $block2 ;; code offset: 0x361 (i32.eq ;; code offset: 0x35d @@ -5844,7 +5844,7 @@ file_names[ 4]: ) ) ;; code offset: 0x36b - (br $label11) + (br $label12) ) ;; code offset: 0x36e (unreachable) @@ -5894,7 +5894,7 @@ file_names[ 4]: ) ) ;; code offset: 0x39b - (block $block0 + (block $block1 ;; code offset: 0x39d (block $block ;; code offset: 0x3a4 @@ -5942,7 +5942,7 @@ file_names[ 4]: (i32.const 1) ) ;; code offset: 0x3bf - (br $block0) + (br $block1) ) ;; code offset: 0x3c7 (if @@ -6059,11 +6059,11 @@ file_names[ 4]: ) ) ;; code offset: 0x41a - (block $block3 + (block $block4 ;; code offset: 0x41c - (block $block2 + (block $block3 ;; code offset: 0x41e - (block $block1 + (block $block2 ;; code offset: 0x425 (if ;; code offset: 0x424 @@ -6075,7 +6075,7 @@ file_names[ 4]: ) (then ;; code offset: 0x427 - (loop $label0 + (loop $label1 ;; code offset: 0x433 (i32.store ;; code offset: 0x430 @@ -6094,7 +6094,7 @@ file_names[ 4]: (local.get $0) ) ;; code offset: 0x440 - (br_if $label0 + (br_if $label1 ;; code offset: 0x43f (i32.ne ;; code offset: 0x43b @@ -6123,7 +6123,7 @@ file_names[ 4]: (local.get $3) ) ;; code offset: 0x44b - (br $block1) + (br $block2) ) ) ;; code offset: 0x450 @@ -6137,17 +6137,17 @@ file_names[ 4]: (local.get $3) ) ;; code offset: 0x456 - (br $block2) + (br $block3) ) ;; code offset: 0x459 - (loop $label5 + (loop $label6 ;; code offset: 0x45d (local.set $0 ;; code offset: 0x45b (i32.const 0) ) ;; code offset: 0x45f - (loop $label1 + (loop $label2 ;; code offset: 0x471 (i32.store offset=16 ;; code offset: 0x461 @@ -6189,7 +6189,7 @@ file_names[ 4]: ) ) ;; code offset: 0x489 - (br_if $label1 + (br_if $label2 ;; code offset: 0x488 (i32.ne ;; code offset: 0x484 @@ -6226,7 +6226,7 @@ file_names[ 4]: ) (then ;; code offset: 0x498 - (loop $label2 + (loop $label3 ;; code offset: 0x4a9 (i32.store ;; code offset: 0x4a6 @@ -6252,7 +6252,7 @@ file_names[ 4]: ;; code offset: 0x4a7 (local.get $2) ) - (br_if $label2 + (br_if $label3 (block (result i32) (local.set $scratch ;; code offset: 0x4b0 @@ -6276,7 +6276,7 @@ file_names[ 4]: ) ) ;; code offset: 0x4be - (br_if $block3 + (br_if $block4 ;; code offset: 0x4bd (i32.eq ;; code offset: 0x4b9 @@ -6296,7 +6296,7 @@ file_names[ 4]: ) ) ;; code offset: 0x4c7 - (loop $label4 + (loop $label5 ;; code offset: 0x4cb (local.set $0 ;; code offset: 0x4c9 @@ -6321,7 +6321,7 @@ file_names[ 4]: ) (then ;; code offset: 0x4db - (loop $label3 + (loop $label4 ;; code offset: 0x4f5 (i32.store ;; code offset: 0x4e4 @@ -6361,7 +6361,7 @@ file_names[ 4]: ) ) ;; code offset: 0x4fd - (br_if $label3 + (br_if $label4 ;; code offset: 0x4fc (i32.ne ;; code offset: 0x4f8 @@ -6437,7 +6437,7 @@ file_names[ 4]: ) (then ;; code offset: 0x53a - (br_if $label4 + (br_if $label5 ;; code offset: 0x539 (i32.ne ;; code offset: 0x535 @@ -6455,21 +6455,21 @@ file_names[ 4]: ) ) ;; code offset: 0x53c - (br $block3) + (br $block4) ) ) ) ;; code offset: 0x542 - (br_if $label5 + (br_if $label6 ;; code offset: 0x540 (local.get $6) ) ) ;; code offset: 0x545 - (br $block3) + (br $block4) ) ;; code offset: 0x548 - (loop $label9 + (loop $label10 ;; code offset: 0x54e (drop ;; code offset: 0x54c @@ -6489,7 +6489,7 @@ file_names[ 4]: ) (then ;; code offset: 0x556 - (loop $label6 + (loop $label7 ;; code offset: 0x567 (i32.store ;; code offset: 0x564 @@ -6515,7 +6515,7 @@ file_names[ 4]: ;; code offset: 0x565 (local.get $2) ) - (br_if $label6 + (br_if $label7 (block (result i32) (local.set $scratch_10 ;; code offset: 0x56e @@ -6539,7 +6539,7 @@ file_names[ 4]: ) ) ;; code offset: 0x57c - (br_if $block3 + (br_if $block4 ;; code offset: 0x57b (i32.eq ;; code offset: 0x577 @@ -6559,7 +6559,7 @@ file_names[ 4]: ) ) ;; code offset: 0x585 - (loop $label8 + (loop $label9 ;; code offset: 0x58c (local.set $7 ;; code offset: 0x589 @@ -6584,7 +6584,7 @@ file_names[ 4]: ) (then ;; code offset: 0x599 - (loop $label7 + (loop $label8 ;; code offset: 0x5b3 (i32.store ;; code offset: 0x5a2 @@ -6624,7 +6624,7 @@ file_names[ 4]: ) ) ;; code offset: 0x5bb - (br_if $label7 + (br_if $label8 ;; code offset: 0x5ba (i32.ne ;; code offset: 0x5b6 @@ -6700,7 +6700,7 @@ file_names[ 4]: ) (then ;; code offset: 0x5f8 - (br_if $label8 + (br_if $label9 ;; code offset: 0x5f7 (i32.ne ;; code offset: 0x5f3 @@ -6718,12 +6718,12 @@ file_names[ 4]: ) ) ;; code offset: 0x5fa - (br $block3) + (br $block4) ) ) ) ;; code offset: 0x600 - (br_if $label9 + (br_if $label10 ;; code offset: 0x5fe (local.get $6) ) @@ -6755,7 +6755,7 @@ file_names[ 4]: (local.get $4) (then ;; code offset: 0x618 - (loop $label10 + (loop $label11 ;; code offset: 0x61e (local.set $1 ;; code offset: 0x61c @@ -6800,7 +6800,7 @@ file_names[ 4]: (local.get $2) ) ;; code offset: 0x63d - (br_if $label10 + (br_if $label11 ;; code offset: 0x63b (local.get $2) ) diff --git a/test/passes/reverse_dwarf_abbrevs.bin.txt b/test/passes/reverse_dwarf_abbrevs.bin.txt index 5c2bcfc3f53..7b3a5aaad2e 100644 --- a/test/passes/reverse_dwarf_abbrevs.bin.txt +++ b/test/passes/reverse_dwarf_abbrevs.bin.txt @@ -292,9 +292,9 @@ file_names[ 1]: ;; code offset: 0x18d (local.set $4 ;; code offset: 0x89 - (block $block1 (result i32) + (block $block2 (result i32) ;; code offset: 0x8b - (block $block0 + (block $block1 ;; code offset: 0x8d (block $block ;; code offset: 0xa5 @@ -349,7 +349,7 @@ file_names[ 1]: ) ) ;; code offset: 0xba - (br_if $block0 + (br_if $block1 ;; code offset: 0xb9 (i32.le_s ;; code offset: 0xb5 @@ -517,7 +517,7 @@ file_names[ 1]: (i32.const -1) ) ;; code offset: 0x135 - (br_if $block0 + (br_if $block1 ;; code offset: 0x134 (i32.ne ;; code offset: 0x130 @@ -563,7 +563,7 @@ file_names[ 1]: ) ) ;; code offset: 0x15a - (br $block1 + (br $block2 ;; code offset: 0x158 (local.get $2) ) @@ -600,7 +600,7 @@ file_names[ 1]: ;; code offset: 0x183 (drop ;; code offset: 0x181 - (br_if $block1 + (br_if $block2 ;; code offset: 0x17a (local.tee $4 ;; code offset: 0x178 @@ -797,7 +797,7 @@ file_names[ 1]: ) ) ;; code offset: 0x222 - (block $block1 + (block $block2 ;; code offset: 0x22d (if ;; code offset: 0x22c @@ -917,9 +917,9 @@ file_names[ 1]: ) ) ;; code offset: 0x27a - (block $block0 + (block $block1 ;; code offset: 0x287 - (br_if $block0 + (br_if $block1 ;; code offset: 0x286 (i32.lt_u ;; code offset: 0x281 @@ -937,7 +937,7 @@ file_names[ 1]: ) ) ;; code offset: 0x293 - (br_if $block0 + (br_if $block1 ;; code offset: 0x292 (i32.gt_u ;; code offset: 0x289 @@ -955,7 +955,7 @@ file_names[ 1]: ) ) ;; code offset: 0x295 - (loop $label0 + (loop $label1 ;; code offset: 0x29e (i32.store ;; code offset: 0x297 @@ -1127,7 +1127,7 @@ file_names[ 1]: ) ) ;; code offset: 0x348 - (br_if $label0 + (br_if $label1 ;; code offset: 0x347 (i32.le_u ;; code offset: 0x343 @@ -1147,7 +1147,7 @@ file_names[ 1]: ) ) ;; code offset: 0x351 - (br_if $block1 + (br_if $block2 ;; code offset: 0x350 (i32.ge_u ;; code offset: 0x34c @@ -1157,7 +1157,7 @@ file_names[ 1]: ) ) ;; code offset: 0x353 - (loop $label1 + (loop $label2 ;; code offset: 0x35c (i32.store ;; code offset: 0x355 @@ -1179,7 +1179,7 @@ file_names[ 1]: ) ) ;; code offset: 0x370 - (br_if $label1 + (br_if $label2 ;; code offset: 0x36f (i32.lt_u ;; code offset: 0x36b @@ -1198,7 +1198,7 @@ file_names[ 1]: ) ) ;; code offset: 0x373 - (br $block1) + (br $block2) ) ) ;; code offset: 0x37b @@ -1217,7 +1217,7 @@ file_names[ 1]: (local.get $0) ) ;; code offset: 0x381 - (br $block1) + (br $block2) ) ) ;; code offset: 0x38e @@ -1244,7 +1244,7 @@ file_names[ 1]: (local.get $0) ) ;; code offset: 0x394 - (br $block1) + (br $block2) ) ) ;; code offset: 0x399 @@ -1253,7 +1253,7 @@ file_names[ 1]: (local.get $0) ) ;; code offset: 0x39b - (loop $label2 + (loop $label3 ;; code offset: 0x3a4 (i32.store8 ;; code offset: 0x39d @@ -1305,7 +1305,7 @@ file_names[ 1]: ) ) ;; code offset: 0x3d6 - (br_if $label2 + (br_if $label3 ;; code offset: 0x3d5 (i32.le_u ;; code offset: 0x3d1 @@ -1335,7 +1335,7 @@ file_names[ 1]: ) (then ;; code offset: 0x3e1 - (loop $label3 + (loop $label4 ;; code offset: 0x3ea (i32.store8 ;; code offset: 0x3e3 @@ -1357,7 +1357,7 @@ file_names[ 1]: ) ) ;; code offset: 0x3fe - (br_if $label3 + (br_if $label4 ;; code offset: 0x3fd (i32.ne ;; code offset: 0x3f9 @@ -1460,9 +1460,9 @@ file_names[ 1]: ) ) ;; code offset: 0x449 - (block $block0 + (block $block1 ;; code offset: 0x453 - (br_if $block0 + (br_if $block1 ;; code offset: 0x452 (i32.lt_s ;; code offset: 0x44d @@ -1482,7 +1482,7 @@ file_names[ 1]: ;; code offset: 0x459 (loop $label ;; code offset: 0x460 - (br_if $block0 + (br_if $block1 ;; code offset: 0x45f (i32.eqz ;; code offset: 0x45d @@ -1825,9 +1825,9 @@ file_names[ 1]: ) ) ;; code offset: 0x56d - (block $block0 + (block $block1 ;; code offset: 0x579 - (br_if $block0 + (br_if $block1 ;; code offset: 0x578 (i32.ge_u ;; code offset: 0x574 @@ -1843,7 +1843,7 @@ file_names[ 1]: ) ) ;; code offset: 0x589 - (br_if $block0 + (br_if $block1 ;; code offset: 0x588 (i32.eq ;; code offset: 0x581 @@ -1996,9 +1996,9 @@ file_names[ 1]: ) ) ;; code offset: 0x5f8 - (block $block0 + (block $block1 ;; code offset: 0x602 - (br_if $block0 + (br_if $block1 ;; code offset: 0x601 (i32.eq ;; code offset: 0x5fc @@ -2011,7 +2011,7 @@ file_names[ 1]: ) ) ;; code offset: 0x611 - (br_if $block0 + (br_if $block1 ;; code offset: 0x610 (i32.ge_u ;; code offset: 0x609 @@ -2101,7 +2101,7 @@ file_names[ 1]: (local.get $0) ) ;; code offset: 0x657 - (block $block0 + (block $block1 ;; code offset: 0x659 (block $block ;; code offset: 0x661 @@ -2168,10 +2168,10 @@ file_names[ 1]: ) ) ;; code offset: 0x686 - (br $block0) + (br $block1) ) ;; code offset: 0x689 - (loop $label0 + (loop $label1 ;; code offset: 0x692 (local.set $1 ;; code offset: 0x691 @@ -2186,7 +2186,7 @@ file_names[ 1]: ) ) ;; code offset: 0x6af - (br_if $label0 + (br_if $label1 ;; code offset: 0x6ae (i32.eqz ;; code offset: 0x6ad @@ -2246,7 +2246,7 @@ file_names[ 1]: ) ) ;; code offset: 0x6c2 - (loop $label1 + (loop $label2 ;; code offset: 0x6c9 (local.set $3 ;; code offset: 0x6c6 @@ -2269,7 +2269,7 @@ file_names[ 1]: ) ) ;; code offset: 0x6d6 - (br_if $label1 + (br_if $label2 ;; code offset: 0x6d4 (local.get $3) ) From f4695a20dea351c7e32f643900e64b28158f66ff Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Mon, 18 Nov 2024 14:44:57 -0800 Subject: [PATCH 29/56] improve comment --- src/passes/Outlining.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/passes/Outlining.cpp b/src/passes/Outlining.cpp index 85abb57e422..b86e6cd17e1 100644 --- a/src/passes/Outlining.cpp +++ b/src/passes/Outlining.cpp @@ -305,9 +305,10 @@ struct Outlining : public Pass { // the outlining lit tests far more readable. moveOutlinedFunctions(module, substrings.size()); - // Because we visit control flow in an odd order, IRBuilder is not able to - // properly track branches, so it may not have finalized blocks with the - // correct types. ReFinalize now to fix any issues. + // Because we visit control flow in stringified order rather than normal + // postorder, IRBuilder is not able to properly track branches, so it may + // not have finalized blocks with the correct types. ReFinalize now to fix + // any issues. PassRunner runner(getPassRunner()); runner.add(std::make_unique()); runner.run(); From a1c930c232d4e420cd224deba8f5afc7384d7cb3 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Mon, 18 Nov 2024 16:44:56 -0800 Subject: [PATCH 30/56] remove debug logging --- src/wasm-binary.h | 2 +- src/wasm/wasm-binary.cpp | 6 ------ src/wasm/wasm-ir-builder.cpp | 17 ----------------- 3 files changed, 1 insertion(+), 24 deletions(-) diff --git a/src/wasm-binary.h b/src/wasm-binary.h index 470857e9223..7d928c3e6eb 100644 --- a/src/wasm-binary.h +++ b/src/wasm-binary.h @@ -1572,7 +1572,7 @@ class WasmBinaryReader { void readVars(); void setLocalNames(Function& func, Index i); - [[nodiscard]] Result<> readInst(); + Result<> readInst(); void readExports(); diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index 3ffd7e456c4..7ebb401c1f2 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -1825,7 +1825,6 @@ void WasmBinaryReader::read() { break; case BinaryConsts::Section::Code: if (DWARF) { - // std::cerr << "code section at " << pos << '\n'; codeSectionLocation = pos; } readFunctions(); @@ -2799,11 +2798,6 @@ void WasmBinaryReader::readFunctions() { currFunction = func.get(); if (DWARF) { - // std::cerr << "function location " << - // (sizePos - codeSectionLocation) << ", " << - // (pos - codeSectionLocation) << ", " << - // (pos - codeSectionLocation + size) << "\n"; - func->funcLocation = BinaryLocations::FunctionLocations{ BinaryLocation(sizePos - codeSectionLocation), BinaryLocation(pos - codeSectionLocation), diff --git a/src/wasm/wasm-ir-builder.cpp b/src/wasm/wasm-ir-builder.cpp index e9b75ba985a..c960c9b1ee4 100644 --- a/src/wasm/wasm-ir-builder.cpp +++ b/src/wasm/wasm-ir-builder.cpp @@ -151,10 +151,6 @@ void IRBuilder::push(Expression* expr) { applyDebugLoc(expr); if (binaryPos && func && lastBinaryPos != *binaryPos) { - // std::cerr << "recording expression " << ShallowExpression{expr} << " at - // [" - // << (lastBinaryPos - codeSectionOffset) << ", " - // << (*binaryPos - codeSectionOffset) << "]\n"; func->expressionLocations[expr] = BinaryLocations::Span{BinaryLocation(lastBinaryPos - codeSectionOffset), BinaryLocation(*binaryPos - codeSectionOffset)}; @@ -709,9 +705,6 @@ Result<> IRBuilder::visitSwitchWithType(Switch* curr, Type type) { } Result<> IRBuilder::visitFunctionStart(Function* func) { - // std::cerr << "visiting function start at " << (binaryPos ? *binaryPos : - // 666) - // << "\n"; if (!scopeStack.empty()) { return Err{"unexpected start of function"}; } @@ -861,9 +854,6 @@ Result<> IRBuilder::visitElse() { iff->ifTrue = *expr; if (binaryPos && func) { - // std::cerr << "recording delimiter for " << ShallowExpression{iff} << " at - // " - // << (lastBinaryPos - codeSectionOffset) << '\n'; func->delimiterLocations[iff][BinaryLocations::Else] = lastBinaryPos - codeSectionOffset; } @@ -897,9 +887,6 @@ Result<> IRBuilder::visitCatch(Name tag) { tryy->catchTags.push_back(tag); if (binaryPos && func) { - // std::cerr << "recording delimiter for " << ShallowExpression{tryy} << " - // at " - // << (lastBinaryPos - codeSectionOffset) << '\n'; auto& delimiterLocs = func->delimiterLocations[tryy]; delimiterLocs[delimiterLocs.size()] = lastBinaryPos - codeSectionOffset; } @@ -942,9 +929,6 @@ Result<> IRBuilder::visitCatchAll() { } if (binaryPos && func) { - // std::cerr << "recording delimiter for " << ShallowExpression{tryy} << " - // at " - // << (lastBinaryPos - codeSectionOffset) << '\n'; auto& delimiterLocs = func->delimiterLocations[tryy]; delimiterLocs[delimiterLocs.size()] = lastBinaryPos - codeSectionOffset; } @@ -985,7 +969,6 @@ Result<> IRBuilder::visitDelegate(Index label) { } Result<> IRBuilder::visitEnd() { - // std::cerr << "visiting end\n"; auto scope = getScope(); if (scope.isNone()) { return Err{"unexpected end"}; From 4af4fc02e001f89e758d0b48b0c7e10cad0deb0c Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Tue, 19 Nov 2024 12:02:01 -0800 Subject: [PATCH 31/56] [NFC] Rename {F32,F64}NearestInt to {F32,F64}Nearest Rename the opcode values in wasm-binary.h to better match the names of the corresponding instructions. This also makes these names match the scheme used by the rest of the basic unary operations, allowing for more macro use in the binary reader. --- src/wasm-binary.h | 4 ++-- src/wasm/wasm-binary.cpp | 6 +----- src/wasm/wasm-stack.cpp | 4 ++-- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/wasm-binary.h b/src/wasm-binary.h index 7d928c3e6eb..b9cbba136df 100644 --- a/src/wasm-binary.h +++ b/src/wasm-binary.h @@ -563,7 +563,7 @@ enum ASTNodes { F32Ceil = 0x8d, F32Floor = 0x8e, F32Trunc = 0x8f, - F32NearestInt = 0x90, + F32Nearest = 0x90, F32Sqrt = 0x91, F32Add = 0x92, F32Sub = 0x93, @@ -578,7 +578,7 @@ enum ASTNodes { F64Ceil = 0x9b, F64Floor = 0x9c, F64Trunc = 0x9d, - F64NearestInt = 0x9e, + F64Nearest = 0x9e, F64Sqrt = 0x9f, F64Add = 0xa0, F64Sub = 0xa1, diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index 7ebb401c1f2..82ac422eaa4 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -3097,11 +3097,7 @@ Result<> WasmBinaryReader::readInst() { UNARY_FLOAT(Abs); UNARY_FLOAT(Ceil); UNARY_FLOAT(Floor); - // UNARY_FLOAT(NearestInt); - case BinaryConsts::F32NearestInt: - return builder.makeUnary(NearestFloat32); - case BinaryConsts::F64NearestInt: - return builder.makeUnary(NearestFloat64); + UNARY_FLOAT(Nearest); UNARY_FLOAT(Sqrt); case BinaryConsts::F32UConvertI32: diff --git a/src/wasm/wasm-stack.cpp b/src/wasm/wasm-stack.cpp index 7194229fea0..f86fb58b948 100644 --- a/src/wasm/wasm-stack.cpp +++ b/src/wasm/wasm-stack.cpp @@ -902,7 +902,7 @@ void BinaryInstWriter::visitUnary(Unary* curr) { o << int8_t(BinaryConsts::F32Trunc); break; case NearestFloat32: - o << int8_t(BinaryConsts::F32NearestInt); + o << int8_t(BinaryConsts::F32Nearest); break; case SqrtFloat32: o << int8_t(BinaryConsts::F32Sqrt); @@ -923,7 +923,7 @@ void BinaryInstWriter::visitUnary(Unary* curr) { o << int8_t(BinaryConsts::F64Trunc); break; case NearestFloat64: - o << int8_t(BinaryConsts::F64NearestInt); + o << int8_t(BinaryConsts::F64Nearest); break; case SqrtFloat64: o << int8_t(BinaryConsts::F64Sqrt); From 904d6fbea27514b04342245f615ddb19f781b561 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Tue, 19 Nov 2024 13:01:25 -0800 Subject: [PATCH 32/56] remove stale comment --- test/lit/source-map.wast | 1 - 1 file changed, 1 deletion(-) diff --git a/test/lit/source-map.wast b/test/lit/source-map.wast index d842b221ee7..fe534043bd3 100644 --- a/test/lit/source-map.wast +++ b/test/lit/source-map.wast @@ -49,7 +49,6 @@ (local.get $y) ) (then - ;; For the new parser ;;@ src.cpp:50:1 (return) ) From 4557b7dd50f69cb23d013f0f83e6c81e69691451 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Tue, 19 Nov 2024 18:01:55 -0800 Subject: [PATCH 33/56] Make more Ifs unreachable Previously the only Ifs that were typed unreachable were those in which both arms were unreachable and those in which the condition was unreachable that would have otherwise been typed none. This caused problems in IRBuilder because Ifs with unreachable conditions and value-returning arms would have concrete types, effectively hiding the unreachable condition from the logic for dropping concretely typed expressions preceding an unreachable expression when finishing a scope. Relax the conditions under which an If can be typed unreachable so that all Ifs with unreachable conditions or two unreachable arms are typed unreachable. Propagating unreachability more eagerly this way makes various optimizations of Ifs more powerful. It also requires new handling for unreachable Ifs with concretely typed arms in the Printer to ensure that printed wat remains valid. --- src/passes/CodeFolding.cpp | 6 +++- src/passes/Print.cpp | 11 +++++-- src/wasm/wasm-validator.cpp | 23 +++++++------- src/wasm/wasm.cpp | 30 +++++++------------ test/lit/passes/flatten_all-features.wast | 23 ++++---------- .../optimize-instructions-ignore-traps.wast | 2 +- .../lit/passes/optimize-instructions-mvp.wast | 30 ++++++++----------- test/lit/wat-kitchen-sink.wast | 28 +++++++++++++++-- .../remove-unused-brs_enable-multivalue.txt | 6 ++-- .../remove-unused-names_code-folding.txt | 12 ++++---- test/spec/if.wast | 22 +++++++------- test/wasm2js/br_table_temp.2asm.js | 2 +- 12 files changed, 104 insertions(+), 91 deletions(-) diff --git a/src/passes/CodeFolding.cpp b/src/passes/CodeFolding.cpp index 21527da6b18..04fc8057d25 100644 --- a/src/passes/CodeFolding.cpp +++ b/src/passes/CodeFolding.cpp @@ -249,8 +249,12 @@ struct CodeFolding : public WalkerPass> { // remove if (4 bytes), remove one arm, add drop (1), add block (3), // so this must be a net savings markAsModified(curr); + auto* ifTrue = curr->ifTrue; + if (curr->type == Type::unreachable && curr->ifTrue->type.isConcrete()) { + ifTrue = builder.makeDrop(ifTrue); + } auto* ret = - builder.makeSequence(builder.makeDrop(curr->condition), curr->ifTrue); + builder.makeSequence(builder.makeDrop(curr->condition), ifTrue); // we must ensure we present the same type as the if had ret->finalize(curr->type); replaceCurrent(ret); diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index 5a5d0129996..86cbfff0fbe 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -452,9 +452,16 @@ struct PrintExpressionContents } void visitIf(If* curr) { printMedium(o, "if"); - if (curr->type.isConcrete()) { + // Ifs are unreachable if their condition is unreachable, but in that case + // the arms might have some concrete type we have to account for to produce + // valid wat. + auto type = curr->type; + if (curr->condition->type == Type::unreachable && curr->ifFalse) { + type = Type::getLeastUpperBound(curr->ifTrue->type, curr->ifFalse->type); + } + if (type.isConcrete()) { o << ' '; - printBlockType(Signature(Type::none, curr->type)); + printBlockType(Signature(Type::none, type)); } } void visitLoop(Loop* curr) { diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp index 339a3c7a193..ba33cf4c054 100644 --- a/src/wasm/wasm-validator.cpp +++ b/src/wasm/wasm-validator.cpp @@ -866,7 +866,16 @@ void FunctionValidator::visitIf(If* curr) { curr, "returning if-else's false must have right type"); } else { - if (curr->condition->type != Type::unreachable) { + if (curr->condition->type == Type::unreachable) { + shouldBeTrue( + curr->ifTrue->type == Type::unreachable || + curr->ifFalse->type == Type::unreachable || + (curr->ifTrue->type == Type::none && + curr->ifFalse->type == Type::none) || + Type::hasLeastUpperBound(curr->ifTrue->type, curr->ifFalse->type), + curr, + "arms of unreachable if-else must have compatible types"); + } else { shouldBeEqual(curr->ifTrue->type, Type(Type::unreachable), curr, @@ -877,18 +886,6 @@ void FunctionValidator::visitIf(If* curr) { "unreachable if-else must have unreachable false"); } } - if (curr->ifTrue->type.isConcrete()) { - shouldBeSubType(curr->ifTrue->type, - curr->type, - curr, - "if type must match concrete ifTrue"); - } - if (curr->ifFalse->type.isConcrete()) { - shouldBeSubType(curr->ifFalse->type, - curr->type, - curr, - "if type must match concrete ifFalse"); - } } } diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp index a1ac076e08f..530133ebd69 100644 --- a/src/wasm/wasm.cpp +++ b/src/wasm/wasm.cpp @@ -215,28 +215,20 @@ void Block::finalize(std::optional type_, Breakability breakability) { } void If::finalize(std::optional type_) { - if (type_) { - type = *type_; - if (type == Type::none && (condition->type == Type::unreachable || - (ifFalse && ifTrue->type == Type::unreachable && - ifFalse->type == Type::unreachable))) { - type = Type::unreachable; - } + // The If is unreachable if the condition is unreachable or both arms are + // unreachable. + if (condition->type == Type::unreachable || + (ifFalse && ifTrue->type == Type::unreachable && + ifFalse->type == Type::unreachable)) { + type = Type::unreachable; return; } - type = ifFalse ? Type::getLeastUpperBound(ifTrue->type, ifFalse->type) - : Type::none; - // if the arms return a value, leave it even if the condition - // is unreachable, we still mark ourselves as having that type, e.g. - // (if (result i32) - // (unreachable) - // (i32.const 10) - // (i32.const 20) - // ) - // otherwise, if the condition is unreachable, so is the if - if (type == Type::none && condition->type == Type::unreachable) { - type = Type::unreachable; + if (type_) { + type = *type_; + } else { + type = ifFalse ? Type::getLeastUpperBound(ifTrue->type, ifFalse->type) + : Type::none; } } diff --git a/test/lit/passes/flatten_all-features.wast b/test/lit/passes/flatten_all-features.wast index 5db45e2722f..891272d12a6 100644 --- a/test/lit/passes/flatten_all-features.wast +++ b/test/lit/passes/flatten_all-features.wast @@ -619,8 +619,6 @@ ;; CHECK-NEXT: (local $0 i32) ;; CHECK-NEXT: (local $1 i32) ;; CHECK-NEXT: (local $2 i32) - ;; CHECK-NEXT: (local $3 i32) - ;; CHECK-NEXT: (local $4 i32) ;; CHECK-NEXT: (block $x ;; CHECK-NEXT: (block ;; CHECK-NEXT: (local.set $0 @@ -632,32 +630,23 @@ ;; CHECK-NEXT: (br_table $x ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (if + ;; CHECK-NEXT: (if (result i32) ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: (then - ;; CHECK-NEXT: (local.set $2 - ;; CHECK-NEXT: (i32.const 0) - ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (else - ;; CHECK-NEXT: (local.set $2 - ;; CHECK-NEXT: (i32.const 1) - ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 1) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.set $3 - ;; CHECK-NEXT: (local.get $2) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.set $1 - ;; CHECK-NEXT: (local.get $3) - ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.set $4 + ;; CHECK-NEXT: (local.set $2 ;; CHECK-NEXT: (local.get $1) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (return - ;; CHECK-NEXT: (local.get $4) + ;; CHECK-NEXT: (local.get $2) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $a13 (result i32) diff --git a/test/lit/passes/optimize-instructions-ignore-traps.wast b/test/lit/passes/optimize-instructions-ignore-traps.wast index 96ea16449d2..8902cbc28f5 100644 --- a/test/lit/passes/optimize-instructions-ignore-traps.wast +++ b/test/lit/passes/optimize-instructions-ignore-traps.wast @@ -213,7 +213,7 @@ ;; CHECK-NEXT: (i32.const 1) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.set $0 + ;; CHECK-NEXT: (local.tee $0 ;; CHECK-NEXT: (if (result i32) ;; CHECK-NEXT: (i32.or ;; CHECK-NEXT: (i32.eqz diff --git a/test/lit/passes/optimize-instructions-mvp.wast b/test/lit/passes/optimize-instructions-mvp.wast index f18c94c5c05..077ecf49502 100644 --- a/test/lit/passes/optimize-instructions-mvp.wast +++ b/test/lit/passes/optimize-instructions-mvp.wast @@ -5754,15 +5754,13 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (block (result i32) - ;; CHECK-NEXT: (i32.add - ;; CHECK-NEXT: (local.get $1) - ;; CHECK-NEXT: (unreachable) - ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (block (result i32) + ;; CHECK-NEXT: (block ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (local.tee $0 ;; CHECK-NEXT: (local.get $1) @@ -5775,7 +5773,7 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (if (result i32) + ;; CHECK-NEXT: (if ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: (then ;; CHECK-NEXT: (i32.add @@ -15718,23 +15716,21 @@ ) ) ) - ;; CHECK: (func $if-dont-change-to-unreachable (param $x i32) (param $y i32) (param $z i32) (result i32) - ;; CHECK-NEXT: (if (result i32) - ;; CHECK-NEXT: (local.get $x) - ;; CHECK-NEXT: (then - ;; CHECK-NEXT: (return + ;; CHECK: (func $if-unreachable-return-identical (param $x i32) (param $y i32) (param $z i32) (result i32) + ;; CHECK-NEXT: (return + ;; CHECK-NEXT: (if (result i32) + ;; CHECK-NEXT: (local.get $x) + ;; CHECK-NEXT: (then ;; CHECK-NEXT: (local.get $y) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (else - ;; CHECK-NEXT: (return + ;; CHECK-NEXT: (else ;; CHECK-NEXT: (local.get $z) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - (func $if-dont-change-to-unreachable (param $x i32) (param $y i32) (param $z i32) (result i32) - ;; if we move the returns outside, we'd become unreachable; avoid that. + (func $if-unreachable-return-identical (param $x i32) (param $y i32) (param $z i32) (result i32) + ;; We can move the returns outside because we are already unreachable. (if (result i32) (local.get $x) (then diff --git a/test/lit/wat-kitchen-sink.wast b/test/lit/wat-kitchen-sink.wast index 8b77de74dac..7fcedec283f 100644 --- a/test/lit/wat-kitchen-sink.wast +++ b/test/lit/wat-kitchen-sink.wast @@ -1280,6 +1280,30 @@ end ) + ;; CHECK: (func $if-else-unreachable (type $1) (result i32) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (if (result i32) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: (then + ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (else + ;; CHECK-NEXT: (i32.const 2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $if-else-unreachable (result i32) + i32.const 0 ;; This will be dropped + unreachable + if (result i32) + i32.const 1 + else + i32.const 2 + end + ) + ;; CHECK: (func $if-else-labeled-result (type $1) (result i32) ;; CHECK-NEXT: (block $l (result i32) ;; CHECK-NEXT: (if (result i32) @@ -1607,7 +1631,7 @@ ;; CHECK: (func $if-else-brs-i32 (type $1) (result i32) ;; CHECK-NEXT: (block $label (result i32) - ;; CHECK-NEXT: (if (result i32) + ;; CHECK-NEXT: (if ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: (then ;; CHECK-NEXT: (br $label @@ -3660,7 +3684,7 @@ (func $ref-func ref.func $ref-func drop - ref.func 161 + ref.func 162 drop ) diff --git a/test/passes/remove-unused-brs_enable-multivalue.txt b/test/passes/remove-unused-brs_enable-multivalue.txt index ee6efbf4dab..54780f0d9ee 100644 --- a/test/passes/remove-unused-brs_enable-multivalue.txt +++ b/test/passes/remove-unused-brs_enable-multivalue.txt @@ -2070,8 +2070,8 @@ (i32.const 2) ) ) - (local.set $x - (if (result i32) + (local.tee $x + (if (local.get $p) (then (br $out) @@ -2094,7 +2094,7 @@ (block $label$4 (result i64) (block $label$5 (block $label$6 - (local.set $var$1 + (local.tee $var$1 (if (result f64) (unreachable) (then diff --git a/test/passes/remove-unused-names_code-folding.txt b/test/passes/remove-unused-names_code-folding.txt index d0486b3c784..828f0196703 100644 --- a/test/passes/remove-unused-names_code-folding.txt +++ b/test/passes/remove-unused-names_code-folding.txt @@ -1523,14 +1523,16 @@ ) (nop) (drop - (block (result i32) + (block (drop (unreachable) ) - (block (result i32) - (i32.add - (i32.const 1) - (i32.const 2) + (drop + (block (result i32) + (i32.add + (i32.const 1) + (i32.const 2) + ) ) ) ) diff --git a/test/spec/if.wast b/test/spec/if.wast index ae7f7b38593..0fef1078f06 100644 --- a/test/spec/if.wast +++ b/test/spec/if.wast @@ -643,16 +643,18 @@ )) "type mismatch" ) -(assert_invalid - (module (func $type-else-value-unreached-select (result i32) - (if (result i64) - (i32.const 1) - (then (select (unreachable) (unreachable) (unreachable))) - (else (select (unreachable) (unreachable) (unreachable))) - ) - )) - "type mismatch" -) + +;; We don't pass this test because we type the `if` as unreachable. +;; (assert_invalid +;; (module (func $type-else-value-unreached-select (result i32) +;; (if (result i64) +;; (i32.const 1) +;; (then (select (unreachable) (unreachable) (unreachable))) +;; (else (select (unreachable) (unreachable) (unreachable))) +;; ) +;; )) +;; "type mismatch" +;; ) (assert_invalid (module (func $type-then-break-last-void-vs-num (result i32) diff --git a/test/wasm2js/br_table_temp.2asm.js b/test/wasm2js/br_table_temp.2asm.js index a8592a186c4..69884cc03d2 100644 --- a/test/wasm2js/br_table_temp.2asm.js +++ b/test/wasm2js/br_table_temp.2asm.js @@ -12676,7 +12676,7 @@ function asmFunc(imports) { } function $30() { - var $1_1 = 0, $2_1 = 0; + var $1_1 = 0; block : { $1_1 = 2; switch (0 | 0) { From 6b51083b6c39b062a3ceb183e7890afaf564eda3 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Tue, 19 Nov 2024 18:37:56 -0800 Subject: [PATCH 34/56] add test --- test/lit/wat-kitchen-sink.wast | 39 +++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/test/lit/wat-kitchen-sink.wast b/test/lit/wat-kitchen-sink.wast index 7fcedec283f..6709e3c030b 100644 --- a/test/lit/wat-kitchen-sink.wast +++ b/test/lit/wat-kitchen-sink.wast @@ -1304,6 +1304,43 @@ end ) + ;; CHECK: (func $if-else-nested-unreachable (type $1) (result i32) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (if (result i32) + ;; CHECK-NEXT: (if (result i32) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: (then + ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (else + ;; CHECK-NEXT: (i32.const 2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (then + ;; CHECK-NEXT: (i32.const 3) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (else + ;; CHECK-NEXT: (i32.const 4) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $if-else-nested-unreachable (result i32) + i32.const 0 ;; This will be dropped + unreachable + if (result i32) + i32.const 1 + else + i32.const 2 + end + if (result i32) + i32.const 3 + else + i32.const 4 + end + ) + ;; CHECK: (func $if-else-labeled-result (type $1) (result i32) ;; CHECK-NEXT: (block $l (result i32) ;; CHECK-NEXT: (if (result i32) @@ -3684,7 +3721,7 @@ (func $ref-func ref.func $ref-func drop - ref.func 162 + ref.func 163 drop ) From 835b08e70b60d59cfff34082f918511dcb98c3b4 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Wed, 20 Nov 2024 11:14:15 -0800 Subject: [PATCH 35/56] update flatten --- src/passes/Flatten.cpp | 6 ++++-- test/lit/passes/flatten_all-features.wast | 23 +++++++++++++++++------ test/wasm2js/br_table_temp.2asm.js | 2 +- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/passes/Flatten.cpp b/src/passes/Flatten.cpp index 37fa15b1185..99774e9182b 100644 --- a/src/passes/Flatten.cpp +++ b/src/passes/Flatten.cpp @@ -147,14 +147,16 @@ struct Flatten // arm preludes go in the arms. we must also remove an if value auto* originalIfTrue = iff->ifTrue; auto* originalIfFalse = iff->ifFalse; - auto type = iff->type; + auto type = iff->ifFalse ? Type::getLeastUpperBound(iff->ifTrue->type, + iff->ifFalse->type) + : Type::none; Expression* prelude = nullptr; if (type.isConcrete()) { Index temp = builder.addVar(getFunction(), type); if (iff->ifTrue->type.isConcrete()) { iff->ifTrue = builder.makeLocalSet(temp, iff->ifTrue); } - if (iff->ifFalse && iff->ifFalse->type.isConcrete()) { + if (iff->ifFalse->type.isConcrete()) { iff->ifFalse = builder.makeLocalSet(temp, iff->ifFalse); } // the whole if (+any preludes from the condition) is now a prelude diff --git a/test/lit/passes/flatten_all-features.wast b/test/lit/passes/flatten_all-features.wast index 891272d12a6..5db45e2722f 100644 --- a/test/lit/passes/flatten_all-features.wast +++ b/test/lit/passes/flatten_all-features.wast @@ -619,6 +619,8 @@ ;; CHECK-NEXT: (local $0 i32) ;; CHECK-NEXT: (local $1 i32) ;; CHECK-NEXT: (local $2 i32) + ;; CHECK-NEXT: (local $3 i32) + ;; CHECK-NEXT: (local $4 i32) ;; CHECK-NEXT: (block $x ;; CHECK-NEXT: (block ;; CHECK-NEXT: (local.set $0 @@ -630,23 +632,32 @@ ;; CHECK-NEXT: (br_table $x ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (if (result i32) + ;; CHECK-NEXT: (if ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: (then - ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: (local.set $2 + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (else - ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: (local.set $2 + ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: (local.set $3 + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $1 + ;; CHECK-NEXT: (local.get $3) + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.set $2 + ;; CHECK-NEXT: (local.set $4 ;; CHECK-NEXT: (local.get $1) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (return - ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: (local.get $4) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $a13 (result i32) diff --git a/test/wasm2js/br_table_temp.2asm.js b/test/wasm2js/br_table_temp.2asm.js index 69884cc03d2..a8592a186c4 100644 --- a/test/wasm2js/br_table_temp.2asm.js +++ b/test/wasm2js/br_table_temp.2asm.js @@ -12676,7 +12676,7 @@ function asmFunc(imports) { } function $30() { - var $1_1 = 0; + var $1_1 = 0, $2_1 = 0; block : { $1_1 = 2; switch (0 | 0) { From 2eea7c2e0ddfda9ea83ffcd054d603b6baff2c0b Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Wed, 20 Nov 2024 12:06:02 -0800 Subject: [PATCH 36/56] update unsubtyping --- src/ir/subtype-exprs.h | 2 +- test/lit/passes/unsubtyping.wast | 40 ++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/src/ir/subtype-exprs.h b/src/ir/subtype-exprs.h index 1895c856ae1..e6ee1816d3e 100644 --- a/src/ir/subtype-exprs.h +++ b/src/ir/subtype-exprs.h @@ -122,7 +122,7 @@ struct SubtypingDiscoverer : public OverriddenVisitor { } } void visitIf(If* curr) { - if (curr->ifFalse) { + if (curr->ifFalse && curr->type != Type::unreachable) { self()->noteSubtype(curr->ifTrue, curr); self()->noteSubtype(curr->ifFalse, curr); } diff --git a/test/lit/passes/unsubtyping.wast b/test/lit/passes/unsubtyping.wast index 97a2dd59ab8..14964716551 100644 --- a/test/lit/passes/unsubtyping.wast +++ b/test/lit/passes/unsubtyping.wast @@ -1815,3 +1815,43 @@ ) ) ) + +;; Regression test for a crash on ifs with unreachable conditions and tuple arms. +(module + ;; CHECK: (type $0 (func (result i32 i64))) + + ;; CHECK: (func $test (type $0) (result i32 i64) + ;; CHECK-NEXT: (if (type $0) (result i32 i64) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: (then + ;; CHECK-NEXT: (tuple.make 2 + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: (i64.const 1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (else + ;; CHECK-NEXT: (tuple.make 2 + ;; CHECK-NEXT: (i32.const 2) + ;; CHECK-NEXT: (i64.const 3) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $test (result i32 i64) + (if (result i32 i64) + (unreachable) + (then + (tuple.make 2 + (i32.const 0) + (i64.const 1) + ) + ) + (else + (tuple.make 2 + (i32.const 2) + (i64.const 3) + ) + ) + ) + ) +) From ac9bc8e371db1abdd852315141a002dcc0153e57 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Wed, 20 Nov 2024 14:25:10 -0800 Subject: [PATCH 37/56] update flatten again --- src/passes/Flatten.cpp | 10 ++++++---- test/lit/passes/flatten_all-features.wast | 12 +++--------- test/wasm2js/br_table_temp.2asm.js | 2 +- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/passes/Flatten.cpp b/src/passes/Flatten.cpp index 99774e9182b..1c2cfbcd536 100644 --- a/src/passes/Flatten.cpp +++ b/src/passes/Flatten.cpp @@ -159,10 +159,12 @@ struct Flatten if (iff->ifFalse->type.isConcrete()) { iff->ifFalse = builder.makeLocalSet(temp, iff->ifFalse); } - // the whole if (+any preludes from the condition) is now a prelude - prelude = rep; - // and we leave just a get of the value - rep = builder.makeLocalGet(temp, type); + if (curr->type.isConcrete()) { + // the whole if (+any preludes from the condition) is now a prelude + prelude = rep; + // and we leave just a get of the value + rep = builder.makeLocalGet(temp, type); + } } iff->ifTrue = getPreludesWithExpression(originalIfTrue, iff->ifTrue); if (iff->ifFalse) { diff --git a/test/lit/passes/flatten_all-features.wast b/test/lit/passes/flatten_all-features.wast index 5db45e2722f..b601b8a1295 100644 --- a/test/lit/passes/flatten_all-features.wast +++ b/test/lit/passes/flatten_all-features.wast @@ -620,7 +620,6 @@ ;; CHECK-NEXT: (local $1 i32) ;; CHECK-NEXT: (local $2 i32) ;; CHECK-NEXT: (local $3 i32) - ;; CHECK-NEXT: (local $4 i32) ;; CHECK-NEXT: (block $x ;; CHECK-NEXT: (block ;; CHECK-NEXT: (local.set $0 @@ -646,18 +645,13 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.set $3 - ;; CHECK-NEXT: (local.get $2) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.set $1 - ;; CHECK-NEXT: (local.get $3) - ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.set $4 + ;; CHECK-NEXT: (local.set $3 ;; CHECK-NEXT: (local.get $1) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (return - ;; CHECK-NEXT: (local.get $4) + ;; CHECK-NEXT: (local.get $3) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $a13 (result i32) diff --git a/test/wasm2js/br_table_temp.2asm.js b/test/wasm2js/br_table_temp.2asm.js index a8592a186c4..69884cc03d2 100644 --- a/test/wasm2js/br_table_temp.2asm.js +++ b/test/wasm2js/br_table_temp.2asm.js @@ -12676,7 +12676,7 @@ function asmFunc(imports) { } function $30() { - var $1_1 = 0, $2_1 = 0; + var $1_1 = 0; block : { $1_1 = 2; switch (0 | 0) { From 965f7483ecead41a72f270cc7c3c3885a4188319 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Wed, 20 Nov 2024 15:30:08 -0800 Subject: [PATCH 38/56] update autodrop --- src/ir/utils.h | 2 +- test/wasm2js/unreachable-if.2asm.js | 19 +++++++++++++++++++ test/wasm2js/unreachable-if.2asm.js.opt | 19 +++++++++++++++++++ test/wasm2js/unreachable-if.wast | 22 ++++++++++++++++++++++ 4 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 test/wasm2js/unreachable-if.2asm.js create mode 100644 test/wasm2js/unreachable-if.2asm.js.opt create mode 100644 test/wasm2js/unreachable-if.wast diff --git a/src/ir/utils.h b/src/ir/utils.h index 72aa701bb77..ff233195853 100644 --- a/src/ir/utils.h +++ b/src/ir/utils.h @@ -239,7 +239,7 @@ struct AutoDrop : public WalkerPass> { } if (acted) { reFinalize(); - assert(curr->type == Type::none); + assert(curr->type == Type::none || curr->type == Type::unreachable); } } diff --git a/test/wasm2js/unreachable-if.2asm.js b/test/wasm2js/unreachable-if.2asm.js new file mode 100644 index 00000000000..f5656223cc7 --- /dev/null +++ b/test/wasm2js/unreachable-if.2asm.js @@ -0,0 +1,19 @@ + +function asmFunc(imports) { + var Math_imul = Math.imul; + var Math_fround = Math.fround; + var Math_abs = Math.abs; + var Math_clz32 = Math.clz32; + var Math_min = Math.min; + var Math_max = Math.max; + var Math_floor = Math.floor; + var Math_ceil = Math.ceil; + var Math_trunc = Math.trunc; + var Math_sqrt = Math.sqrt; + return { + + }; +} + +var retasmFunc = asmFunc({ +}); diff --git a/test/wasm2js/unreachable-if.2asm.js.opt b/test/wasm2js/unreachable-if.2asm.js.opt new file mode 100644 index 00000000000..f5656223cc7 --- /dev/null +++ b/test/wasm2js/unreachable-if.2asm.js.opt @@ -0,0 +1,19 @@ + +function asmFunc(imports) { + var Math_imul = Math.imul; + var Math_fround = Math.fround; + var Math_abs = Math.abs; + var Math_clz32 = Math.clz32; + var Math_min = Math.min; + var Math_max = Math.max; + var Math_floor = Math.floor; + var Math_ceil = Math.ceil; + var Math_trunc = Math.trunc; + var Math_sqrt = Math.sqrt; + return { + + }; +} + +var retasmFunc = asmFunc({ +}); diff --git a/test/wasm2js/unreachable-if.wast b/test/wasm2js/unreachable-if.wast new file mode 100644 index 00000000000..5bc0257c0a2 --- /dev/null +++ b/test/wasm2js/unreachable-if.wast @@ -0,0 +1,22 @@ +;; Regression test for bad assertion in autodrop that did not expect the if to +;; be finalized to unreachable. +(module + (func $test (result i32) + (block $l (result i32) + (drop + (br_if $l + (if (result i32) + (unreachable) + (then + (i32.const 0) + ) + (else + (i32.const 0) + ) + ) + ) + (i32.const 0) + ) + ) + ) +) From 351e03a52a82c254bcd144a7a173a329e62d8c12 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Wed, 20 Nov 2024 16:29:17 -0800 Subject: [PATCH 39/56] address feedback --- src/passes/CodeFolding.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/passes/CodeFolding.cpp b/src/passes/CodeFolding.cpp index 04fc8057d25..e08b6e674f8 100644 --- a/src/passes/CodeFolding.cpp +++ b/src/passes/CodeFolding.cpp @@ -250,8 +250,8 @@ struct CodeFolding : public WalkerPass> { // so this must be a net savings markAsModified(curr); auto* ifTrue = curr->ifTrue; - if (curr->type == Type::unreachable && curr->ifTrue->type.isConcrete()) { - ifTrue = builder.makeDrop(ifTrue); + if (curr->type == Type::unreachable) { + ifTrue = builder.dropIfConcretelyTyped(ifTrue); } auto* ret = builder.makeSequence(builder.makeDrop(curr->condition), ifTrue); From 74ee9b666bf629ba55709fe5d707171462e53f7c Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Thu, 21 Nov 2024 13:24:45 -0800 Subject: [PATCH 40/56] Fix printing of unreachable br_on_cast{_fail} br_on_cast and br_on_cast_fail have two type annotations: one for their input type and one for their cast type. In cases where their operands were unreachable, we were previously printing "unreachable" for the input type annotation. This is not valid wat because "unreachable" is not a reference type. To fix the problem, print the bottom type of the cast type's hierarchy as the input type for br_on_cast and br_on_cast_fail when the operand is unreachable. This ensures that the instructions have the most precise possible output type according to Wasm typing rules, so it maximizes the number of contexts in which the printed instructions are valid. --- src/passes/Print.cpp | 16 +++++++++-- test/lit/wat-kitchen-sink.wast | 50 ++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 2 deletions(-) diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index 5a5d0129996..a13fbd7329e 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -2219,7 +2219,14 @@ struct PrintExpressionContents printMedium(o, "br_on_cast "); curr->name.print(o); o << ' '; - printType(curr->ref->type); + if (curr->ref->type == Type::unreachable) { + // Need to print some reference type in the correct hierarchy rather + // than unreachable, so arbitrarily choose the cast target type. + printType( + Type(curr->castType.getHeapType().getBottom(), NonNullable)); + } else { + printType(curr->ref->type); + } o << ' '; printType(curr->castType); return; @@ -2227,7 +2234,12 @@ struct PrintExpressionContents printMedium(o, "br_on_cast_fail "); curr->name.print(o); o << ' '; - printType(curr->ref->type); + if (curr->ref->type == Type::unreachable) { + printType( + Type(curr->castType.getHeapType().getBottom(), NonNullable)); + } else { + printType(curr->ref->type); + } o << ' '; printType(curr->castType); return; diff --git a/test/lit/wat-kitchen-sink.wast b/test/lit/wat-kitchen-sink.wast index 8b77de74dac..719cf2db383 100644 --- a/test/lit/wat-kitchen-sink.wast +++ b/test/lit/wat-kitchen-sink.wast @@ -4064,6 +4064,31 @@ drop ) + ;; CHECK: (func $br-on-cast-unreachable (type $0) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (block $block (result i31ref) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (block (result (ref any)) + ;; CHECK-NEXT: (br_on_cast $block (ref none) i31ref + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $br-on-cast-unreachable + block (result i31ref) + block (result (ref any)) + unreachable + br_on_cast 1 anyref i31ref + end + unreachable + end + drop + ) + ;; CHECK: (func $br-on-cast-fail (type $9) (param $0 anyref) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (block $block (result (ref any)) @@ -4089,6 +4114,31 @@ drop ) + ;; CHECK: (func $br-on-cast-fail-unreachable (type $0) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (block $block (result (ref any)) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (block (result i31ref) + ;; CHECK-NEXT: (br_on_cast_fail $block (ref none) i31ref + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $br-on-cast-fail-unreachable + block (result (ref any)) + block (result i31ref) + unreachable + br_on_cast_fail 1 anyref i31ref + end + unreachable + end + drop + ) + ;; CHECK: (func $struct-new (type $63) (param $0 i32) (param $1 i64) (result (ref $pair)) ;; CHECK-NEXT: (struct.new $pair ;; CHECK-NEXT: (local.get $0) From 801ab14940432aa3010578dca714c315baf1a5f9 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Thu, 21 Nov 2024 13:39:51 -0800 Subject: [PATCH 41/56] update comment --- src/passes/Print.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index a13fbd7329e..5c8463f78fa 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -2221,7 +2221,8 @@ struct PrintExpressionContents o << ' '; if (curr->ref->type == Type::unreachable) { // Need to print some reference type in the correct hierarchy rather - // than unreachable, so arbitrarily choose the cast target type. + // than unreachable, and the bottom type is valid in the most + // contexts. printType( Type(curr->castType.getHeapType().getBottom(), NonNullable)); } else { From 62569641c6a085ce0e0e70a782450b49a2b4f2ae Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Thu, 21 Nov 2024 19:48:13 -0800 Subject: [PATCH 42/56] Remove AutoDrop The only internal use was in wasm2js, which doesn't need it. Fix API tests to explicitly drop expressions as necessary. --- CHANGELOG.md | 1 + src/binaryen-c.cpp | 6 - src/binaryen-c.h | 5 - src/ir/utils.h | 88 - src/js/binaryen.js-post.js | 3 - src/wasm/wasm-validator.cpp | 3 +- src/wasm2js.h | 1 - test/binaryen.js/kitchen-sink.js | 18 +- test/binaryen.js/kitchen-sink.js.txt | 2109 +---------------- test/example/c-api-kitchen-sink.c | 13 +- test/example/c-api-kitchen-sink.txt | 12 +- .../example/c-api-relooper-unreachable-if.cpp | 1 - test/example/c-api-unused-mem.cpp | 1 - test/wasm2js/br_table_temp.2asm.js | 3 +- test/wasm2js/emscripten.2asm.js | 1 + test/wasm2js/labels.2asm.js | 6 +- test/wasm2js/refs.2asm.js | 4 +- test/wasm2js/switch.2asm.js | 4 +- test/wasm2js/unreachable-later.2asm.js | 2 +- 19 files changed, 41 insertions(+), 2240 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c45eac79da..324c29526f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ Current Trunk ------------- - BinaryenSelect no longer takes a type parameter. + - AutoDrop APIs have been removed. v120 ---- diff --git a/src/binaryen-c.cpp b/src/binaryen-c.cpp index a278f77780a..4294d56ea64 100644 --- a/src/binaryen-c.cpp +++ b/src/binaryen-c.cpp @@ -5496,12 +5496,6 @@ void BinaryenModuleRunPasses(BinaryenModuleRef module, passRunner.run(); } -void BinaryenModuleAutoDrop(BinaryenModuleRef module) { - auto* wasm = (Module*)module; - PassRunner runner(wasm, globalPassOptions); - AutoDrop().run(&runner, wasm); -} - static BinaryenBufferSizes writeModule(BinaryenModuleRef module, char* output, size_t outputSize, diff --git a/src/binaryen-c.h b/src/binaryen-c.h index d24b2bb56df..8616571db59 100644 --- a/src/binaryen-c.h +++ b/src/binaryen-c.h @@ -3045,11 +3045,6 @@ BINARYEN_API void BinaryenModuleRunPasses(BinaryenModuleRef module, const char** passes, BinaryenIndex numPasses); -// Auto-generate drop() operations where needed. This lets you generate code -// without worrying about where they are needed. (It is more efficient to do it -// yourself, but simpler to use autodrop). -BINARYEN_API void BinaryenModuleAutoDrop(BinaryenModuleRef module); - // Serialize a module into binary form. Uses the currently set global debugInfo // option. // @return how many bytes were written. This will be less than or equal to diff --git a/src/ir/utils.h b/src/ir/utils.h index 72aa701bb77..8051cb1a348 100644 --- a/src/ir/utils.h +++ b/src/ir/utils.h @@ -181,94 +181,6 @@ struct ReFinalizeNode : public OverriddenVisitor { } }; -// Adds drop() operations where necessary. This lets you not worry about adding -// drop when generating code. This also refinalizes before and after, as -// dropping can change types, and depends on types being cleaned up - no -// unnecessary block/if/loop types (see refinalize) -// TODO: optimize that, interleave them -struct AutoDrop : public WalkerPass> { - bool isFunctionParallel() override { return true; } - - std::unique_ptr create() override { - return std::make_unique(); - } - - AutoDrop() { name = "autodrop"; } - - bool maybeDrop(Expression*& child) { - bool acted = false; - if (child->type.isConcrete()) { - expressionStack.push_back(child); - if (!ExpressionAnalyzer::isResultUsed(expressionStack, getFunction()) && - !ExpressionAnalyzer::isResultDropped(expressionStack)) { - child = Builder(*getModule()).makeDrop(child); - acted = true; - } - expressionStack.pop_back(); - } - return acted; - } - - void reFinalize() { ReFinalizeNode::updateStack(expressionStack); } - - void visitBlock(Block* curr) { - if (curr->list.size() == 0) { - return; - } - for (Index i = 0; i < curr->list.size() - 1; i++) { - auto* child = curr->list[i]; - if (child->type.isConcrete()) { - curr->list[i] = Builder(*getModule()).makeDrop(child); - } - } - if (maybeDrop(curr->list.back())) { - reFinalize(); - assert(curr->type == Type::none || curr->type == Type::unreachable); - } - } - - void visitIf(If* curr) { - bool acted = false; - if (maybeDrop(curr->ifTrue)) { - acted = true; - } - if (curr->ifFalse) { - if (maybeDrop(curr->ifFalse)) { - acted = true; - } - } - if (acted) { - reFinalize(); - assert(curr->type == Type::none); - } - } - - void visitTry(Try* curr) { - bool acted = false; - if (maybeDrop(curr->body)) { - acted = true; - } - for (auto* catchBody : curr->catchBodies) { - if (maybeDrop(catchBody)) { - acted = true; - } - } - if (acted) { - reFinalize(); - assert(curr->type == Type::none); - } - } - - void doWalkFunction(Function* curr) { - ReFinalize().walkFunctionInModule(curr, getModule()); - walk(curr->body); - if (curr->getResults() == Type::none && curr->body->type.isConcrete()) { - curr->body = Builder(*getModule()).makeDrop(curr->body); - } - ReFinalize().walkFunctionInModule(curr, getModule()); - } -}; - struct I64Utilities { static Expression* recreateI64(Builder& builder, Expression* low, Expression* high) { diff --git a/src/js/binaryen.js-post.js b/src/js/binaryen.js-post.js index a90b79d4916..c8d8e31ba58 100644 --- a/src/js/binaryen.js-post.js +++ b/src/js/binaryen.js-post.js @@ -2674,9 +2674,6 @@ function wrapModule(module, self = {}) { Module['_BinaryenFunctionRunPasses'](func, module, i32sToStack(passes.map(strToStack)), passes.length) ); }; - self['autoDrop'] = function() { - return Module['_BinaryenModuleAutoDrop'](module); - }; self['dispose'] = function() { Module['_BinaryenModuleDispose'](module); }; diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp index 516bb86e15e..64c7fda02ab 100644 --- a/src/wasm/wasm-validator.cpp +++ b/src/wasm/wasm-validator.cpp @@ -720,8 +720,7 @@ void FunctionValidator::validateNormalBlockElements(Block* curr) { if (!shouldBeTrue( !curr->list[i]->type.isConcrete(), curr, - "non-final block elements returning a value must be drop()ed " - "(binaryen's autodrop option might help you)") && + "non-final block elements returning a value must be dropped") && !info.quiet) { getStream() << "(on index " << i << ":\n" << curr->list[i] << "\n), type: " << curr->list[i]->type diff --git a/src/wasm2js.h b/src/wasm2js.h index d965dcc0cca..f819089482f 100644 --- a/src/wasm2js.h +++ b/src/wasm2js.h @@ -361,7 +361,6 @@ Ref Wasm2JSBuilder::processWasm(Module* wasm, Name funcName) { // First, do the lowering to a JS-friendly subset. { PassRunner runner(wasm, options); - runner.add(std::make_unique()); // TODO: only legalize if necessary - emscripten would already do so, and // likely other toolchains. but spec test suite needs that. runner.add("legalize-js-interface"); diff --git a/test/binaryen.js/kitchen-sink.js b/test/binaryen.js/kitchen-sink.js index 6e6808ab8eb..acef392c377 100644 --- a/test/binaryen.js/kitchen-sink.js +++ b/test/binaryen.js/kitchen-sink.js @@ -559,7 +559,7 @@ function test_core() { // All the rest module.block('', []), // block with no name module.if(temp1, temp2, temp3), - module.if(temp4, temp5), + module.if(temp4, module.drop(temp5)), module.loop("in", makeInt32(0)), module.loop(null, makeInt32(0)), module.break("the-value", temp6, temp7), @@ -686,6 +686,14 @@ function test_core() { console.log("getExpressionInfo=" + JSON.stringify(cleanInfo(binaryen.getExpressionInfo(valueList[3])))); console.log(binaryen.emitText(valueList[3])); // test printing a standalone expression + // Add drops of concrete expressions, except the last. + for (var i = 0; i < valueList.length - 1; i++) { + var type = binaryen.Expression.getType(valueList[i]); + if (type != binaryen.none && type != binaryen.unreachable) { + valueList[i] = module.drop(valueList[i]); + } + } + console.log("getExpressionInfo(i32.const)=" + JSON.stringify(binaryen.getExpressionInfo(module.i32.const(5)))); console.log("getExpressionInfo(i64.const)=" + JSON.stringify(binaryen.getExpressionInfo(module.i64.const(6, 7)))); console.log("getExpressionInfo(f32.const)=" + JSON.stringify(binaryen.getExpressionInfo(module.f32.const(8.5)))); @@ -698,10 +706,10 @@ function test_core() { } // Make the main body of the function. and one block with a return value, one without - var value = module.block("the-value", valueList); + var value = module.block("the-value", valueList, binaryen.i32); var droppedValue = module.drop(value); var nothing = module.block("the-nothing", [ droppedValue ]); - var body = module.block("the-body", [ nothing, makeInt32(42) ]); + var body = module.block("the-body", [ nothing, makeInt32(42) ], binaryen.i32); // Create the function var sinker = module.addFunction("kitchen()sinker", iIfF, binaryen.i32, [ binaryen.i32 ], body); @@ -749,13 +757,9 @@ function test_core() { var starter = module.addFunction("starter", binaryen.none, binaryen.none, [], module.nop()); module.setStart(starter); - // A bunch of our code needs drop, auto-add it - module.autoDrop(); - var features = binaryen.Features.All; module.setFeatures(features); assert(module.getFeatures() == features); - console.log(module.emitText()); // Verify it validates assert(module.validate()); diff --git a/test/binaryen.js/kitchen-sink.js.txt b/test/binaryen.js/kitchen-sink.js.txt index d41301751d5..d38c168571e 100644 --- a/test/binaryen.js/kitchen-sink.js.txt +++ b/test/binaryen.js/kitchen-sink.js.txt @@ -1927,2116 +1927,13 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7} ) (block ) - (if - (i32.const 1) - (then - (drop - (i32.const 2) - ) - ) - (else - (drop - (i32.const 3) - ) - ) - ) - (if - (i32.const 4) - (then - (drop - (i32.const 5) - ) - ) - ) - (drop - (loop $in (result i32) - (i32.const 0) - ) - ) - (drop - (loop (result i32) - (i32.const 0) - ) - ) - (drop - (br_if $the-value - (i32.const 1) - (i32.const 0) - ) - ) - (br_if $the-nothing - (i32.const 2) - ) - (br $the-value - (i32.const 3) - ) - (br $the-nothing) - (br_table $the-value $the-value - (i32.const 1) - (i32.const 0) - ) - (br_table $the-nothing $the-nothing - (i32.const 2) - ) - (drop - (i32.eqz - (call $"kitchen()sinker" - (i32.const 13) - (i64.const 37) - (f32.const 1.2999999523162842) - (f64.const 3.7) - ) - ) - ) - (drop - (i32.eqz - (i32.trunc_f32_s - (call $an-imported - (i32.const 13) - (f64.const 3.7) - ) - ) - ) - ) - (drop - (i32.eqz - (call_indirect $t0 (type $0) - (i32.const 13) - (i64.const 37) - (f32.const 1.2999999523162842) - (f64.const 3.7) - (i32.const 2449) - ) - ) - ) - (drop - (local.get $0) - ) - (local.set $0 - (i32.const 101) - ) - (drop - (local.tee $0 - (i32.const 102) - ) - ) - (drop - (i32.load - (i32.const 1) - ) - ) - (drop - (i64.load16_s offset=2 align=1 - (i32.const 8) - ) - ) - (drop - (f32.load - (i32.const 2) - ) - ) - (drop - (f64.load offset=2 - (i32.const 9) - ) - ) - (i32.store - (i32.const 10) - (i32.const 11) - ) - (i64.store offset=2 align=4 - (i32.const 110) - (i64.const 111) - ) - (drop - (select - (i32.const 3) - (i32.const 5) - (i32.const 1) - ) - ) - (return - (i32.const 1337) - ) - (return_call $"kitchen()sinker" - (i32.const 13) - (i64.const 37) - (f32.const 1.2999999523162842) - (f64.const 3.7) - ) - (return_call_indirect $t0 (type $0) - (i32.const 13) - (i64.const 37) - (f32.const 1.2999999523162842) - (f64.const 3.7) - (i32.const 2449) - ) - (drop - (ref.is_null - (ref.null noextern) - ) - ) - (drop - (ref.is_null - (ref.null nofunc) - ) - ) - (drop - (ref.is_null - (ref.func $"kitchen()sinker") - ) - ) - (drop - (select (result funcref) - (ref.null nofunc) - (ref.func $"kitchen()sinker") - (i32.const 1) - ) - ) - (drop - (ref.eq - (ref.null none) - (ref.null none) - ) - ) - (try - (do - (throw $a-tag - (i32.const 0) - ) - ) - (catch $a-tag - (drop - (pop i32) - ) - ) - ) - (i32.atomic.store - (i32.const 0) - (i32.atomic.load - (i32.const 0) - ) - ) - (drop - (memory.atomic.wait32 - (i32.const 0) - (i32.const 0) - (i64.const 0) - ) - ) - (drop - (memory.atomic.notify - (i32.const 0) - (i32.const 0) - ) - ) - (atomic.fence) - (tuple.drop 4 - (tuple.make 4 - (i32.const 13) - (i64.const 37) - (f32.const 1.2999999523162842) - (f64.const 3.7) - ) - ) - (drop - (tuple.extract 4 2 - (tuple.make 4 - (i32.const 13) - (i64.const 37) - (f32.const 1.2999999523162842) - (f64.const 3.7) - ) - ) - ) - (drop - (pop i32) - ) - (drop - (pop i64) - ) - (drop - (pop f32) - ) - (drop - (pop f64) - ) - (drop - (pop v128) - ) - (drop - (pop funcref) - ) - (drop - (pop externref) - ) - (drop - (pop anyref) - ) - (drop - (pop eqref) - ) - (drop - (pop i31ref) - ) - (drop - (pop structref) - ) - (drop - (pop stringref) - ) - (drop - (memory.size) - ) - (drop - (memory.grow - (i32.const 0) - ) - ) - (drop - (ref.i31 - (i32.const 0) - ) - ) - (drop - (i31.get_s - (ref.i31 - (i32.const 1) - ) - ) - ) - (drop - (i31.get_u - (ref.i31 - (i32.const 2) - ) - ) - ) - (nop) - (unreachable) - ) - ) - ) - (i32.const 42) - ) - ) - (func $starter (type $3) - (nop) - ) -) - -(module - (type $0 (func (param i32 i64 f32 f64) (result i32))) - (type $1 (func (param i32))) - (type $2 (func (param i32 f64) (result f32))) - (type $3 (func)) - (import "module" "base" (global $a-global-imp i32)) - (import "module" "base" (global $a-mut-global-imp (mut i32))) - (import "module" "base" (func $an-imported (type $2) (param i32 f64) (result f32))) - (import "module" "base" (tag $a-tag-imp (param i32))) - (global $a-global i32 (i32.const 1)) - (memory $0 1 256 shared) - (data $x0 (i32.const 10) "hello, world") - (data $y1 "I am passive") - (table $t0 1 funcref) - (elem $e0 (i32.const 0) $"kitchen()sinker") - (tag $a-tag (param i32)) - (export "mem" (memory $0)) - (export "kitchen_sinker" (func $"kitchen()sinker")) - (export "a-global-exp" (global $a-global)) - (export "a-tag-exp" (tag $a-tag)) - (start $starter) - (func $"kitchen()sinker" (type $0) (param $0 i32) (param $1 i64) (param $2 f32) (param $3 f64) (result i32) - (local $4 i32) - (block $the-body (result i32) - (block $the-nothing - (drop - (block $the-value (result i32) - (drop - (i32.clz - (i32.const -10) - ) - ) - (drop - (i64.ctz - (i64.const -22) - ) - ) - (drop - (i32.popcnt - (i32.const -10) - ) - ) - (drop - (f32.neg - (f32.const -33.61199951171875) - ) - ) - (drop - (f64.abs - (f64.const -9005.841) - ) - ) - (drop - (f32.ceil - (f32.const -33.61199951171875) - ) - ) - (drop - (f64.floor - (f64.const -9005.841) - ) - ) - (drop - (f32.trunc - (f32.const -33.61199951171875) - ) - ) - (drop - (f32.nearest - (f32.const -33.61199951171875) - ) - ) - (drop - (f64.sqrt - (f64.const -9005.841) - ) - ) - (drop - (i32.eqz - (i32.const -10) - ) - ) - (drop - (i64.extend_i32_s - (i32.const -10) - ) - ) - (drop - (i64.extend_i32_u - (i32.const -10) - ) - ) - (drop - (i32.wrap_i64 - (i64.const -22) - ) - ) - (drop - (i32.trunc_f32_s - (f32.const -33.61199951171875) - ) - ) - (drop - (i64.trunc_f32_s - (f32.const -33.61199951171875) - ) - ) - (drop - (i32.trunc_f32_u - (f32.const -33.61199951171875) - ) - ) - (drop - (i64.trunc_f32_u - (f32.const -33.61199951171875) - ) - ) - (drop - (i32.trunc_f64_s - (f64.const -9005.841) - ) - ) - (drop - (i64.trunc_f64_s - (f64.const -9005.841) - ) - ) - (drop - (i32.trunc_f64_u - (f64.const -9005.841) - ) - ) - (drop - (i64.trunc_f64_u - (f64.const -9005.841) - ) - ) - (drop - (i32.trunc_sat_f32_s - (f32.const -33.61199951171875) - ) - ) - (drop - (i64.trunc_sat_f32_s - (f32.const -33.61199951171875) - ) - ) - (drop - (i32.trunc_sat_f32_u - (f32.const -33.61199951171875) - ) - ) - (drop - (i64.trunc_sat_f32_u - (f32.const -33.61199951171875) - ) - ) - (drop - (i32.trunc_sat_f64_s - (f64.const -9005.841) - ) - ) - (drop - (i64.trunc_sat_f64_s - (f64.const -9005.841) - ) - ) - (drop - (i32.trunc_sat_f64_u - (f64.const -9005.841) - ) - ) - (drop - (i64.trunc_sat_f64_u - (f64.const -9005.841) - ) - ) - (drop - (i32.reinterpret_f32 - (f32.const -33.61199951171875) - ) - ) - (drop - (i64.reinterpret_f64 - (f64.const -9005.841) - ) - ) - (drop - (f32.convert_i32_s - (i32.const -10) - ) - ) - (drop - (f64.convert_i32_s - (i32.const -10) - ) - ) - (drop - (f32.convert_i32_u - (i32.const -10) - ) - ) - (drop - (f64.convert_i32_u - (i32.const -10) - ) - ) - (drop - (f32.convert_i64_s - (i64.const -22) - ) - ) - (drop - (f64.convert_i64_s - (i64.const -22) - ) - ) - (drop - (f32.convert_i64_u - (i64.const -22) - ) - ) - (drop - (f64.convert_i64_u - (i64.const -22) - ) - ) - (drop - (f64.promote_f32 - (f32.const -33.61199951171875) - ) - ) - (drop - (f32.demote_f64 - (f64.const -9005.841) - ) - ) - (drop - (f32.reinterpret_i32 - (i32.const -10) - ) - ) - (drop - (f64.reinterpret_i64 - (i64.const -22) - ) - ) - (drop - (i8x16.splat - (i32.const 42) - ) - ) - (drop - (i16x8.splat - (i32.const 42) - ) - ) - (drop - (i32x4.splat - (i32.const 42) - ) - ) - (drop - (i64x2.splat - (i64.const 1958505087099) - ) - ) - (drop - (f32x4.splat - (f32.const 42) - ) - ) - (drop - (f64x2.splat - (f64.const 42) - ) - ) - (drop - (v128.not - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (v128.any_true - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i8x16.popcnt - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i8x16.abs - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i8x16.neg - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i8x16.all_true - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i8x16.bitmask - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i16x8.abs - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i16x8.neg - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i16x8.all_true - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i16x8.bitmask - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i16x8.extadd_pairwise_i8x16_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i16x8.extadd_pairwise_i8x16_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i32x4.abs - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i32x4.neg - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i32x4.all_true - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i32x4.bitmask - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i32x4.extadd_pairwise_i16x8_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i32x4.extadd_pairwise_i16x8_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i64x2.abs - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i64x2.neg - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i64x2.all_true - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i64x2.bitmask - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f32x4.abs - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f32x4.neg - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f32x4.sqrt - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f64x2.abs - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f64x2.neg - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f64x2.sqrt - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f64x2.convert_low_i32x4_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f64x2.convert_low_i32x4_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f64x2.promote_low_f32x4 - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i32x4.trunc_sat_f32x4_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i32x4.trunc_sat_f32x4_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f32x4.convert_i32x4_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f32x4.convert_i32x4_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f32x4.demote_f64x2_zero - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i16x8.extend_low_i8x16_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i16x8.extend_high_i8x16_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i16x8.extend_low_i8x16_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i16x8.extend_high_i8x16_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i32x4.extend_low_i16x8_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i32x4.extend_high_i16x8_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i32x4.extend_low_i16x8_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i32x4.extend_high_i16x8_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i32x4.trunc_sat_f64x2_s_zero - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i32x4.trunc_sat_f64x2_u_zero - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i64x2.extend_low_i32x4_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i64x2.extend_high_i32x4_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i64x2.extend_low_i32x4_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i64x2.extend_high_i32x4_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i32.add - (i32.const -10) - (i32.const -11) - ) - ) - (drop - (f64.sub - (f64.const -9005.841) - (f64.const -9007.333) - ) - ) - (drop - (i32.div_s - (i32.const -10) - (i32.const -11) - ) - ) - (drop - (i64.div_u - (i64.const 4294967274) - (i64.const 4294967273) - ) - ) - (drop - (i64.rem_s - (i64.const 4294967274) - (i64.const 4294967273) - ) - ) - (drop - (i32.rem_u - (i32.const -10) - (i32.const -11) - ) - ) - (drop - (i32.and - (i32.const -10) - (i32.const -11) - ) - ) - (drop - (i64.or - (i64.const 4294967274) - (i64.const 4294967273) - ) - ) - (drop - (i32.xor - (i32.const -10) - (i32.const -11) - ) - ) - (drop - (i64.shl - (i64.const 4294967274) - (i64.const 4294967273) - ) - ) - (drop - (i64.shr_u - (i64.const 4294967274) - (i64.const 4294967273) - ) - ) - (drop - (i32.shr_s - (i32.const -10) - (i32.const -11) - ) - ) - (drop - (i32.rotl - (i32.const -10) - (i32.const -11) - ) - ) - (drop - (i64.rotr - (i64.const 4294967274) - (i64.const 4294967273) - ) - ) - (drop - (f32.div - (f32.const -33.61199951171875) - (f32.const -62.5) - ) - ) - (drop - (f64.copysign - (f64.const -9005.841) - (f64.const -9007.333) - ) - ) - (drop - (f32.min - (f32.const -33.61199951171875) - (f32.const -62.5) - ) - ) - (drop - (f64.max - (f64.const -9005.841) - (f64.const -9007.333) - ) - ) - (drop - (i32.eq - (i32.const -10) - (i32.const -11) - ) - ) - (drop - (f32.ne - (f32.const -33.61199951171875) - (f32.const -62.5) - ) - ) - (drop - (i32.lt_s - (i32.const -10) - (i32.const -11) - ) - ) - (drop - (i64.lt_u - (i64.const 4294967274) - (i64.const 4294967273) - ) - ) - (drop - (i64.le_s - (i64.const 4294967274) - (i64.const 4294967273) - ) - ) - (drop - (i32.le_u - (i32.const -10) - (i32.const -11) - ) - ) - (drop - (i64.gt_s - (i64.const 4294967274) - (i64.const 4294967273) - ) - ) - (drop - (i32.gt_u - (i32.const -10) - (i32.const -11) - ) - ) - (drop - (i32.ge_s - (i32.const -10) - (i32.const -11) - ) - ) - (drop - (i64.ge_u - (i64.const 4294967274) - (i64.const 4294967273) - ) - ) - (drop - (f32.lt - (f32.const -33.61199951171875) - (f32.const -62.5) - ) - ) - (drop - (f64.le - (f64.const -9005.841) - (f64.const -9007.333) - ) - ) - (drop - (f64.gt - (f64.const -9005.841) - (f64.const -9007.333) - ) - ) - (drop - (f32.ge - (f32.const -33.61199951171875) - (f32.const -62.5) - ) - ) - (drop - (i8x16.eq - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i8x16.ne - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i8x16.lt_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i8x16.lt_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i8x16.gt_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i8x16.gt_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i8x16.le_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i8x16.le_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i8x16.ge_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i8x16.ge_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i16x8.eq - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i16x8.ne - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i16x8.lt_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i16x8.lt_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i16x8.gt_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i16x8.gt_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i16x8.le_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i16x8.le_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i16x8.ge_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i16x8.ge_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i32x4.eq - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i32x4.ne - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i32x4.lt_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i32x4.lt_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i32x4.gt_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i32x4.gt_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i32x4.le_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i32x4.le_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i32x4.ge_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i32x4.ge_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i64x2.eq - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i64x2.ne - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i64x2.lt_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i64x2.gt_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i64x2.le_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i64x2.ge_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f32x4.eq - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f32x4.ne - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f32x4.lt - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f32x4.gt - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f32x4.le - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f32x4.ge - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f64x2.eq - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f64x2.ne - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f64x2.lt - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f64x2.gt - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f64x2.le - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f64x2.ge - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (v128.and - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (v128.or - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (v128.xor - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (v128.andnot - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i8x16.add - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i8x16.add_sat_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i8x16.add_sat_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i8x16.sub - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i8x16.sub_sat_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i8x16.sub_sat_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i8x16.min_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i8x16.min_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i8x16.max_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i8x16.max_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i8x16.avgr_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i16x8.add - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i16x8.add_sat_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i16x8.add_sat_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i16x8.sub - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i16x8.sub_sat_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i16x8.sub_sat_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i16x8.mul - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i16x8.min_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i16x8.min_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i16x8.max_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i16x8.max_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i16x8.avgr_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i16x8.q15mulr_sat_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i16x8.extmul_low_i8x16_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i16x8.extmul_high_i8x16_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i16x8.extmul_low_i8x16_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i16x8.extmul_high_i8x16_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i32x4.add - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i32x4.sub - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i32x4.mul - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i32x4.min_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i32x4.min_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i32x4.max_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i32x4.max_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i32x4.dot_i16x8_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i32x4.extmul_low_i16x8_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i32x4.extmul_high_i16x8_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i32x4.extmul_low_i16x8_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i32x4.extmul_high_i16x8_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i64x2.add - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i64x2.sub - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i64x2.mul - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i64x2.extmul_low_i32x4_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i64x2.extmul_high_i32x4_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i64x2.extmul_low_i32x4_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i64x2.extmul_high_i32x4_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f32x4.add - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f32x4.sub - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f32x4.mul - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f32x4.div - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f32x4.min - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f32x4.max - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f32x4.pmin - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f32x4.pmax - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f32x4.ceil - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f32x4.floor - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f32x4.trunc - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f32x4.nearest - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f64x2.add - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f64x2.sub - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f64x2.mul - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f64x2.div - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f64x2.min - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f64x2.max - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f64x2.pmin - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f64x2.pmax - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f64x2.ceil - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f64x2.floor - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f64x2.trunc - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f64x2.nearest - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i8x16.narrow_i16x8_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i8x16.narrow_i16x8_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i16x8.narrow_i32x4_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i16x8.narrow_i32x4_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i8x16.swizzle - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i8x16.extract_lane_s 1 - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i8x16.extract_lane_u 1 - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i16x8.extract_lane_s 1 - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i16x8.extract_lane_u 1 - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i32x4.extract_lane 1 - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i64x2.extract_lane 1 - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f32x4.extract_lane 1 - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (f64x2.extract_lane 1 - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (i16x8.replace_lane 1 - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (i32.const 42) - ) - ) - (drop - (i8x16.replace_lane 1 - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (i32.const 42) - ) - ) - (drop - (i32x4.replace_lane 1 - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (i32.const 42) - ) - ) - (drop - (i64x2.replace_lane 1 - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (i64.const 184683593770) - ) - ) - (drop - (f32x4.replace_lane 1 - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (f32.const 42) - ) - ) (drop - (f64x2.replace_lane 1 - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (f64.const 42) - ) - ) - (drop - (i8x16.shl - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (i32.const 1) - ) - ) - (drop - (i8x16.shr_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (i32.const 1) - ) - ) - (drop - (i8x16.shr_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (i32.const 1) - ) - ) - (drop - (i16x8.shl - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (i32.const 1) - ) - ) - (drop - (i16x8.shr_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (i32.const 1) - ) - ) - (drop - (i16x8.shr_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (i32.const 1) - ) - ) - (drop - (i32x4.shl - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (i32.const 1) - ) - ) - (drop - (i32x4.shr_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (i32.const 1) - ) - ) - (drop - (i32x4.shr_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (i32.const 1) - ) - ) - (drop - (i64x2.shl - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (i32.const 1) - ) - ) - (drop - (i64x2.shr_s - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (i32.const 1) - ) - ) - (drop - (i64x2.shr_u - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + (if (result i32) (i32.const 1) - ) - ) - (drop - (v128.load8_splat - (i32.const 128) - ) - ) - (drop - (v128.load16_splat offset=16 align=1 - (i32.const 128) - ) - ) - (drop - (v128.load32_splat offset=16 - (i32.const 128) - ) - ) - (drop - (v128.load64_splat align=4 - (i32.const 128) - ) - ) - (drop - (v128.load8x8_s - (i32.const 128) - ) - ) - (drop - (v128.load8x8_u - (i32.const 128) - ) - ) - (drop - (v128.load16x4_s - (i32.const 128) - ) - ) - (drop - (v128.load16x4_u - (i32.const 128) - ) - ) - (drop - (v128.load32x2_s - (i32.const 128) - ) - ) - (drop - (v128.load32x2_u - (i32.const 128) - ) - ) - (drop - (v128.load32_zero - (i32.const 128) - ) - ) - (drop - (v128.load64_zero - (i32.const 128) - ) - ) - (drop - (v128.load8_lane 0 - (i32.const 128) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (v128.load8_lane offset=1 15 - (i32.const 128) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (v128.load16_lane 0 - (i32.const 128) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (v128.load16_lane offset=2 align=1 7 - (i32.const 128) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (v128.load32_lane 0 - (i32.const 128) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (v128.load32_lane offset=4 align=2 3 - (i32.const 128) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (v128.load64_lane 0 - (i32.const 128) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (v128.load64_lane offset=8 align=4 1 - (i32.const 128) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (v128.store8_lane 0 - (i32.const 128) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - (v128.store8_lane offset=1 15 - (i32.const 128) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - (v128.store16_lane 0 - (i32.const 128) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - (v128.store16_lane offset=2 align=1 7 - (i32.const 128) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - (v128.store32_lane 0 - (i32.const 128) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - (v128.store32_lane offset=4 align=2 3 - (i32.const 128) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - (v128.store64_lane 0 - (i32.const 128) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - (v128.store64_lane offset=8 align=4 1 - (i32.const 128) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - (drop - (i8x16.shuffle 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (drop - (v128.bitselect - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) - ) - ) - (memory.init $x0 - (i32.const 1024) - (i32.const 0) - (i32.const 12) - ) - (data.drop $x0) - (memory.copy - (i32.const 2048) - (i32.const 1024) - (i32.const 12) - ) - (memory.fill - (i32.const 0) - (i32.const 42) - (i32.const 1024) - ) - (block - ) - (if - (i32.const 1) - (then - (drop + (then (i32.const 2) ) - ) - (else - (drop + (else (i32.const 3) ) ) diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c index a6a196ae6df..93a6281f885 100644 --- a/test/example/c-api-kitchen-sink.c +++ b/test/example/c-api-kitchen-sink.c @@ -973,7 +973,7 @@ void test_core() { // All the rest BinaryenBlock(module, NULL, NULL, 0, -1), // block with no name and no type BinaryenIf(module, temp1, temp2, temp3), - BinaryenIf(module, temp4, temp5, NULL), + BinaryenIf(module, temp4, BinaryenDrop(module, temp5), NULL), BinaryenLoop(module, "in", makeInt32(module, 0)), BinaryenLoop(module, NULL, makeInt32(module, 0)), BinaryenBreak(module, "the-value", temp6, temp7), @@ -1232,6 +1232,14 @@ void test_core() { BinaryenExpressionPrint( valueList[3]); // test printing a standalone expression + // Add drops of concrete expressions + for (int i = 0; i < sizeof(valueList) / sizeof(valueList[0]); ++i) { + BinaryenType type = BinaryenExpressionGetType(valueList[i]); + if (type != BinaryenTypeNone() && type != BinaryenTypeUnreachable()) { + valueList[i] = BinaryenDrop(module, valueList[i]); + } + } + // Make the main body of the function. and one block with a return value, one // without BinaryenExpressionRef value = @@ -1360,9 +1368,6 @@ void test_core() { BinaryenNop(module)); BinaryenSetStart(module, starter); - // A bunch of our code needs drop(), auto-add it - BinaryenModuleAutoDrop(module); - BinaryenFeatures features = BinaryenFeatureAll(); BinaryenModuleSetFeatures(module, features); assert(BinaryenModuleGetFeatures(module) == features); diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt index 657999a55d1..8a5b6dc87b7 100644 --- a/test/example/c-api-kitchen-sink.txt +++ b/test/example/c-api-kitchen-sink.txt @@ -1964,15 +1964,13 @@ BinaryenFeatureAll: 524287 ) (block ) - (if - (i32.const 1) - (then - (drop + (drop + (if (result i32) + (i32.const 1) + (then (i32.const 2) ) - ) - (else - (drop + (else (i32.const 3) ) ) diff --git a/test/example/c-api-relooper-unreachable-if.cpp b/test/example/c-api-relooper-unreachable-if.cpp index 96c6c114976..8723aea83f9 100644 --- a/test/example/c-api-relooper-unreachable-if.cpp +++ b/test/example/c-api-relooper-unreachable-if.cpp @@ -13,7 +13,6 @@ int main() { RelooperRef the_relooper = NULL; the_module = BinaryenModuleCreate(); expressions[size_t(NULL)] = BinaryenExpressionRef(NULL); - BinaryenModuleAutoDrop(the_module); { const char* segmentNames[] = {"0"}; const char* segmentDatas[] = {0}; diff --git a/test/example/c-api-unused-mem.cpp b/test/example/c-api-unused-mem.cpp index 750f3b703bc..f8bce00743a 100644 --- a/test/example/c-api-unused-mem.cpp +++ b/test/example/c-api-unused-mem.cpp @@ -14,7 +14,6 @@ int main() { RelooperRef the_relooper = NULL; the_module = BinaryenModuleCreate(); expressions[size_t(NULL)] = BinaryenExpressionRef(NULL); - BinaryenModuleAutoDrop(the_module); { const char* segmentNames[] = {"0"}; const char* segmentDatas[] = {0}; diff --git a/test/wasm2js/br_table_temp.2asm.js b/test/wasm2js/br_table_temp.2asm.js index 01a2238e146..245792eaf68 100644 --- a/test/wasm2js/br_table_temp.2asm.js +++ b/test/wasm2js/br_table_temp.2asm.js @@ -196,6 +196,7 @@ function asmFunc(imports) { function $14($0_1) { $0_1 = $0_1 | 0; + var $2_1 = 0; block1 : { switch ($0_1 | 0) { case 0: @@ -12577,7 +12578,7 @@ function asmFunc(imports) { } function $21() { - var $1_1 = 0; + var $1_1 = 0, $4_1 = 0, $2_1 = 0; label : { dummy(); $1_1 = 5; diff --git a/test/wasm2js/emscripten.2asm.js b/test/wasm2js/emscripten.2asm.js index 8ba8564ceea..24a556b25d7 100644 --- a/test/wasm2js/emscripten.2asm.js +++ b/test/wasm2js/emscripten.2asm.js @@ -192,6 +192,7 @@ function asmFunc(imports) { function bools(x) { x = x | 0; + var $32 = 0; bools((HEAPU8[0 >> 0] | 0) & 1 | 0 | 0) | 0; bools((HEAP8[0 >> 0] | 0) & 1 | 0 | 0) | 0; bools((HEAPU16[0 >> 1] | 0) & 1 | 0 | 0) | 0; diff --git a/test/wasm2js/labels.2asm.js b/test/wasm2js/labels.2asm.js index 431e172d9f0..37eb9fccb5e 100644 --- a/test/wasm2js/labels.2asm.js +++ b/test/wasm2js/labels.2asm.js @@ -20,7 +20,7 @@ function asmFunc(imports) { } function $1() { - var i = 0, $6_1 = 0; + var i = 0, $6_1 = 0, $9_1 = 0, $7_1 = 0; i = 0; exit : { cont : while (1) { @@ -36,7 +36,7 @@ function asmFunc(imports) { } function $2() { - var i = 0, $8_1 = 0; + var i = 0, $8_1 = 0, $13_1 = 0, $11_1 = 0; i = 0; exit : { cont : while (1) { @@ -74,7 +74,7 @@ function asmFunc(imports) { function $4(max) { max = max | 0; - var i = 0, $9_1 = 0; + var i = 0, $9_1 = 0, $12_1 = 0, $10_1 = 0; i = 1; exit : { cont : while (1) { diff --git a/test/wasm2js/refs.2asm.js b/test/wasm2js/refs.2asm.js index 45e510e3759..c105b1c1cbf 100644 --- a/test/wasm2js/refs.2asm.js +++ b/test/wasm2js/refs.2asm.js @@ -52,13 +52,13 @@ function asmFunc(imports) { function funcref_temps($0, $1) { $1 = +$1; - var $2 = null, $3 = null, wasm2js_funcref$0 = null, wasm2js_funcref$1 = null, wasm2js_i32$0 = 0; + var $2 = null, $3 = null; $2 = $0; loop : while (1) { $3 = funcref_temps; break loop; }; - funcref_temps(funcref_temps, +(+((wasm2js_funcref$0 = $2, wasm2js_funcref$1 = $3 || wasm2js_trap(), wasm2js_i32$0 = 0, wasm2js_i32$0 ? wasm2js_funcref$0 : wasm2js_funcref$1) == null | 0))); + funcref_temps(funcref_temps, +(+((0 ? $2 : $3) == null | 0))); } function named_type_temps() { diff --git a/test/wasm2js/switch.2asm.js b/test/wasm2js/switch.2asm.js index 8c4a1f0dd93..2d3dcdcec45 100644 --- a/test/wasm2js/switch.2asm.js +++ b/test/wasm2js/switch.2asm.js @@ -16,7 +16,7 @@ function asmFunc(imports) { var i64toi32_i32$HIGH_BITS = 0; function $0(i) { i = i | 0; - var j = 0; + var j = 0, $7 = 0; j = 100; switch_ : { $7 : { @@ -49,7 +49,7 @@ function asmFunc(imports) { function $1(i, i$hi) { i = i | 0; i$hi = i$hi | 0; - var i64toi32_i32$5 = 0, i64toi32_i32$2 = 0, $7 = 0, $7$hi = 0, j = 0, j$hi = 0; + var i64toi32_i32$5 = 0, i64toi32_i32$2 = 0, $7 = 0, $7$hi = 0, j = 0, j$hi = 0, $10$hi = 0, $10 = 0; j = 100; j$hi = 0; switch_ : { diff --git a/test/wasm2js/unreachable-later.2asm.js b/test/wasm2js/unreachable-later.2asm.js index e5bc7d51661..bf1ed59f10c 100644 --- a/test/wasm2js/unreachable-later.2asm.js +++ b/test/wasm2js/unreachable-later.2asm.js @@ -15,7 +15,7 @@ function asmFunc(imports) { var global$0 = 10; function $0($0_1) { $0_1 = $0_1 | 0; - var $15 = Math_fround(0), $21 = 0, $29 = 0, $26 = 0; + var $15 = Math_fround(0), $21 = 0, $29 = 0, $26 = 0, $32 = 0; if (global$0) { return $0_1 | 0 } From 55c5f551b1009522791acbf9a9810a3a42e26606 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Thu, 21 Nov 2024 20:09:43 -0800 Subject: [PATCH 43/56] Print castType for unreachable br_on_cast{_fail} I forgot that there is a validation rule that the output type for br_on_cast and br_on_cast_fail must be a subtype of the input type. We were previously printing bottom input types in cases where the cast operand was unreachable, but that's only valid if the cast type is the same bottom type. Instead print the most precise valid input type, which is the cast type itself. --- src/passes/Print.cpp | 10 ++++------ test/lit/wat-kitchen-sink.wast | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index 5c8463f78fa..22bc3fe81ba 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -2221,10 +2221,9 @@ struct PrintExpressionContents o << ' '; if (curr->ref->type == Type::unreachable) { // Need to print some reference type in the correct hierarchy rather - // than unreachable, and the bottom type is valid in the most - // contexts. - printType( - Type(curr->castType.getHeapType().getBottom(), NonNullable)); + // than unreachable, and the cast type itself is the best possible + // option. + printType(curr->castType); } else { printType(curr->ref->type); } @@ -2236,8 +2235,7 @@ struct PrintExpressionContents curr->name.print(o); o << ' '; if (curr->ref->type == Type::unreachable) { - printType( - Type(curr->castType.getHeapType().getBottom(), NonNullable)); + printType(curr->castType); } else { printType(curr->ref->type); } diff --git a/test/lit/wat-kitchen-sink.wast b/test/lit/wat-kitchen-sink.wast index 719cf2db383..2c268083a93 100644 --- a/test/lit/wat-kitchen-sink.wast +++ b/test/lit/wat-kitchen-sink.wast @@ -4069,7 +4069,7 @@ ;; CHECK-NEXT: (block $block (result i31ref) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (block (result (ref any)) - ;; CHECK-NEXT: (br_on_cast $block (ref none) i31ref + ;; CHECK-NEXT: (br_on_cast $block i31ref i31ref ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -4119,7 +4119,7 @@ ;; CHECK-NEXT: (block $block (result (ref any)) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (block (result i31ref) - ;; CHECK-NEXT: (br_on_cast_fail $block (ref none) i31ref + ;; CHECK-NEXT: (br_on_cast_fail $block i31ref i31ref ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) From 47753ed394ca3e76b753858f4cb8463ecfe85c37 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Fri, 22 Nov 2024 10:18:41 -0800 Subject: [PATCH 44/56] Print unreachable loads with valid types Since Load expressions use their `type` field to encode the type of the loaded value, unreachable loads need to come up with some other valid type to print. Previously we always chose i32 as that type, but that's not valid when the load was originally a v128 load with an alignment of 8, since 8 is greater than the maximum valid alignment of 4 for an i32. Fix the problem by taking alignment into account when choosing a type for the unreachable load. --- src/passes/Print.cpp | 10 +++++++++- test/lit/wat-kitchen-sink.wast | 19 ++++++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index 5c8463f78fa..0b15477ee9f 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -106,6 +106,14 @@ static Type forceConcrete(Type type) { return type.isConcrete() ? type : Type::i32; } +// Whatever type we print must be valid for the alignment. +static Type forceConcrete(Type type, Index align) { + return type.isConcrete() ? type + : align >= 16 ? Type::v128 + : align >= 8 ? Type::i64 + : Type::i32; +} + struct PrintSExpression : public UnifiedExpressionVisitor { std::ostream& o; unsigned indent = 0; @@ -538,7 +546,7 @@ struct PrintExpressionContents curr->name.print(o); } void visitLoad(Load* curr) { - prepareColor(o) << forceConcrete(curr->type); + prepareColor(o) << forceConcrete(curr->type, curr->align); if (curr->isAtomic) { o << ".atomic"; } diff --git a/test/lit/wat-kitchen-sink.wast b/test/lit/wat-kitchen-sink.wast index 719cf2db383..52cb2ca1d5c 100644 --- a/test/lit/wat-kitchen-sink.wast +++ b/test/lit/wat-kitchen-sink.wast @@ -3171,6 +3171,23 @@ drop ) + ;; CHECK: (func $load-v128-unreachable (type $0) + ;; CHECK-NEXT: (v128.load $mimport$0 + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i64.load $mimport$0 align=8 + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) + (func $load-v128-unreachable + unreachable + v128.load align=16 + unreachable + v128.load align=8 + unreachable + ) + ;; CHECK: (func $store (type $7) (param $0 i32) (param $1 i64) ;; CHECK-NEXT: (i32.store $mimport$0 offset=42 align=1 ;; CHECK-NEXT: (local.get $0) @@ -3660,7 +3677,7 @@ (func $ref-func ref.func $ref-func drop - ref.func 161 + ref.func 162 drop ) From 485ac7da1e72d1b6d4305317eb7fe1a9dd046c0a Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Fri, 22 Nov 2024 16:28:11 -0800 Subject: [PATCH 45/56] Do note code fold ifs with concrete arms Code folding does not support folding tails that produce concrete values, but it previously did not check for this condition when deciding whether to attempt to code fold ifs. As a result, code folding would proceed on ifs with concretely typed arms. The incorrect block types produced by the folding logic as a result of the violated assumption that the folded tails would never produce concrete values were papered over by later refinalization, so this never caused problems. However, an upcoming change (#7094) that relaxes the typing of ifs to allow them to be unreachable whenever their conditions are unreachable makes it possible for the violated assumptions in code folding to cause problems that are not fixed by refinalization. Fix code folding to disallow folding of concretely typed if arms and add a test that would fail once #7094 lands without this fix. --- src/passes/CodeFolding.cpp | 4 + .../passes/code-folding_enable-threads.wast | 63 ++++++- .../inlining-optimizing_optimize-level=3.wast | 53 +++--- .../remove-unused-names_code-folding.txt | 170 ++++++++++-------- 4 files changed, 179 insertions(+), 111 deletions(-) diff --git a/src/passes/CodeFolding.cpp b/src/passes/CodeFolding.cpp index 21527da6b18..47e7916fab0 100644 --- a/src/passes/CodeFolding.cpp +++ b/src/passes/CodeFolding.cpp @@ -243,6 +243,10 @@ struct CodeFolding : public WalkerPass> { if (!curr->ifFalse) { return; } + if (curr->ifTrue->type.isConcrete()) { + // We don't support folding tails that produce values. + return; + } // if both sides are identical, this is easy to fold if (ExpressionAnalyzer::equal(curr->ifTrue, curr->ifFalse)) { Builder builder(*getModule()); diff --git a/test/lit/passes/code-folding_enable-threads.wast b/test/lit/passes/code-folding_enable-threads.wast index b07000278ed..3df2d8c8aeb 100644 --- a/test/lit/passes/code-folding_enable-threads.wast +++ b/test/lit/passes/code-folding_enable-threads.wast @@ -83,11 +83,18 @@ ) ) ;; CHECK: (func $negative-zero-b (result f32) - ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (if (result f32) ;; CHECK-NEXT: (i32.const 0) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (block $label$0 (result f32) - ;; CHECK-NEXT: (f32.const -0) + ;; CHECK-NEXT: (then + ;; CHECK-NEXT: (block $label$0 (result f32) + ;; CHECK-NEXT: (f32.const -0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (else + ;; CHECK-NEXT: (block $label$1 (result f32) + ;; CHECK-NEXT: (f32.const -0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $negative-zero-b (result f32) @@ -106,11 +113,18 @@ ) ) ;; CHECK: (func $negative-zero-c (result f32) - ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (if (result f32) ;; CHECK-NEXT: (i32.const 0) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (block $label$0 (result f32) - ;; CHECK-NEXT: (f32.const 0) + ;; CHECK-NEXT: (then + ;; CHECK-NEXT: (block $label$0 (result f32) + ;; CHECK-NEXT: (f32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (else + ;; CHECK-NEXT: (block $label$1 (result f32) + ;; CHECK-NEXT: (f32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $negative-zero-c (result f32) @@ -482,3 +496,36 @@ ) ) ) + +(module + ;; CHECK: (type $0 (func)) + + ;; CHECK: (func $unreachable-if-concrete-arms + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (if (result i32) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: (then + ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (else + ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) + (func $unreachable-if-concrete-arms + (if (result i32) + (unreachable) + (then + (i32.const 1) + ) + (else + (nop) + (i32.const 1) + ) + ) + (unreachable) + ) +) diff --git a/test/lit/passes/inlining-optimizing_optimize-level=3.wast b/test/lit/passes/inlining-optimizing_optimize-level=3.wast index f6df7305620..9e514cc2733 100644 --- a/test/lit/passes/inlining-optimizing_optimize-level=3.wast +++ b/test/lit/passes/inlining-optimizing_optimize-level=3.wast @@ -5742,43 +5742,44 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (if - ;; CHECK-NEXT: (i32.and - ;; CHECK-NEXT: (local.get $9) - ;; CHECK-NEXT: (i32.const 8) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (then - ;; CHECK-NEXT: (local.set $7 + ;; CHECK-NEXT: (local.set $5 + ;; CHECK-NEXT: (if (result i32) + ;; CHECK-NEXT: (i32.and ;; CHECK-NEXT: (local.get $9) + ;; CHECK-NEXT: (i32.const 8) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.set $6 - ;; CHECK-NEXT: (select - ;; CHECK-NEXT: (local.tee $5 - ;; CHECK-NEXT: (i32.add - ;; CHECK-NEXT: (i32.sub - ;; CHECK-NEXT: (local.get $23) - ;; CHECK-NEXT: (local.get $8) + ;; CHECK-NEXT: (then + ;; CHECK-NEXT: (local.set $7 + ;; CHECK-NEXT: (local.get $9) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $6 + ;; CHECK-NEXT: (select + ;; CHECK-NEXT: (local.tee $5 + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (i32.sub + ;; CHECK-NEXT: (local.get $23) + ;; CHECK-NEXT: (local.get $8) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 1) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (i32.const 1) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.get $6) - ;; CHECK-NEXT: (i32.gt_s - ;; CHECK-NEXT: (local.get $5) ;; CHECK-NEXT: (local.get $6) + ;; CHECK-NEXT: (i32.gt_s + ;; CHECK-NEXT: (local.get $5) + ;; CHECK-NEXT: (local.get $6) + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $8) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (else - ;; CHECK-NEXT: (local.set $7 - ;; CHECK-NEXT: (local.get $9) + ;; CHECK-NEXT: (else + ;; CHECK-NEXT: (local.set $7 + ;; CHECK-NEXT: (local.get $9) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $8) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.set $5 - ;; CHECK-NEXT: (local.get $8) - ;; CHECK-NEXT: ) ;; CHECK-NEXT: (local.set $8 ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: ) diff --git a/test/passes/remove-unused-names_code-folding.txt b/test/passes/remove-unused-names_code-folding.txt index d0486b3c784..4b228bd4ee1 100644 --- a/test/passes/remove-unused-names_code-folding.txt +++ b/test/passes/remove-unused-names_code-folding.txt @@ -26,13 +26,19 @@ ) ) (drop - (block (result i32) - (drop - (i32.const 0) + (if (result i32) + (i32.const 0) + (then + (i32.add + (i32.const 1) + (i32.const 2) + ) ) - (i32.add - (i32.const 1) - (i32.const 2) + (else + (i32.add + (i32.const 1) + (i32.const 2) + ) ) ) ) @@ -218,54 +224,61 @@ (unreachable) ) (drop - (block (result i32) - (if - (i32.const 2) - (then - (drop - (i32.const -1234) - ) - (drop - (i32.const -1000) - ) + (if (result i32) + (i32.const 2) + (then + (drop + (i32.const -1234) ) - (else - (drop - (i32.const 999) - ) + (drop + (i32.const -1000) ) + (drop + (i32.const 1) + ) + (nop) + (unreachable) + (i32.const 2) ) - (drop - (i32.const 1) + (else + (drop + (i32.const 999) + ) + (drop + (i32.const 1) + ) + (nop) + (unreachable) + (i32.const 2) ) - (nop) - (unreachable) - (i32.const 2) ) ) (drop - (block (result i32) - (if - (i32.const 3) - (then - (drop - (i32.const -1234) - ) - (drop - (i32.const -1000) - ) + (if (result i32) + (i32.const 3) + (then + (drop + (i32.const -1234) ) - (else - (drop - (i32.const 999) - ) + (drop + (i32.const -1000) ) + (drop + (i32.const 1) + ) + (nop) + (i32.const 2) ) - (drop - (i32.const 1) + (else + (drop + (i32.const 999) + ) + (drop + (i32.const 1) + ) + (nop) + (i32.const 2) ) - (nop) - (i32.const 2) ) ) ) @@ -388,28 +401,28 @@ ) (drop (block (result i32) - (block (result i32) - (if - (i32.const 9999) - (then - (drop - (i32.const -51234) - ) - (drop - (i32.const -51000) - ) + (if (result i32) + (i32.const 9999) + (then + (drop + (i32.const -51234) ) - (else - (drop - (i32.const 5999) - ) - (drop - (i32.const 51) - ) + (drop + (i32.const -51000) ) + (unreachable) + (i32.const 10) + ) + (else + (drop + (i32.const 5999) + ) + (drop + (i32.const 51) + ) + (unreachable) + (i32.const 10) ) - (unreachable) - (i32.const 10) ) ) ) @@ -1523,11 +1536,15 @@ ) (nop) (drop - (block (result i32) - (drop - (unreachable) + (if (result i32) + (unreachable) + (then + (i32.add + (i32.const 1) + (i32.const 2) + ) ) - (block (result i32) + (else (i32.add (i32.const 1) (i32.const 2) @@ -1874,20 +1891,19 @@ (i32.const 1) ) ) - (block (result i32) - (if - (local.get $x) - (then - ) - (else - (drop - (call $if-suffix - (i32.const -2) - ) + (if (result i32) + (local.get $x) + (then + (i32.const 2) + ) + (else + (drop + (call $if-suffix + (i32.const -2) ) ) + (i32.const 2) ) - (i32.const 2) ) ) ) From ef975ee6193623da0b49b23ecfc3fdff7f0b3a83 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Fri, 22 Nov 2024 17:01:42 -0800 Subject: [PATCH 46/56] revert obsolete changes to CodeFolding --- src/passes/CodeFolding.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/passes/CodeFolding.cpp b/src/passes/CodeFolding.cpp index e484858d85f..47e7916fab0 100644 --- a/src/passes/CodeFolding.cpp +++ b/src/passes/CodeFolding.cpp @@ -253,12 +253,8 @@ struct CodeFolding : public WalkerPass> { // remove if (4 bytes), remove one arm, add drop (1), add block (3), // so this must be a net savings markAsModified(curr); - auto* ifTrue = curr->ifTrue; - if (curr->type == Type::unreachable) { - ifTrue = builder.dropIfConcretelyTyped(ifTrue); - } auto* ret = - builder.makeSequence(builder.makeDrop(curr->condition), ifTrue); + builder.makeSequence(builder.makeDrop(curr->condition), curr->ifTrue); // we must ensure we present the same type as the if had ret->finalize(curr->type); replaceCurrent(ret); From 4d94f344ab9999711fe4fc3a5db9f9bb76fefc77 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Fri, 22 Nov 2024 20:24:55 -0800 Subject: [PATCH 47/56] Take BrOn into account in CodeFolding CodeFolding previously did not consider br_on_* instructions at all, so it would happily merge tails even if there were br_on_* branches to the same label with non-matching tails. Fix the bug by making any label targeted by a br_on_* branch unoptimizable. Folding these branches properly is left as future work. Also rename the test file from code-folding_enable-threads.wast to just code-folding.wast and enable all features instead of just threads. The old name was left over from when the test was originally ported to lit, and the new feature is necessary because the new test uses GC instructions. --- src/passes/CodeFolding.cpp | 8 +++ ..._enable-threads.wast => code-folding.wast} | 65 +++++++++++++++---- 2 files changed, 60 insertions(+), 13 deletions(-) rename test/lit/passes/{code-folding_enable-threads.wast => code-folding.wast} (88%) diff --git a/src/passes/CodeFolding.cpp b/src/passes/CodeFolding.cpp index 47e7916fab0..b354119dc8a 100644 --- a/src/passes/CodeFolding.cpp +++ b/src/passes/CodeFolding.cpp @@ -155,6 +155,14 @@ struct CodeFolding : public WalkerPass> { } } + void visitBrOn(BrOn* curr) { + // TODO: Handle folding br_on* instructions. br_on_null could be folded with + // other kinds of branches and br_on_non_null, br_on_cast, and + // br_on_cast_fail instructions could be folded with other copies of + // themselves. + unoptimizables.insert(curr->name); + } + void visitSwitch(Switch* curr) { for (auto target : curr->targets) { unoptimizables.insert(target); diff --git a/test/lit/passes/code-folding_enable-threads.wast b/test/lit/passes/code-folding.wast similarity index 88% rename from test/lit/passes/code-folding_enable-threads.wast rename to test/lit/passes/code-folding.wast index 3df2d8c8aeb..532c06d8a98 100644 --- a/test/lit/passes/code-folding_enable-threads.wast +++ b/test/lit/passes/code-folding.wast @@ -1,7 +1,7 @@ ;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. ;; NOTE: This test was ported using port_passes_tests_to_lit.py and could be cleaned up. -;; RUN: foreach %s %t wasm-opt --code-folding --enable-threads -S -o - | filecheck %s +;; RUN: foreach %s %t wasm-opt -all --code-folding -S -o - | filecheck %s (module ;; CHECK: (type $0 (func)) @@ -15,13 +15,13 @@ (memory $0 1 1) ;; CHECK: (table $0 282 282 funcref) - ;; CHECK: (func $0 + ;; CHECK: (func $0 (type $0) ;; CHECK-NEXT: (block $label$1 ;; CHECK-NEXT: (if ;; CHECK-NEXT: (i32.const 1) ;; CHECK-NEXT: (then ;; CHECK-NEXT: (block $label$3 - ;; CHECK-NEXT: (call_indirect (type $13) + ;; CHECK-NEXT: (call_indirect $0 (type $13) ;; CHECK-NEXT: (block $label$4 ;; CHECK-NEXT: (br $label$3) ;; CHECK-NEXT: ) @@ -52,7 +52,7 @@ ) ) ) - ;; CHECK: (func $negative-zero (result f32) + ;; CHECK: (func $negative-zero (type $1) (result f32) ;; CHECK-NEXT: (if (result f32) ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: (then @@ -82,7 +82,7 @@ ) ) ) - ;; CHECK: (func $negative-zero-b (result f32) + ;; CHECK: (func $negative-zero-b (type $1) (result f32) ;; CHECK-NEXT: (if (result f32) ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: (then @@ -112,7 +112,7 @@ ) ) ) - ;; CHECK: (func $negative-zero-c (result f32) + ;; CHECK: (func $negative-zero-c (type $1) (result f32) ;; CHECK-NEXT: (if (result f32) ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: (then @@ -142,7 +142,7 @@ ) ) ) - ;; CHECK: (func $break-target-outside-of-return-merged-code + ;; CHECK: (func $break-target-outside-of-return-merged-code (type $0) ;; CHECK-NEXT: (block $label$A ;; CHECK-NEXT: (if ;; CHECK-NEXT: (unreachable) @@ -216,7 +216,7 @@ ) ) ) - ;; CHECK: (func $break-target-inside-all-good + ;; CHECK: (func $break-target-inside-all-good (type $0) ;; CHECK-NEXT: (block $folding-inner0 ;; CHECK-NEXT: (block $label$A ;; CHECK-NEXT: (if @@ -283,7 +283,7 @@ ) ) ) - ;; CHECK: (func $leave-inner-block-type + ;; CHECK: (func $leave-inner-block-type (type $0) ;; CHECK-NEXT: (block $label$1 ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (block $label$2 @@ -326,7 +326,7 @@ (memory $0 1 1 shared) ;; CHECK: (export "func_2224" (func $0)) (export "func_2224" (func $0)) - ;; CHECK: (func $0 (result i32) + ;; CHECK: (func $0 (type $0) (result i32) ;; CHECK-NEXT: (local $var$0 i32) ;; CHECK-NEXT: (if (result i32) ;; CHECK-NEXT: (i32.const 0) @@ -366,7 +366,7 @@ ;; CHECK: (global $global$0 (mut i32) (i32.const 10)) (global $global$0 (mut i32) (i32.const 10)) - ;; CHECK: (func $determinism + ;; CHECK: (func $determinism (type $0) ;; CHECK-NEXT: (block $folding-inner0 ;; CHECK-NEXT: (block ;; CHECK-NEXT: (block $label$1 @@ -453,7 +453,7 @@ ) (unreachable) ) - ;; CHECK: (func $careful-of-the-switch (param $0 i32) + ;; CHECK: (func $careful-of-the-switch (type $1) (param $0 i32) ;; CHECK-NEXT: (block $label$1 ;; CHECK-NEXT: (block $label$3 ;; CHECK-NEXT: (block $label$5 @@ -500,7 +500,7 @@ (module ;; CHECK: (type $0 (func)) - ;; CHECK: (func $unreachable-if-concrete-arms + ;; CHECK: (func $unreachable-if-concrete-arms (type $0) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (if (result i32) ;; CHECK-NEXT: (unreachable) @@ -529,3 +529,42 @@ (unreachable) ) ) + +(module + ;; CHECK: (type $0 (func)) + + ;; CHECK: (func $br-on-null (type $0) + ;; CHECK-NEXT: (block $block + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (br_on_null $block + ;; CHECK-NEXT: (ref.null none) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (block (result i32) + ;; CHECK-NEXT: (call $br-on-null) + ;; CHECK-NEXT: (br $block) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (call $br-on-null) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $br-on-null + (block $block + (drop + ;; The other two tails are the same, but this br_on_null should inhibit code + ;; folding. + (br_on_null $block + (ref.null none) + ) + ) + (drop + (block (result i32) + (call $br-on-null) + (br $block) + ) + ) + (call $br-on-null) + ) + ) +) From 640a101575e1d108bed8e3bf3e7f1af524057496 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Mon, 25 Nov 2024 10:49:35 -0800 Subject: [PATCH 48/56] Fix memory.grow bounds and overflow checks for mem64 Previously the interpreter only executed overflow and bounds checks for memory.grow on 32-bit memories. Run the checks on 64-bit memories as well. --- src/wasm-interpreter.h | 8 ++++++-- test/lit/exec/memory64.wast | 12 ++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h index f3471cfa85c..568d3138480 100644 --- a/src/wasm-interpreter.h +++ b/src/wasm-interpreter.h @@ -3836,10 +3836,14 @@ class ModuleRunnerBase : public ExpressionRunner { auto fail = Literal::makeFromInt64(-1, memory->addressType); Flow ret = Literal::makeFromInt64(memorySize, addressType); uint64_t delta = flow.getSingleValue().getUnsigned(); - if (delta > uint32_t(-1) / Memory::kPageSize && addressType == Type::i32) { + uint64_t maxAddr = + addressType == Type::i32 ? uint64_t(uint32_t(-1)) : uint64_t(-1); + if (delta > maxAddr / Memory::kPageSize) { + // Impossible to grow this much. return fail; } - if (memorySize >= uint32_t(-1) - delta && addressType == Type::i32) { + if (memorySize >= maxAddr - delta) { + // Overflow. return fail; } auto newSize = memorySize + delta; diff --git a/test/lit/exec/memory64.wast b/test/lit/exec/memory64.wast index 273f2679aad..0d28e719fc4 100644 --- a/test/lit/exec/memory64.wast +++ b/test/lit/exec/memory64.wast @@ -28,6 +28,14 @@ (i32.const 10) ) ) + + ;; CHECK: [fuzz-exec] calling memory.grow.fail + ;; CHECK-NEXT: [fuzz-exec] note result: memory.grow.fail => -1 + (func $memory.grow.fail (export "memory.grow.fail") (result i64) + (memory.grow + (i64.const -1) + ) + ) ) ;; CHECK: [fuzz-exec] calling memory.init.trap @@ -35,5 +43,9 @@ ;; CHECK: [fuzz-exec] calling memory.init.trap2 ;; CHECK-NEXT: [trap out of bounds segment access in memory.init] + +;; CHECK: [fuzz-exec] calling memory.grow.fail +;; CHECK-NEXT: [fuzz-exec] note result: memory.grow.fail => -1 +;; CHECK-NEXT: [fuzz-exec] comparing memory.grow.fail ;; CHECK-NEXT: [fuzz-exec] comparing memory.init.trap ;; CHECK-NEXT: [fuzz-exec] comparing memory.init.trap2 From 2d8a8bcc167eb42ad76abab2669940cce47788e8 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Fri, 22 Nov 2024 20:24:55 -0800 Subject: [PATCH 49/56] Handle unoptimized branches in CodeFolding CodeFolding previously did not consider br_on_* instructions at all, so it would happily merge tails even if there were br_on_* branches to the same label with non-matching tails. Fix the bug by making any label targeted by any instruction not explicitly handled by CodeFolding unoptimizable. This will gracefully handle other branching instructions like `resume` and `resume_throw` as well. Folding these branches properly is left as future work. Also rename the test file from code-folding_enable-threads.wast to just code-folding.wast and enable all features instead of just threads. The old name was left over from when the test was originally ported to lit, and the new feature is necessary because the new test uses GC instructions. --- src/passes/CodeFolding.cpp | 8 +++ ..._enable-threads.wast => code-folding.wast} | 63 +++++++++++++++---- 2 files changed, 59 insertions(+), 12 deletions(-) rename test/lit/passes/{code-folding_enable-threads.wast => code-folding.wast} (87%) diff --git a/src/passes/CodeFolding.cpp b/src/passes/CodeFolding.cpp index 21527da6b18..d3d744f6b44 100644 --- a/src/passes/CodeFolding.cpp +++ b/src/passes/CodeFolding.cpp @@ -155,6 +155,14 @@ struct CodeFolding : public WalkerPass> { } } + void visitBrOn(BrOn* curr) { + // TODO: Handle folding br_on* instructions. br_on_null could be folded with + // other kinds of branches and br_on_non_null, br_on_cast, and + // br_on_cast_fail instructions could be folded with other copies of + // themselves. + unoptimizables.insert(curr->name); + } + void visitSwitch(Switch* curr) { for (auto target : curr->targets) { unoptimizables.insert(target); diff --git a/test/lit/passes/code-folding_enable-threads.wast b/test/lit/passes/code-folding.wast similarity index 87% rename from test/lit/passes/code-folding_enable-threads.wast rename to test/lit/passes/code-folding.wast index b07000278ed..35816748149 100644 --- a/test/lit/passes/code-folding_enable-threads.wast +++ b/test/lit/passes/code-folding.wast @@ -1,7 +1,7 @@ ;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. ;; NOTE: This test was ported using port_passes_tests_to_lit.py and could be cleaned up. -;; RUN: foreach %s %t wasm-opt --code-folding --enable-threads -S -o - | filecheck %s +;; RUN: foreach %s %t wasm-opt -all --code-folding -S -o - | filecheck %s (module ;; CHECK: (type $0 (func)) @@ -15,13 +15,13 @@ (memory $0 1 1) ;; CHECK: (table $0 282 282 funcref) - ;; CHECK: (func $0 + ;; CHECK: (func $0 (type $0) ;; CHECK-NEXT: (block $label$1 ;; CHECK-NEXT: (if ;; CHECK-NEXT: (i32.const 1) ;; CHECK-NEXT: (then ;; CHECK-NEXT: (block $label$3 - ;; CHECK-NEXT: (call_indirect (type $13) + ;; CHECK-NEXT: (call_indirect $0 (type $13) ;; CHECK-NEXT: (block $label$4 ;; CHECK-NEXT: (br $label$3) ;; CHECK-NEXT: ) @@ -52,7 +52,7 @@ ) ) ) - ;; CHECK: (func $negative-zero (result f32) + ;; CHECK: (func $negative-zero (type $1) (result f32) ;; CHECK-NEXT: (if (result f32) ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: (then @@ -82,7 +82,7 @@ ) ) ) - ;; CHECK: (func $negative-zero-b (result f32) + ;; CHECK: (func $negative-zero-b (type $1) (result f32) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: ) @@ -105,7 +105,7 @@ ) ) ) - ;; CHECK: (func $negative-zero-c (result f32) + ;; CHECK: (func $negative-zero-c (type $1) (result f32) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: ) @@ -128,7 +128,7 @@ ) ) ) - ;; CHECK: (func $break-target-outside-of-return-merged-code + ;; CHECK: (func $break-target-outside-of-return-merged-code (type $0) ;; CHECK-NEXT: (block $label$A ;; CHECK-NEXT: (if ;; CHECK-NEXT: (unreachable) @@ -202,7 +202,7 @@ ) ) ) - ;; CHECK: (func $break-target-inside-all-good + ;; CHECK: (func $break-target-inside-all-good (type $0) ;; CHECK-NEXT: (block $folding-inner0 ;; CHECK-NEXT: (block $label$A ;; CHECK-NEXT: (if @@ -269,7 +269,7 @@ ) ) ) - ;; CHECK: (func $leave-inner-block-type + ;; CHECK: (func $leave-inner-block-type (type $0) ;; CHECK-NEXT: (block $label$1 ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (block $label$2 @@ -312,7 +312,7 @@ (memory $0 1 1 shared) ;; CHECK: (export "func_2224" (func $0)) (export "func_2224" (func $0)) - ;; CHECK: (func $0 (result i32) + ;; CHECK: (func $0 (type $0) (result i32) ;; CHECK-NEXT: (local $var$0 i32) ;; CHECK-NEXT: (if (result i32) ;; CHECK-NEXT: (i32.const 0) @@ -352,7 +352,7 @@ ;; CHECK: (global $global$0 (mut i32) (i32.const 10)) (global $global$0 (mut i32) (i32.const 10)) - ;; CHECK: (func $determinism + ;; CHECK: (func $determinism (type $0) ;; CHECK-NEXT: (block $folding-inner0 ;; CHECK-NEXT: (block ;; CHECK-NEXT: (block $label$1 @@ -439,7 +439,7 @@ ) (unreachable) ) - ;; CHECK: (func $careful-of-the-switch (param $0 i32) + ;; CHECK: (func $careful-of-the-switch (type $1) (param $0 i32) ;; CHECK-NEXT: (block $label$1 ;; CHECK-NEXT: (block $label$3 ;; CHECK-NEXT: (block $label$5 @@ -482,3 +482,42 @@ ) ) ) + +(module + ;; CHECK: (type $0 (func)) + + ;; CHECK: (func $br-on-null (type $0) + ;; CHECK-NEXT: (block $block + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (br_on_null $block + ;; CHECK-NEXT: (ref.null none) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (block (result i32) + ;; CHECK-NEXT: (call $br-on-null) + ;; CHECK-NEXT: (br $block) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (call $br-on-null) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $br-on-null + (block $block + (drop + ;; The other two tails are the same, but this br_on_null should inhibit code + ;; folding. + (br_on_null $block + (ref.null none) + ) + ) + (drop + (block (result i32) + (call $br-on-null) + (br $block) + ) + ) + (call $br-on-null) + ) + ) +) From 4ba1882f608237f0593f31976922f8aae4f1f88c Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Mon, 25 Nov 2024 10:59:13 -0800 Subject: [PATCH 50/56] Use BranchUtils --- src/passes/CodeFolding.cpp | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/passes/CodeFolding.cpp b/src/passes/CodeFolding.cpp index d3d744f6b44..0cddec4ca3f 100644 --- a/src/passes/CodeFolding.cpp +++ b/src/passes/CodeFolding.cpp @@ -84,7 +84,9 @@ struct ExpressionMarker void visitExpression(Expression* expr) { marked.insert(expr); } }; -struct CodeFolding : public WalkerPass> { +struct CodeFolding + : public WalkerPass< + ControlFlowWalker>> { bool isFunctionParallel() override { return true; } std::unique_ptr create() override { @@ -138,6 +140,17 @@ struct CodeFolding : public WalkerPass> { // walking + void visitExpression(Expression* curr) { + // For any branching instruction not explicitly handled by this pass, mark + // the labels it branches to unoptimizable. + // TODO: Handle folding br_on* instructions. br_on_null could be folded with + // other kinds of branches and br_on_non_null, br_on_cast, and + // br_on_cast_fail instructions could be folded with other copies of + // themselves. + BranchUtils::operateOnScopeNameUses( + curr, [&](Name label) { unoptimizables.insert(label); }); + } + void visitBreak(Break* curr) { if (curr->condition || curr->value) { unoptimizables.insert(curr->name); @@ -155,21 +168,6 @@ struct CodeFolding : public WalkerPass> { } } - void visitBrOn(BrOn* curr) { - // TODO: Handle folding br_on* instructions. br_on_null could be folded with - // other kinds of branches and br_on_non_null, br_on_cast, and - // br_on_cast_fail instructions could be folded with other copies of - // themselves. - unoptimizables.insert(curr->name); - } - - void visitSwitch(Switch* curr) { - for (auto target : curr->targets) { - unoptimizables.insert(target); - } - unoptimizables.insert(curr->default_); - } - void visitUnreachable(Unreachable* curr) { // we can only optimize if we are at the end of the parent block if (!controlFlowStack.empty()) { From 2936897f722f9b52bc1de954d345c7162561e47a Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Mon, 25 Nov 2024 19:35:38 -0800 Subject: [PATCH 51/56] Handle concrete values in CodeFolding CodeFolding previously only worked on blocks that did not produce values. It worked on Ifs that produced values, but only by accident; the logic for folding matching tails was not written to support tails producing concrete values, but it happened to work for Ifs because subsequent ReFinalize runs fixed all the incorrect types it produced. Improve the power of the optimization by explicitly handling tails that produce concrete values for both blocks and ifs. Now that the core logic handles concrete values correctly, remove the unnecessary ReFinalize run. --- src/passes/CodeFolding.cpp | 154 +++--- test/lit/passes/code-folding.wast | 382 +++++++++++++-- test/passes/O3_low-memory-unused_metrics.txt | 438 +++++++++--------- .../remove-unused-names_code-folding.txt | 23 +- 4 files changed, 632 insertions(+), 365 deletions(-) diff --git a/src/passes/CodeFolding.cpp b/src/passes/CodeFolding.cpp index 0cddec4ca3f..29873c73ef6 100644 --- a/src/passes/CodeFolding.cpp +++ b/src/passes/CodeFolding.cpp @@ -106,18 +106,11 @@ struct CodeFolding // For a break Tail(Expression* expr, Block* block) : expr(expr), block(block), pointer(nullptr) { - validate(); } Tail(Expression* expr, Expression** pointer) : expr(expr), block(nullptr), pointer(pointer) {} bool isFallthrough() const { return expr == nullptr; } - - void validate() const { - if (expr && block) { - assert(block->list.back() == expr); - } - } }; // state @@ -152,15 +145,13 @@ struct CodeFolding } void visitBreak(Break* curr) { - if (curr->condition || curr->value) { + if (curr->condition) { unoptimizables.insert(curr->name); } else { - // we can only optimize if we are at the end of the parent block, - // and if the parent block does not return a value (we can't move - // elements out of it if there is a value being returned) + // we can only optimize if we are at the end of the parent block. + // TODO: Relax this. Block* parent = controlFlowStack.back()->dynCast(); - if (parent && curr == parent->list.back() && - !parent->list.back()->type.isConcrete()) { + if (parent && curr == parent->list.back()) { breakTails[curr->name].push_back(Tail(curr, parent)); } else { unoptimizables.insert(curr->name); @@ -222,24 +213,19 @@ struct CodeFolding if (unoptimizables.count(curr->name) > 0) { return; } - // we can't optimize a fallthrough value - if (curr->list.back()->type.isConcrete()) { - return; - } auto iter = breakTails.find(curr->name); if (iter == breakTails.end()) { return; } - // looks promising + // Looks promising. auto& tails = iter->second; - // see if there is a fallthrough - bool hasFallthrough = true; - for (auto* child : curr->list) { - if (child->type == Type::unreachable) { - hasFallthrough = false; - } - } - if (hasFallthrough) { + // If the end of the block cannot be reached, then we don't need to include + // it in the set of folded tails. + bool includeFallthrough = + !std::any_of(curr->list.begin(), curr->list.end(), [&](auto* child) { + return child->type == Type::unreachable; + }); + if (includeFallthrough) { tails.push_back({Tail(curr)}); } optimizeExpressionTails(tails, curr); @@ -255,10 +241,8 @@ struct CodeFolding // remove if (4 bytes), remove one arm, add drop (1), add block (3), // so this must be a net savings markAsModified(curr); - auto* ret = - builder.makeSequence(builder.makeDrop(curr->condition), curr->ifTrue); - // we must ensure we present the same type as the if had - ret->finalize(curr->type); + auto* ret = builder.makeSequence( + builder.makeDrop(curr->condition), curr->ifTrue, curr->ifTrue->type); replaceCurrent(ret); needEHFixups = true; } else { @@ -315,10 +299,6 @@ struct CodeFolding if (needEHFixups) { EHUtils::handleBlockNestedPops(func, *getModule()); } - // if we did any work, types may need to be propagated - if (anotherPass) { - ReFinalize().walkFunctionInModule(func, getModule()); - } } } @@ -372,6 +352,7 @@ struct CodeFolding // identical in all paths leading to the block exit can be merged. template void optimizeExpressionTails(std::vector& tails, T* curr) { + auto oldType = curr->type; if (tails.size() < 2) { return; } @@ -384,50 +365,49 @@ struct CodeFolding return; } // if we were not modified, then we should be valid for processing - tail.validate(); + assert(!tail.expr || !tail.block || + (tail.expr == tail.block->list.back())); } - // we can ignore the final br in a tail - auto effectiveSize = [&](const Tail& tail) { - auto ret = tail.block->list.size(); + auto getMergeable = [&](const Tail& tail, Index num) -> Expression* { if (!tail.isFallthrough()) { - ret--; + // If there is a branch value, it is the first mergeable item. + auto* val = tail.expr->cast()->value; + if (val && num == 0) { + return val; + } + if (!val) { + // Skip the branch instruction at the end; it is not part of the + // merged tail. + ++num; + } } - return ret; - }; - // the mergeable items do not include the final br in a tail - auto getMergeable = [&](const Tail& tail, Index num) { - return tail.block->list[effectiveSize(tail) - num - 1]; + if (num >= tail.block->list.size()) { + return nullptr; + } + return tail.block->list[tail.block->list.size() - num - 1]; }; // we are going to remove duplicate elements and add a block. // so for this to make sense, we need the size of the duplicate // elements to be worth that extra block (although, there is // some chance the block would get merged higher up, see later) std::vector mergeable; // the elements we can merge - Index num = 0; // how many elements back from the tail to look at Index saved = 0; // how much we can save - while (1) { - // check if this num is still relevant - bool stop = false; - for (auto& tail : tails) { - assert(tail.block); - if (num >= effectiveSize(tail)) { - // one of the lists is too short - stop = true; - break; - } - } - if (stop) { + for (Index num = 0; true; ++num) { + auto* item = getMergeable(tails[0], num); + if (!item) { + // The list is too short. break; } - auto* item = getMergeable(tails[0], num); - for (auto& tail : tails) { - if (!ExpressionAnalyzer::equal(item, getMergeable(tail, num))) { - // one of the lists has a different item - stop = true; + Index tail = 1; + for (; tail < tails.size(); ++tail) { + auto* other = getMergeable(tails[tail], num); + if (!other || !ExpressionAnalyzer::equal(item, other)) { + // Other tail too short or has a difference. break; } } - if (stop) { + if (tail != tails.size()) { + // We saw a tail without a matching item. break; } // we may have found another one we can merge - can we move it? @@ -436,7 +416,6 @@ struct CodeFolding } // we found another one we can merge mergeable.push_back(item); - num++; saved += Measurer::measure(item); } if (saved == 0) { @@ -450,7 +429,7 @@ struct CodeFolding for (auto& tail : tails) { // it is enough to zero out the block, or leave just one // element, as then the block can be replaced with that - if (num >= tail.block->list.size() - 1) { + if (mergeable.size() >= tail.block->list.size() - 1) { willEmptyBlock = true; break; } @@ -483,6 +462,7 @@ struct CodeFolding } } } + // this is worth doing, do it! for (auto& tail : tails) { // remove the items we are merging / moving @@ -490,25 +470,28 @@ struct CodeFolding // again in this pass, which might be buggy markAsModified(tail.block); // we must preserve the br if there is one - Expression* last = nullptr; + Break* branch = nullptr; if (!tail.isFallthrough()) { - last = tail.block->list.back(); - tail.block->list.pop_back(); + branch = tail.block->list.back()->cast(); + if (branch->value) { + branch->value = nullptr; + } else { + tail.block->list.pop_back(); + } } - for (Index i = 0; i < mergeable.size(); i++) { + for (Index i = 0; i < mergeable.size(); ++i) { tail.block->list.pop_back(); } - if (!tail.isFallthrough()) { - tail.block->list.push_back(last); + if (tail.isFallthrough()) { + // The block now ends in an expression that was previously in the middle + // of the block, meaning it must have type none. + tail.block->finalize(Type::none); + } else { + tail.block->list.push_back(branch); + // The block still ends with the same branch it previously ended with, + // so its type cannot have changed. + tail.block->finalize(tail.block->type); } - // the block type may change if we removed unreachable stuff, - // but in general it should remain the same, as if it had a - // forced type it should remain, *and*, we don't have a - // fallthrough value (we would never get here), so a concrete - // type was not from that. I.e., any type on the block is - // either forced and/or from breaks with a value, so the - // type cannot be changed by moving code out. - tail.block->finalize(tail.block->type); } // since we managed a merge, then it might open up more opportunities later anotherPass = true; @@ -520,7 +503,15 @@ struct CodeFolding block->list.push_back(mergeable.back()); mergeable.pop_back(); } - auto oldType = curr->type; + if constexpr (T::SpecificId == Expression::BlockId) { + // If we didn't have a fallthrough tail because the end of the block was + // not reachable, then we might have a concrete expression at the end of + // the block even though the value produced by the block has been moved + // out of it. If so, drop that expression. + auto* currBlock = curr->template cast(); + currBlock->list.back() = + builder.dropIfConcretelyTyped(currBlock->list.back()); + } // NB: we template-specialize so that this calls the proper finalizer for // the type curr->finalize(); @@ -553,9 +544,6 @@ struct CodeFolding if (tail.block && modifieds.count(tail.block) > 0) { return true; } - // if we were not modified, then we should be valid for - // processing - tail.validate(); return false; }), tails.end()); diff --git a/test/lit/passes/code-folding.wast b/test/lit/passes/code-folding.wast index 35816748149..f409669c95a 100644 --- a/test/lit/passes/code-folding.wast +++ b/test/lit/passes/code-folding.wast @@ -1,18 +1,30 @@ ;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. ;; NOTE: This test was ported using port_passes_tests_to_lit.py and could be cleaned up. -;; RUN: foreach %s %t wasm-opt -all --code-folding -S -o - | filecheck %s +;; RUN: wasm-opt %s -all --code-folding -S -o - | filecheck %s (module ;; CHECK: (type $0 (func)) ;; CHECK: (type $1 (func (result f32))) + ;; CHECK: (type $2 (func (result i32))) + ;; CHECK: (type $13 (func (param f32))) (type $13 (func (param f32))) (table 282 282 funcref) + ;; CHECK: (type $4 (func (param i32))) + + ;; CHECK: (global $global$0 (mut i32) (i32.const 10)) + ;; CHECK: (memory $0 1 1) (memory $0 1 1) + + ;; CHECK: (memory $shared 1 1 shared) + (memory $shared 1 1 shared) + + (global $global$0 (mut i32) (i32.const 10)) + ;; CHECK: (table $0 282 282 funcref) ;; CHECK: (func $0 (type $0) @@ -22,7 +34,7 @@ ;; CHECK-NEXT: (then ;; CHECK-NEXT: (block $label$3 ;; CHECK-NEXT: (call_indirect $0 (type $13) - ;; CHECK-NEXT: (block $label$4 + ;; CHECK-NEXT: (block $label$4 (result f32) ;; CHECK-NEXT: (br $label$3) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (i32.const 105) @@ -52,6 +64,7 @@ ) ) ) + ;; CHECK: (func $negative-zero (type $1) (result f32) ;; CHECK-NEXT: (if (result f32) ;; CHECK-NEXT: (i32.const 0) @@ -82,6 +95,7 @@ ) ) ) + ;; CHECK: (func $negative-zero-b (type $1) (result f32) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (i32.const 0) @@ -105,29 +119,100 @@ ) ) ) - ;; CHECK: (func $negative-zero-c (type $1) (result f32) + + ;; CHECK: (func $positive-zero (type $1) (result f32) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (block $label$0 (result f32) - ;; CHECK-NEXT: (f32.const 0) + ;; CHECK-NEXT: (f32.const 0) + ;; CHECK-NEXT: ) + (func $positive-zero (result f32) + (if (result f32) + (i32.const 0) + (then + (f32.const 0) + ) + (else + (f32.const 0) + ) + ) + ) + + ;; CHECK: (func $positive-zero-extra-a (type $1) (result f32) + ;; CHECK-NEXT: (if + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: (then + ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (else + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (f32.const 0) ;; CHECK-NEXT: ) - (func $negative-zero-c (result f32) + (func $positive-zero-extra-a (result f32) (if (result f32) (i32.const 0) (then - (block $label$0 (result f32) - (f32.const 0) - ) + (nop) + (f32.const 0) ) (else - (block $label$1 (result f32) - (f32.const 0) - ) + (f32.const 0) + ) + ) + ) + + ;; CHECK: (func $positive-zero-extra-b (type $1) (result f32) + ;; CHECK-NEXT: (if + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: (then + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (else + ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (f32.const 0) + ;; CHECK-NEXT: ) + (func $positive-zero-extra-b (result f32) + (if (result f32) + (i32.const 0) + (then + (f32.const 0) + ) + (else + (nop) + (f32.const 0) ) ) ) + + ;; CHECK: (func $positive-zero-extra-c (type $1) (result f32) + ;; CHECK-NEXT: (if + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: (then + ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (else + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (f32.const 0) + ;; CHECK-NEXT: ) + (func $positive-zero-extra-c (result f32) + (if (result f32) + (i32.const 0) + (then + (nop) + (nop) + (f32.const 0) + ) + (else + (nop) + (f32.const 0) + ) + ) + ) + ;; CHECK: (func $break-target-outside-of-return-merged-code (type $0) ;; CHECK-NEXT: (block $label$A ;; CHECK-NEXT: (if @@ -202,6 +287,7 @@ ) ) ) + ;; CHECK: (func $break-target-inside-all-good (type $0) ;; CHECK-NEXT: (block $folding-inner0 ;; CHECK-NEXT: (block $label$A @@ -269,11 +355,12 @@ ) ) ) + ;; CHECK: (func $leave-inner-block-type (type $0) ;; CHECK-NEXT: (block $label$1 ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (block $label$2 - ;; CHECK-NEXT: (block + ;; CHECK-NEXT: (block $label$2 (result i32) + ;; CHECK-NEXT: (br_if $label$2 ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) @@ -304,54 +391,40 @@ ) ) ) -) -(module - ;; CHECK: (type $0 (func (result i32))) - ;; CHECK: (memory $0 1 1 shared) - (memory $0 1 1 shared) - ;; CHECK: (export "func_2224" (func $0)) - (export "func_2224" (func $0)) - ;; CHECK: (func $0 (type $0) (result i32) + ;; CHECK: (func $atomic-load-different (type $2) (result i32) ;; CHECK-NEXT: (local $var$0 i32) ;; CHECK-NEXT: (if (result i32) ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: (then - ;; CHECK-NEXT: (i32.load offset=22 + ;; CHECK-NEXT: (i32.load $shared offset=22 ;; CHECK-NEXT: (local.get $var$0) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (else - ;; CHECK-NEXT: (i32.atomic.load offset=22 + ;; CHECK-NEXT: (i32.atomic.load $shared offset=22 ;; CHECK-NEXT: (local.get $var$0) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - (func $0 (result i32) + (func $atomic-load-different (result i32) (local $var$0 i32) (if (result i32) (i32.const 0) (then - (i32.load offset=22 + (i32.load $shared offset=22 (local.get $var$0) ) ) (else - (i32.atomic.load offset=22 + (i32.atomic.load $shared offset=22 (local.get $var$0) ) ) ) ) -) -(module - ;; CHECK: (type $0 (func)) - (type $0 (func)) - ;; CHECK: (type $1 (func (param i32))) - ;; CHECK: (global $global$0 (mut i32) (i32.const 10)) - (global $global$0 (mut i32) (i32.const 10)) ;; CHECK: (func $determinism (type $0) ;; CHECK-NEXT: (block $folding-inner0 ;; CHECK-NEXT: (block @@ -390,7 +463,7 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) - (func $determinism (; 0 ;) (type $0) + (func $determinism (block $label$1 (br_if $label$1 (i32.const 1) @@ -439,7 +512,8 @@ ) (unreachable) ) - ;; CHECK: (func $careful-of-the-switch (type $1) (param $0 i32) + + ;; CHECK: (func $careful-of-the-switch (type $4) (param $0 i32) ;; CHECK-NEXT: (block $label$1 ;; CHECK-NEXT: (block $label$3 ;; CHECK-NEXT: (block $label$5 @@ -481,10 +555,240 @@ (unreachable) ) ) -) -(module - ;; CHECK: (type $0 (func)) + ;; CHECK: (func $br-with-value (type $2) (result i32) + ;; CHECK-NEXT: (block $l + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: (br $l) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: (br $l) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: ) + (func $br-with-value (result i32) + (block $l (result i32) + (block + (br $l + (i32.const 1) + ) + ) + (block + (br $l + (i32.const 1) + ) + ) + (i32.const 1) + ) + ) + + ;; CHECK: (func $br-and-fallthrough-with-value (type $2) (result i32) + ;; CHECK-NEXT: (block $l + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (block (result i32) + ;; CHECK-NEXT: (br $l) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (block (result i32) + ;; CHECK-NEXT: (br $l) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: ) + (func $br-and-fallthrough-with-value (result i32) + (block $l (result i32) + (drop + (block (result i32) + (br $l + (i32.const 1) + ) + ) + ) + (drop + (block (result i32) + (br $l + (i32.const 1) + ) + ) + ) + (i32.const 1) + ) + ) + + ;; CHECK: (func $br-with-value-and-more (type $2) (result i32) + ;; CHECK-NEXT: (block $l + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: (br $l) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (br $l) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: ) + (func $br-with-value-and-more (result i32) + (block $l (result i32) + (block + (nop) + (nop) + (br $l + (i32.const 1) + ) + ) + (block + (nop) + (nop) + (nop) + (br $l + (i32.const 1) + ) + ) + (nop) + (i32.const 1) + ) + ) + + ;; CHECK: (func $br-and-fallthrough-with-value-and-more (type $2) (result i32) + ;; CHECK-NEXT: (block $l + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (block (result i32) + ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (br $l) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (block (result i32) + ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (br $l) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: ) + (func $br-and-fallthrough-with-value-and-more (result i32) + (block $l (result i32) + (drop + (block (result i32) + (nop) + (nop) + (br $l + (i32.const 1) + ) + ) + ) + (drop + (block (result i32) + (nop) + (nop) + (nop) + (br $l + (i32.const 1) + ) + ) + ) + (nop) + (i32.const 1) + ) + ) + + ;; CHECK: (func $unreachable-if (type $0) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $unreachable-if + (if + (unreachable) + (then + (drop + (i32.const 1) + ) + ) + (else + (drop + (i32.const 1) + ) + ) + ) + ) + + ;; CHECK: (func $unreachable-if-suffix (type $0) + ;; CHECK-NEXT: (if + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: (then + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (else + ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $unreachable-if-suffix + (if + (unreachable) + (then + (drop + (i32.const 1) + ) + ) + (else + (nop) + (drop + (i32.const 1) + ) + ) + ) + ) + + ;; CHECK: (func $unreachable-if-concrete-arms (type $0) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (block (result i32) + ;; CHECK-NEXT: (if + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: (then + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (else + ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) + (func $unreachable-if-concrete-arms + (if (result i32) + (unreachable) + (then + (i32.const 1) + ) + (else + (nop) + (i32.const 1) + ) + ) + (unreachable) + ) ;; CHECK: (func $br-on-null (type $0) ;; CHECK-NEXT: (block $block diff --git a/test/passes/O3_low-memory-unused_metrics.txt b/test/passes/O3_low-memory-unused_metrics.txt index 8806e9a043c..3117d77785d 100644 --- a/test/passes/O3_low-memory-unused_metrics.txt +++ b/test/passes/O3_low-memory-unused_metrics.txt @@ -9,23 +9,23 @@ total [table-data] : 0 [tables] : 0 [tags] : 0 - [total] : 1964 + [total] : 1953 [vars] : 9 - Binary : 240 + Binary : 238 Block : 68 Break : 90 Call : 22 CallIndirect : 1 - Const : 175 + Const : 174 Drop : 8 If : 27 - Load : 313 - LocalGet : 633 - LocalSet : 181 + Load : 311 + LocalGet : 629 + LocalSet : 180 Loop : 3 Return : 3 Select : 11 - Store : 160 + Store : 159 Unary : 29 (module (type $0 (func (param i32 i32 i32) (result i32))) @@ -2718,307 +2718,289 @@ total (local.get $0) ) ) - (i32.store8 - (block $label$68 (result i32) - (if - (i32.eq - (local.get $4) - (i32.const 2) - ) - (then - (i32.store offset=20 - (local.get $2) - (i32.add - (local.tee $3 - (i32.load offset=20 - (local.get $2) - ) - ) - (i32.const 1) - ) - ) - (i32.store8 - (i32.add - (local.get $3) - (i32.load offset=8 + (block $label$68 + (if + (i32.eq + (local.get $4) + (i32.const 2) + ) + (then + (i32.store offset=20 + (local.get $2) + (i32.add + (local.tee $3 + (i32.load offset=20 (local.get $2) ) ) - (local.get $1) + (i32.const 1) ) - (local.set $1 - (i32.load offset=48 - (local.get $0) + ) + (i32.store8 + (i32.add + (local.get $3) + (i32.load offset=8 + (local.get $2) ) ) - (i32.store offset=20 - (local.get $2) - (i32.add - (local.tee $3 - (i32.load offset=20 - (local.get $2) - ) - ) - (i32.const 1) - ) + (local.get $1) + ) + (local.set $1 + (i32.load offset=48 + (local.get $0) ) - (i32.store8 - (i32.add - (local.get $3) - (i32.load offset=8 + ) + (i32.store offset=20 + (local.get $2) + (i32.add + (local.tee $3 + (i32.load offset=20 (local.get $2) ) ) - (i32.shr_u - (local.get $1) - (i32.const 8) - ) - ) - (local.set $1 - (i32.load16_u offset=50 - (local.get $0) - ) + (i32.const 1) ) - (i32.store offset=20 - (local.get $2) - (i32.add - (local.tee $3 - (i32.load offset=20 - (local.get $2) - ) - ) - (i32.const 1) + ) + (i32.store8 + (i32.add + (local.get $3) + (i32.load offset=8 + (local.get $2) ) ) - (i32.store8 - (i32.add - (local.get $3) - (i32.load offset=8 - (local.get $2) - ) - ) + (i32.shr_u (local.get $1) + (i32.const 8) ) - (local.set $1 - (i32.load8_u offset=51 - (local.get $0) - ) - ) - (i32.store offset=20 - (local.get $2) - (i32.add - (local.tee $3 - (i32.load offset=20 - (local.get $2) - ) - ) - (i32.const 1) - ) + ) + (local.set $1 + (i32.load16_u offset=50 + (local.get $0) ) - (i32.store8 - (i32.add - (local.get $3) - (i32.load offset=8 + ) + (i32.store offset=20 + (local.get $2) + (i32.add + (local.tee $3 + (i32.load offset=20 (local.get $2) ) ) - (local.get $1) + (i32.const 1) ) - (local.set $1 + ) + (i32.store8 + (i32.add + (local.get $3) (i32.load offset=8 - (local.get $0) + (local.get $2) ) ) - (i32.store offset=20 - (local.get $2) - (i32.add - (local.tee $3 - (i32.load offset=20 - (local.get $2) - ) - ) - (i32.const 1) - ) + (local.get $1) + ) + (local.set $1 + (i32.load8_u offset=51 + (local.get $0) ) - (i32.store8 - (i32.add - (local.get $3) - (i32.load offset=8 + ) + (i32.store offset=20 + (local.get $2) + (i32.add + (local.tee $3 + (i32.load offset=20 (local.get $2) ) ) - (local.get $1) + (i32.const 1) ) - (local.set $1 + ) + (i32.store8 + (i32.add + (local.get $3) (i32.load offset=8 - (local.get $0) + (local.get $2) ) ) - (i32.store offset=20 - (local.get $2) - (i32.add - (local.tee $3 - (i32.load offset=20 - (local.get $2) - ) - ) - (i32.const 1) - ) + (local.get $1) + ) + (local.set $1 + (i32.load offset=8 + (local.get $0) ) - (i32.store8 - (i32.add - (local.get $3) - (i32.load offset=8 + ) + (i32.store offset=20 + (local.get $2) + (i32.add + (local.tee $3 + (i32.load offset=20 (local.get $2) ) ) - (i32.shr_u - (local.get $1) - (i32.const 8) - ) + (i32.const 1) ) - (local.set $1 - (i32.load16_u offset=10 - (local.get $0) + ) + (i32.store8 + (i32.add + (local.get $3) + (i32.load offset=8 + (local.get $2) ) ) - (i32.store offset=20 - (local.get $2) - (i32.add - (local.tee $3 - (i32.load offset=20 - (local.get $2) - ) - ) - (i32.const 1) - ) + (local.get $1) + ) + (local.set $1 + (i32.load offset=8 + (local.get $0) ) - (i32.store8 - (i32.add - (local.get $3) - (i32.load offset=8 + ) + (i32.store offset=20 + (local.get $2) + (i32.add + (local.tee $3 + (i32.load offset=20 (local.get $2) ) ) - (local.get $1) + (i32.const 1) ) - (local.set $3 - (i32.load8_u offset=11 - (local.get $0) + ) + (i32.store8 + (i32.add + (local.get $3) + (i32.load offset=8 + (local.get $2) ) ) - (i32.store offset=20 - (local.get $2) - (i32.add - (local.tee $1 - (i32.load offset=20 - (local.get $2) - ) - ) - (i32.const 1) - ) + (i32.shr_u + (local.get $1) + (i32.const 8) ) - (br $label$68 - (i32.add - (local.get $1) - (i32.load offset=8 + ) + (local.set $1 + (i32.load16_u offset=10 + (local.get $0) + ) + ) + (i32.store offset=20 + (local.get $2) + (i32.add + (local.tee $3 + (i32.load offset=20 (local.get $2) ) ) + (i32.const 1) ) ) - ) - (i32.store offset=20 - (local.get $2) - (i32.add - (local.tee $3 - (i32.load offset=20 + (i32.store8 + (i32.add + (local.get $3) + (i32.load offset=8 (local.get $2) ) ) - (i32.const 1) - ) - ) - (i32.store8 - (i32.add - (local.get $3) - (i32.load offset=8 - (local.get $2) - ) - ) - (i32.shr_u (local.get $1) - (i32.const 24) ) - ) - (i32.store offset=20 - (local.get $2) - (i32.add - (local.tee $3 - (i32.load offset=20 - (local.get $2) - ) + (local.set $3 + (i32.load8_u offset=11 + (local.get $0) ) - (i32.const 1) ) + (br $label$68) ) - (i32.store8 - (i32.add - (local.get $3) - (i32.load offset=8 + ) + (i32.store offset=20 + (local.get $2) + (i32.add + (local.tee $3 + (i32.load offset=20 (local.get $2) ) ) - (i32.shr_u - (local.get $1) - (i32.const 16) - ) + (i32.const 1) ) - (local.set $3 - (i32.load offset=48 - (local.get $0) + ) + (i32.store8 + (i32.add + (local.get $3) + (i32.load offset=8 + (local.get $2) ) ) - (i32.store offset=20 - (local.get $2) - (i32.add - (local.tee $1 - (i32.load offset=20 - (local.get $2) - ) - ) - (i32.const 1) - ) + (i32.shr_u + (local.get $1) + (i32.const 24) ) - (i32.store8 - (i32.add - (local.get $1) - (i32.load offset=8 + ) + (i32.store offset=20 + (local.get $2) + (i32.add + (local.tee $3 + (i32.load offset=20 (local.get $2) ) ) - (i32.shr_u - (local.get $3) - (i32.const 8) + (i32.const 1) + ) + ) + (i32.store8 + (i32.add + (local.get $3) + (i32.load offset=8 + (local.get $2) ) ) - (i32.store offset=20 - (local.get $2) - (i32.add - (local.tee $1 - (i32.load offset=20 - (local.get $2) - ) + (i32.shr_u + (local.get $1) + (i32.const 16) + ) + ) + (local.set $3 + (i32.load offset=48 + (local.get $0) + ) + ) + (i32.store offset=20 + (local.get $2) + (i32.add + (local.tee $1 + (i32.load offset=20 + (local.get $2) ) - (i32.const 1) ) + (i32.const 1) ) + ) + (i32.store8 (i32.add (local.get $1) (i32.load offset=8 (local.get $2) ) ) + (i32.shr_u + (local.get $3) + (i32.const 8) + ) + ) + ) + (i32.store offset=20 + (local.get $2) + (i32.add + (local.tee $1 + (i32.load offset=20 + (local.get $2) + ) + ) + (i32.const 1) + ) + ) + (i32.store8 + (i32.add + (local.get $1) + (i32.load offset=8 + (local.get $2) + ) ) (local.get $3) ) diff --git a/test/passes/remove-unused-names_code-folding.txt b/test/passes/remove-unused-names_code-folding.txt index d0486b3c784..efdd87fb25e 100644 --- a/test/passes/remove-unused-names_code-folding.txt +++ b/test/passes/remove-unused-names_code-folding.txt @@ -788,20 +788,15 @@ ) ) (drop - (block $y (result i32) - (if - (i32.const 0) - (then - (drop - (i32.const 1) - ) - (drop - (i32.const 2) - ) - (br $y - (i32.const 3) + (block (result i32) + (block $y + (if + (i32.const 0) + (then + (br $y) ) ) + (br $y) ) (drop (i32.const 1) @@ -809,9 +804,7 @@ (drop (i32.const 2) ) - (br $y - (i32.const 3) - ) + (i32.const 3) ) ) (drop From 0800007a1e0067ecdf61a3acdd63e41b6a099956 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Mon, 25 Nov 2024 22:53:38 -0800 Subject: [PATCH 52/56] remove redundant opt that would need refinalize --- src/passes/CodeFolding.cpp | 66 ++++----- test/lit/passes/code-folding-eh-legacy.wast | 9 +- test/lit/passes/code-folding.wast | 154 +++++++++++++++++--- 3 files changed, 170 insertions(+), 59 deletions(-) diff --git a/src/passes/CodeFolding.cpp b/src/passes/CodeFolding.cpp index 29873c73ef6..86716e1ef05 100644 --- a/src/passes/CodeFolding.cpp +++ b/src/passes/CodeFolding.cpp @@ -235,46 +235,34 @@ struct CodeFolding if (!curr->ifFalse) { return; } - // if both sides are identical, this is easy to fold - if (ExpressionAnalyzer::equal(curr->ifTrue, curr->ifFalse)) { - Builder builder(*getModule()); - // remove if (4 bytes), remove one arm, add drop (1), add block (3), - // so this must be a net savings - markAsModified(curr); - auto* ret = builder.makeSequence( - builder.makeDrop(curr->condition), curr->ifTrue, curr->ifTrue->type); - replaceCurrent(ret); - needEHFixups = true; - } else { - // if both are blocks, look for a tail we can merge - auto* left = curr->ifTrue->dynCast(); - auto* right = curr->ifFalse->dynCast(); - // If one is a block and the other isn't, and the non-block is a tail - // of the other, we can fold that - for our convenience, we just add - // a block and run the rest of the optimization mormally. - auto maybeAddBlock = [this](Block* block, Expression*& other) -> Block* { - // if other is a suffix of the block, wrap it in a block - if (block->list.empty() || - !ExpressionAnalyzer::equal(other, block->list.back())) { - return nullptr; - } - // do it, assign to the out param `other`, and return the block - Builder builder(*getModule()); - auto* ret = builder.makeBlock(other); - other = ret; - return ret; - }; - if (left && !right) { - right = maybeAddBlock(left, curr->ifFalse); - } else if (!left && right) { - left = maybeAddBlock(right, curr->ifTrue); - } - // we need nameless blocks, as if there is a name, someone might branch - // to the end, skipping the code we want to merge - if (left && right && !left->name.is() && !right->name.is()) { - std::vector tails = {Tail(left), Tail(right)}; - optimizeExpressionTails(tails, curr); + // If both are blocks, look for a tail we can merge. + auto* left = curr->ifTrue->dynCast(); + auto* right = curr->ifFalse->dynCast(); + // If one is a block and the other isn't, and the non-block is a tail of the + // other, we can fold that - for our convenience, we just add a block and + // run the rest of the optimization mormally. + auto maybeAddBlock = [this](Block* block, Expression*& other) -> Block* { + // If other is a suffix of the block, wrap it in a block. + if (block->list.empty() || + !ExpressionAnalyzer::equal(other, block->list.back())) { + return nullptr; } + // Do it, assign to the out param `other`, and return the block. + Builder builder(*getModule()); + auto* ret = builder.makeBlock(other); + other = ret; + return ret; + }; + if (left && !right) { + right = maybeAddBlock(left, curr->ifFalse); + } else if (!left && right) { + left = maybeAddBlock(right, curr->ifTrue); + } + // We need nameless blocks, as if there is a name, someone might branch to + // the end, skipping the code we want to merge. + if (left && right && !left->name.is() && !right->name.is()) { + std::vector tails = {Tail(left), Tail(right)}; + optimizeExpressionTails(tails, curr); } } diff --git a/test/lit/passes/code-folding-eh-legacy.wast b/test/lit/passes/code-folding-eh-legacy.wast index 81180d04463..429106b50c9 100644 --- a/test/lit/passes/code-folding-eh-legacy.wast +++ b/test/lit/passes/code-folding-eh-legacy.wast @@ -352,9 +352,14 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: (block ;; CHECK-NEXT: (block - ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (if ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (then + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (else + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (i32.eqz ;; CHECK-NEXT: (i32.const 1) @@ -377,6 +382,7 @@ (if (pop i32) (then + (nop) (drop (i32.eqz (i32.const 1) @@ -384,6 +390,7 @@ ) ) (else + (nop) (drop (i32.eqz (i32.const 1) diff --git a/test/lit/passes/code-folding.wast b/test/lit/passes/code-folding.wast index f409669c95a..9a89b0460bb 100644 --- a/test/lit/passes/code-folding.wast +++ b/test/lit/passes/code-folding.wast @@ -10,10 +10,12 @@ ;; CHECK: (type $2 (func (result i32))) + ;; CHECK: (type $3 (func (result anyref))) + ;; CHECK: (type $13 (func (param f32))) (type $13 (func (param f32))) (table 282 282 funcref) - ;; CHECK: (type $4 (func (param i32))) + ;; CHECK: (type $5 (func (param i32))) ;; CHECK: (global $global$0 (mut i32) (i32.const 10)) @@ -69,14 +71,10 @@ ;; CHECK-NEXT: (if (result f32) ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: (then - ;; CHECK-NEXT: (block $label$0 (result f32) - ;; CHECK-NEXT: (f32.const 0) - ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (f32.const 0) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (else - ;; CHECK-NEXT: (block $label$1 (result f32) - ;; CHECK-NEXT: (f32.const -0) - ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (f32.const -0) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -84,12 +82,12 @@ (if (result f32) (i32.const 0) (then - (block $label$0 (result f32) + (block (result f32) (f32.const 0) ) ) (else - (block $label$1 (result f32) + (block (result f32) (f32.const -0) ) ) @@ -97,23 +95,25 @@ ) ;; CHECK: (func $negative-zero-b (type $1) (result f32) - ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (if ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: (then + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (else + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (block $label$0 (result f32) - ;; CHECK-NEXT: (f32.const -0) - ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (f32.const -0) ;; CHECK-NEXT: ) (func $negative-zero-b (result f32) (if (result f32) (i32.const 0) (then - (block $label$0 (result f32) + (block (result f32) (f32.const -0) ) ) (else - (block $label$1 (result f32) + (block (result f32) (f32.const -0) ) ) @@ -121,12 +121,19 @@ ) ;; CHECK: (func $positive-zero (type $1) (result f32) - ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (if (result f32) ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: (then + ;; CHECK-NEXT: (f32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (else + ;; CHECK-NEXT: (f32.const 0) + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (f32.const 0) ;; CHECK-NEXT: ) (func $positive-zero (result f32) + ;; This doesn't get optimized because we only look at Ifs with block arms. + ;; This simpler case will be optimized by OptimizeInstructions. (if (result f32) (i32.const 0) (then @@ -138,6 +145,39 @@ ) ) + ;; CHECK: (func $positive-zero-names (type $1) (result f32) + ;; CHECK-NEXT: (if (result f32) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: (then + ;; CHECK-NEXT: (block $l1 (result f32) + ;; CHECK-NEXT: (f32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (else + ;; CHECK-NEXT: (block $l2 (result f32) + ;; CHECK-NEXT: (f32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $positive-zero-names (result f32) + ;; This one has block arms, but doesn't get optimized because the blocks have + ;; names. + (if (result f32) + (i32.const 0) + (then + (block $l1 (result f32) + (f32.const 0) + ) + ) + (else + (block $l2 (result f32) + (f32.const 0) + ) + ) + ) + ) + ;; CHECK: (func $positive-zero-extra-a (type $1) (result f32) ;; CHECK-NEXT: (if ;; CHECK-NEXT: (i32.const 0) @@ -513,7 +553,7 @@ (unreachable) ) - ;; CHECK: (func $careful-of-the-switch (type $4) (param $0 i32) + ;; CHECK: (func $careful-of-the-switch (type $5) (param $0 i32) ;; CHECK-NEXT: (block $label$1 ;; CHECK-NEXT: (block $label$3 ;; CHECK-NEXT: (block $label$5 @@ -707,9 +747,14 @@ ) ;; CHECK: (func $unreachable-if (type $0) - ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (if ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: (then + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (else + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (i32.const 1) ;; CHECK-NEXT: ) @@ -718,11 +763,13 @@ (if (unreachable) (then + (nop) (drop (i32.const 1) ) ) (else + (nop) (drop (i32.const 1) ) @@ -824,4 +871,73 @@ (call $br-on-null) ) ) + + ;; CHECK: (func $refined-type (type $3) (result anyref) + ;; CHECK-NEXT: (select (result anyref) + ;; CHECK-NEXT: (if (result anyref) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: (then + ;; CHECK-NEXT: (ref.null none) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (else + ;; CHECK-NEXT: (ref.null none) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (ref.null none) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $refined-type (result anyref) + (select (result anyref) + ;; If we fold the identical arms, the select will have a stale type. + (if (result anyref) + (i32.const 0) + (then + (ref.null none) + ) + (else + (ref.null none) + ) + ) + (ref.null none) + (i32.const 0) + ) + ) + + ;; CHECK: (func $refined-type-blocks (type $3) (result anyref) + ;; CHECK-NEXT: (select (result anyref) + ;; CHECK-NEXT: (block (result anyref) + ;; CHECK-NEXT: (if + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: (then + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (else + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (ref.null none) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (ref.null none) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $refined-type-blocks (result anyref) + (select (result anyref) + ;; Same, but now the arms are blocks, so they have the stale types (which is + ;; allowed) and the select is ok. + (if (result anyref) + (i32.const 0) + (then + (nop) + (ref.null none) + ) + (else + (nop) + (ref.null none) + ) + ) + (ref.null none) + (i32.const 0) + ) + ) ) From 0d9d99474e3fbbbd8d1b929c1731946b4fc25b7c Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Mon, 25 Nov 2024 22:59:12 -0800 Subject: [PATCH 53/56] update tests --- .../remove-unused-names_code-folding.txt | 139 +++++++++++------- 1 file changed, 82 insertions(+), 57 deletions(-) diff --git a/test/passes/remove-unused-names_code-folding.txt b/test/passes/remove-unused-names_code-folding.txt index efdd87fb25e..09151d148aa 100644 --- a/test/passes/remove-unused-names_code-folding.txt +++ b/test/passes/remove-unused-names_code-folding.txt @@ -10,11 +10,14 @@ (nop) ) ) - (block - (drop - (i32.const 0) + (if + (i32.const 0) + (then + (nop) + ) + (else + (nop) ) - (nop) ) (if (i32.const 0) @@ -26,13 +29,19 @@ ) ) (drop - (block (result i32) - (drop - (i32.const 0) + (if (result i32) + (i32.const 0) + (then + (i32.add + (i32.const 1) + (i32.const 2) + ) ) - (i32.add - (i32.const 1) - (i32.const 2) + (else + (i32.add + (i32.const 1) + (i32.const 2) + ) ) ) ) @@ -56,12 +65,14 @@ ) (func $ifs-blocks (block - (drop + (if (i32.const 0) + (then + ) + (else + ) ) - (block - (nop) - ) + (nop) ) (block (if @@ -108,15 +119,17 @@ ) (func $ifs-blocks-big (block - (drop + (if (i32.const 0) + (then + ) + (else + ) ) - (block - (drop - (i32.add - (i32.const 1) - (i32.const 2) - ) + (drop + (i32.add + (i32.const 1) + (i32.const 2) ) ) ) @@ -499,15 +512,17 @@ (block $out (block $out2 (block - (drop + (if (local.get $x) - ) - (block - (br_if $out - (local.get $y) + (then ) - (nop) + (else + ) + ) + (br_if $out + (local.get $y) ) + (nop) ) (block (if @@ -692,21 +707,23 @@ (func $mixture (block $out (block - (drop + (if (i32.const 1) - ) - (block - (drop - (i32.const 2) + (then + ) + (else ) - (nop) - (nop) - (nop) - (nop) - (nop) - (nop) - (br $out) ) + (drop + (i32.const 2) + ) + (nop) + (nop) + (nop) + (nop) + (nop) + (nop) + (br $out) ) ) (block $out2 @@ -742,20 +759,24 @@ (block (block $out3 (block - (drop + (if (i32.const 1) + (then + ) + (else + ) ) - (block - (br $out3) - ) + (br $out3) ) (block - (drop + (if (i32.const 1) + (then + ) + (else + ) ) - (block - (br $out3) - ) + (br $out3) ) (br $out3) ) @@ -1498,12 +1519,14 @@ ) ) (block - (drop + (if (i32.const 0) + (then + ) + (else + ) ) - (block - (nop) - ) + (nop) ) (if (i32.const 0) @@ -1517,15 +1540,17 @@ (nop) (drop (block (result i32) - (drop + (if (unreachable) - ) - (block (result i32) - (i32.add - (i32.const 1) - (i32.const 2) + (then + ) + (else ) ) + (i32.add + (i32.const 1) + (i32.const 2) + ) ) ) (drop From c24301394ca609c443af17258cc85d73e54dbe2b Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Tue, 26 Nov 2024 14:17:36 -0800 Subject: [PATCH 54/56] cleanup empty ifs --- src/passes/CodeFolding.cpp | 18 +++++-- test/lit/passes/code-folding-eh-legacy.wast | 6 +-- test/lit/passes/code-folding.wast | 18 ++----- .../remove-unused-names_code-folding.txt | 48 ++++--------------- 4 files changed, 27 insertions(+), 63 deletions(-) diff --git a/src/passes/CodeFolding.cpp b/src/passes/CodeFolding.cpp index 86716e1ef05..42331b74746 100644 --- a/src/passes/CodeFolding.cpp +++ b/src/passes/CodeFolding.cpp @@ -105,8 +105,7 @@ struct CodeFolding Tail(Block* block) : expr(nullptr), block(block), pointer(nullptr) {} // For a break Tail(Expression* expr, Block* block) - : expr(expr), block(block), pointer(nullptr) { - } + : expr(expr), block(block), pointer(nullptr) {} Tail(Expression* expr, Expression** pointer) : expr(expr), block(nullptr), pointer(pointer) {} @@ -486,7 +485,20 @@ struct CodeFolding // make a block with curr + the merged code Builder builder(*getModule()); auto* block = builder.makeBlock(); - block->list.push_back(curr); + if constexpr (T::SpecificId == Expression::IfId) { + // If we've moved all the contents out of both arms of the If, then we can + // simplify the output by replacing it entirely with just a drop of the + // condition. + auto* iff = curr->template cast(); + if (iff->ifTrue->template cast()->list.empty() && + iff->ifFalse->template cast()->list.empty()) { + block->list.push_back(builder.makeDrop(iff->condition)); + } else { + block->list.push_back(curr); + } + } else { + block->list.push_back(curr); + } while (!mergeable.empty()) { block->list.push_back(mergeable.back()); mergeable.pop_back(); diff --git a/test/lit/passes/code-folding-eh-legacy.wast b/test/lit/passes/code-folding-eh-legacy.wast index 429106b50c9..cde0fba2836 100644 --- a/test/lit/passes/code-folding-eh-legacy.wast +++ b/test/lit/passes/code-folding-eh-legacy.wast @@ -352,12 +352,8 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: (block ;; CHECK-NEXT: (block - ;; CHECK-NEXT: (if + ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (local.get $0) - ;; CHECK-NEXT: (then - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (else - ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: (drop diff --git a/test/lit/passes/code-folding.wast b/test/lit/passes/code-folding.wast index 9a89b0460bb..007aa59099d 100644 --- a/test/lit/passes/code-folding.wast +++ b/test/lit/passes/code-folding.wast @@ -95,12 +95,8 @@ ) ;; CHECK: (func $negative-zero-b (type $1) (result f32) - ;; CHECK-NEXT: (if + ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (i32.const 0) - ;; CHECK-NEXT: (then - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (else - ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (f32.const -0) ;; CHECK-NEXT: ) @@ -747,12 +743,8 @@ ) ;; CHECK: (func $unreachable-if (type $0) - ;; CHECK-NEXT: (if + ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (unreachable) - ;; CHECK-NEXT: (then - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (else - ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: (drop @@ -907,12 +899,8 @@ ;; CHECK: (func $refined-type-blocks (type $3) (result anyref) ;; CHECK-NEXT: (select (result anyref) ;; CHECK-NEXT: (block (result anyref) - ;; CHECK-NEXT: (if + ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (i32.const 0) - ;; CHECK-NEXT: (then - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (else - ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: (ref.null none) diff --git a/test/passes/remove-unused-names_code-folding.txt b/test/passes/remove-unused-names_code-folding.txt index 09151d148aa..85810131b4a 100644 --- a/test/passes/remove-unused-names_code-folding.txt +++ b/test/passes/remove-unused-names_code-folding.txt @@ -65,12 +65,8 @@ ) (func $ifs-blocks (block - (if + (drop (i32.const 0) - (then - ) - (else - ) ) (nop) ) @@ -119,12 +115,8 @@ ) (func $ifs-blocks-big (block - (if + (drop (i32.const 0) - (then - ) - (else - ) ) (drop (i32.add @@ -512,12 +504,8 @@ (block $out (block $out2 (block - (if + (drop (local.get $x) - (then - ) - (else - ) ) (br_if $out (local.get $y) @@ -707,12 +695,8 @@ (func $mixture (block $out (block - (if + (drop (i32.const 1) - (then - ) - (else - ) ) (drop (i32.const 2) @@ -759,22 +743,14 @@ (block (block $out3 (block - (if + (drop (i32.const 1) - (then - ) - (else - ) ) (br $out3) ) (block - (if + (drop (i32.const 1) - (then - ) - (else - ) ) (br $out3) ) @@ -1519,12 +1495,8 @@ ) ) (block - (if + (drop (i32.const 0) - (then - ) - (else - ) ) (nop) ) @@ -1540,12 +1512,8 @@ (nop) (drop (block (result i32) - (if + (drop (unreachable) - (then - ) - (else - ) ) (i32.add (i32.const 1) From 3c0f5dd51f69ceb4ca34fc7a407789cc8ea2b893 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Tue, 26 Nov 2024 15:05:38 -0800 Subject: [PATCH 55/56] Skip ifs with unreachable conditions in CodeFolding --- src/passes/CodeFolding.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/passes/CodeFolding.cpp b/src/passes/CodeFolding.cpp index ad5eb83e477..0a1b4cc5562 100644 --- a/src/passes/CodeFolding.cpp +++ b/src/passes/CodeFolding.cpp @@ -249,8 +249,11 @@ struct CodeFolding if (!curr->ifFalse) { return; } - if (curr->ifTrue->type.isConcrete()) { - // We don't support folding tails that produce values. + if (curr->condition->type == Type::unreachable) { + // If the arms are foldable and concrete, we would be replacing an + // unreachable If with a concrete block, which may or may not be valid, + // depending on the context. Leave this for DCE rather than trying to + // handle that. return; } // if both sides are identical, this is easy to fold From 2ef8d9f1e03c0b30c8bef6e79a574610dbe29125 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Tue, 26 Nov 2024 16:14:24 -0800 Subject: [PATCH 56/56] update tests --- .../inlining-optimizing_optimize-level=3.wast | 53 +++++++++---------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/test/lit/passes/inlining-optimizing_optimize-level=3.wast b/test/lit/passes/inlining-optimizing_optimize-level=3.wast index 9e514cc2733..f6df7305620 100644 --- a/test/lit/passes/inlining-optimizing_optimize-level=3.wast +++ b/test/lit/passes/inlining-optimizing_optimize-level=3.wast @@ -5742,44 +5742,43 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.set $5 - ;; CHECK-NEXT: (if (result i32) - ;; CHECK-NEXT: (i32.and + ;; CHECK-NEXT: (if + ;; CHECK-NEXT: (i32.and + ;; CHECK-NEXT: (local.get $9) + ;; CHECK-NEXT: (i32.const 8) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (then + ;; CHECK-NEXT: (local.set $7 ;; CHECK-NEXT: (local.get $9) - ;; CHECK-NEXT: (i32.const 8) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (then - ;; CHECK-NEXT: (local.set $7 - ;; CHECK-NEXT: (local.get $9) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.set $6 - ;; CHECK-NEXT: (select - ;; CHECK-NEXT: (local.tee $5 - ;; CHECK-NEXT: (i32.add - ;; CHECK-NEXT: (i32.sub - ;; CHECK-NEXT: (local.get $23) - ;; CHECK-NEXT: (local.get $8) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: (local.set $6 + ;; CHECK-NEXT: (select + ;; CHECK-NEXT: (local.tee $5 + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (i32.sub + ;; CHECK-NEXT: (local.get $23) + ;; CHECK-NEXT: (local.get $8) ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 1) ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $6) + ;; CHECK-NEXT: (i32.gt_s + ;; CHECK-NEXT: (local.get $5) ;; CHECK-NEXT: (local.get $6) - ;; CHECK-NEXT: (i32.gt_s - ;; CHECK-NEXT: (local.get $5) - ;; CHECK-NEXT: (local.get $6) - ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.get $8) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (else - ;; CHECK-NEXT: (local.set $7 - ;; CHECK-NEXT: (local.get $9) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.get $8) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (else + ;; CHECK-NEXT: (local.set $7 + ;; CHECK-NEXT: (local.get $9) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $5 + ;; CHECK-NEXT: (local.get $8) + ;; CHECK-NEXT: ) ;; CHECK-NEXT: (local.set $8 ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: )