From fd86eadb591576b82b0b564f95952b131979e91a Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 16 Oct 2024 15:16:08 -0700 Subject: [EH][GC] Add missing subtyping constraints from TryTable (#7012) Similar to Break, BrOn, etc., we must apply subtyping constraints of the types we send to blocks, so that Unsubtyping will not remove subtypings that are actually needed. --- src/ir/subtype-exprs.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ir/subtype-exprs.h b/src/ir/subtype-exprs.h index 640240df9..1895c856a 100644 --- a/src/ir/subtype-exprs.h +++ b/src/ir/subtype-exprs.h @@ -249,7 +249,13 @@ struct SubtypingDiscoverer : public OverriddenVisitor { self()->noteSubtype(body, curr); } } - void visitTryTable(TryTable* curr) { self()->noteSubtype(curr->body, curr); } + void visitTryTable(TryTable* curr) { + self()->noteSubtype(curr->body, curr); + for (Index i = 0; i < curr->catchTags.size(); i++) { + self()->noteSubtype(curr->sentTypes[i], + self()->findBreakTarget(curr->catchDests[i])); + } + } void visitThrow(Throw* curr) { Type params = self()->getModule()->getTag(curr->tag)->sig.params; assert(params.size() == curr->operands.size()); -- cgit v1.2.3