summaryrefslogtreecommitdiff
path: root/src/ir/effects.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/ir/effects.h')
-rw-r--r--src/ir/effects.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/ir/effects.h b/src/ir/effects.h
index 8919c6da4..8c95f463d 100644
--- a/src/ir/effects.h
+++ b/src/ir/effects.h
@@ -283,6 +283,14 @@ struct EffectAnalyzer : public PostWalker<EffectAnalyzer> {
isAtomic = true;
}
void visitUnreachable(Unreachable *curr) { branches = true; }
+
+ // Helpers
+
+ static bool canReorder(PassOptions& passOptions, Expression* a, Expression* b) {
+ EffectAnalyzer aEffects(passOptions, a);
+ EffectAnalyzer bEffects(passOptions, b);
+ return !aEffects.invalidates(bEffects);
+ }
};
} // namespace wasm