summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/passes/OptimizeInstructions.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/passes/OptimizeInstructions.cpp b/src/passes/OptimizeInstructions.cpp
index 3de7b6519..f96d4d30a 100644
--- a/src/passes/OptimizeInstructions.cpp
+++ b/src/passes/OptimizeInstructions.cpp
@@ -1769,7 +1769,13 @@ struct OptimizeInstructions
}
void visitRefCast(RefCast* curr) {
- if (curr->type == Type::unreachable) {
+ // Note we must check the ref's type here and not our own, since we only
+ // refinalize at the end, which means our type may not have been updated yet
+ // after a change in the child.
+ // TODO: we could update unreachability up the stack perhaps, or just move
+ // all patterns that can add unreachability to a pass that does so
+ // already like vacuum or dce.
+ if (curr->ref->type == Type::unreachable) {
return;
}