summaryrefslogtreecommitdiff
path: root/src/passes/SimplifyGlobals.cpp
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2023-08-08 16:03:50 -0700
committerGitHub <noreply@github.com>2023-08-08 16:03:50 -0700
commit6537640f95a08aaf5f4829e34adc1f9755892af8 (patch)
tree8922b0ee12b01fd1be84e4dda6a2e7f7a0124d75 /src/passes/SimplifyGlobals.cpp
parentf1e92f99867b646aebd8a4f9b35c4972301e6469 (diff)
downloadbinaryen-6537640f95a08aaf5f4829e34adc1f9755892af8.tar.gz
binaryen-6537640f95a08aaf5f4829e34adc1f9755892af8.tar.bz2
binaryen-6537640f95a08aaf5f4829e34adc1f9755892af8.zip
SimplifyGlobals: Connect adjacent blocks in LinearExecutionWalker (#5865)
Followup to #5860, this does the same for SimplifyGlobals as for SimplifyLocals. As there, this is valid because it's ok if we branch away. This part of the pass applies a global value to a global.get based on a dominating global.set, so any dominance is good enough for us.
Diffstat (limited to 'src/passes/SimplifyGlobals.cpp')
-rw-r--r--src/passes/SimplifyGlobals.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/passes/SimplifyGlobals.cpp b/src/passes/SimplifyGlobals.cpp
index 97e91bbab..398a6c3ca 100644
--- a/src/passes/SimplifyGlobals.cpp
+++ b/src/passes/SimplifyGlobals.cpp
@@ -341,6 +341,11 @@ struct ConstantGlobalApplier
return std::make_unique<ConstantGlobalApplier>(constantGlobals, optimize);
}
+ // It is ok to look at adjacent blocks together, as if a later part of a block
+ // is not reached that is fine - changes we make there would not be reached in
+ // that case.
+ bool connectAdjacentBlocks = true;
+
bool refinalize = false;
void replaceCurrent(Expression* rep) {