Skip to content

Commit 73ea915

Browse files
committed
hmm
1 parent 8f24b40 commit 73ea915

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

src/passes/DeadArgumentElimination.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
#include "support/sorted_vector.h"
5252
#include "wasm-builder.h"
5353
#include "wasm.h"
54+
#include "wasm-type.h"
5455

5556
namespace wasm {
5657

@@ -590,8 +591,7 @@ struct DAE : public Pass {
590591

591592
// If this is exported, we cannot refine to an exact type without the
592593
// custom descriptors feature being enabled.
593-
if (isExported && module->features.hasReferenceTypes() &&
594-
!module->features.hasCustomDescriptors()) {
594+
if (isExported && !module->features.hasCustomDescriptors()) {
595595
// Remove exactness.
596596
std::vector<Type> inexact;
597597
for (auto t : newType) {
@@ -603,12 +603,20 @@ struct DAE : public Pass {
603603
}
604604
}
605605

606-
func->setResults(newType);
606+
// We must explicitly subtype the old type.
607+
TypeBuilder builder(1);
608+
builder.setHeapType(0, Signature(func->getParams(), newType));
609+
builder.setSubType(0, func->type);
610+
auto result = builder.build();
611+
assert(!result.getError());
612+
func->type = (*result)[0];
613+
607614
for (auto* call : calls) {
608615
if (call->type != Type::unreachable) {
609616
call->type = newType;
610617
}
611618
}
619+
612620
return true;
613621
}
614622
};

0 commit comments

Comments
 (0)