summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ir/properties.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/ir/properties.h b/src/ir/properties.h
index 2214eecaf..cddcbc5f2 100644
--- a/src/ir/properties.h
+++ b/src/ir/properties.h
@@ -311,7 +311,12 @@ inline Expression* getImmediateFallthrough(
} else if (auto* as = curr->dynCast<RefCast>()) {
return as->ref;
} else if (auto* as = curr->dynCast<RefAs>()) {
- return as->value;
+ // Extern conversions are not casts and actually produce new values.
+ // Treating them as fallthroughs would lead to misoptimizations of
+ // subsequent casts.
+ if (as->op != ExternInternalize && as->op != ExternExternalize) {
+ return as->value;
+ }
} else if (auto* br = curr->dynCast<BrOn>()) {
return br->ref;
}