summaryrefslogtreecommitdiff
path: root/src/ast_utils.h
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-04-07 12:03:11 -0700
committerAlon Zakai <alonzakai@gmail.com>2016-04-07 12:03:11 -0700
commit6279be0fb7013db1bc89755f9bc8db4befef2ddf (patch)
tree0f1820882d761eece2f95010c5222df067046c70 /src/ast_utils.h
parent068a3ed6efdb3f6b0c3b93cdf89bf6a02a5bb113 (diff)
downloadbinaryen-6279be0fb7013db1bc89755f9bc8db4befef2ddf.tar.gz
binaryen-6279be0fb7013db1bc89755f9bc8db4befef2ddf.tar.bz2
binaryen-6279be0fb7013db1bc89755f9bc8db4befef2ddf.zip
fix effect invalidation logic
Diffstat (limited to 'src/ast_utils.h')
-rw-r--r--src/ast_utils.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/ast_utils.h b/src/ast_utils.h
index 598081342..190b2876e 100644
--- a/src/ast_utils.h
+++ b/src/ast_utils.h
@@ -56,7 +56,9 @@ struct EffectAnalyzer : public WasmWalker<EffectAnalyzer> {
// checks if these effects would invalidate another set (e.g., if we write, we invalidate someone that reads, they can't be moved past us)
bool invalidates(EffectAnalyzer& other) {
- return branches || ((writesMemory || calls) && other.accessesMemory()) || (writesLocal && other.accessesLocal());
+ return branches || other.branches
+ || ((writesMemory || calls) && other.accessesMemory()) || (writesLocal && other.accessesLocal())
+ || (accessesMemory() && (other.writesMemory || other.calls)) || (accessesLocal() && other.writesLocal);
}
void visitIf(If *curr) { branches = true; }