summaryrefslogtreecommitdiff
path: root/src/passes/SimplifyLocals.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/passes/SimplifyLocals.cpp')
-rw-r--r--src/passes/SimplifyLocals.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/passes/SimplifyLocals.cpp b/src/passes/SimplifyLocals.cpp
index 2f269a00d..85c719d4c 100644
--- a/src/passes/SimplifyLocals.cpp
+++ b/src/passes/SimplifyLocals.cpp
@@ -411,6 +411,14 @@ struct SimplifyLocals
if (set->isTee()) {
return false;
}
+ // We cannot move expressions containing exnref.pops that are not enclosed
+ // in 'catch', because 'exnref.pop' should follow right after 'catch'.
+ FeatureSet features = this->getModule()->features;
+ if (features.hasExceptionHandling() &&
+ EffectAnalyzer(this->getPassOptions(), features, set->value)
+ .danglingPop) {
+ return false;
+ }
// if in the first cycle, or not allowing tees, then we cannot sink if >1
// use as that would make a tee
if ((firstCycle || !allowTee) && getCounter.num[set->index] > 1) {