diff options
author | Alon Zakai <azakai@google.com> | 2024-09-26 13:41:26 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-26 13:41:26 -0700 |
commit | 2e0a7b53446e55b5b048c2c7559612d19059f5c3 (patch) | |
tree | 5b33c7f52f2d9e8cded27d67857b9df1f795a8ab /src | |
parent | 86258e52beff652ed44f888287300f369fea2a87 (diff) | |
download | binaryen-2e0a7b53446e55b5b048c2c7559612d19059f5c3.tar.gz binaryen-2e0a7b53446e55b5b048c2c7559612d19059f5c3.tar.bz2 binaryen-2e0a7b53446e55b5b048c2c7559612d19059f5c3.zip |
[NFC] Early-exit PickLoadSigns if there are no memories (#6971)
In WasmGC modules there is often no memory at all, and we can skip
walking the code in this pass in such cases.
Diffstat (limited to 'src')
-rw-r--r-- | src/passes/PickLoadSigns.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/passes/PickLoadSigns.cpp b/src/passes/PickLoadSigns.cpp index d30e0a381..587314209 100644 --- a/src/passes/PickLoadSigns.cpp +++ b/src/passes/PickLoadSigns.cpp @@ -45,6 +45,11 @@ struct PickLoadSigns : public WalkerPass<ExpressionStackWalker<PickLoadSigns>> { std::unordered_map<Load*, Index> loads; void doWalkFunction(Function* func) { + if (getModule()->memories.empty()) { + // There can be no loads without a memory. + return; + } + // prepare usages.resize(func->getNumLocals()); // walk |