diff options
Diffstat (limited to 'src/passes/LocalCSE.cpp')
-rw-r--r-- | src/passes/LocalCSE.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/passes/LocalCSE.cpp b/src/passes/LocalCSE.cpp index 1338c6571..d582c8275 100644 --- a/src/passes/LocalCSE.cpp +++ b/src/passes/LocalCSE.cpp @@ -37,15 +37,15 @@ #include <algorithm> #include <memory> -#include <wasm.h> -#include <wasm-builder.h> -#include <wasm-traversal.h> -#include <pass.h> +#include "ir/flat.h" #include <ir/cost.h> #include <ir/effects.h> #include <ir/equivalent_sets.h> -#include "ir/flat.h" #include <ir/hashed.h> +#include <pass.h> +#include <wasm-builder.h> +#include <wasm-traversal.h> +#include <wasm.h> namespace wasm { @@ -60,7 +60,8 @@ struct LocalCSE : public WalkerPass<LinearExecutionWalker<LocalCSE>> { Index index; // the local we are assigned to, local.get that to reuse us EffectAnalyzer effects; - UsableInfo(Expression* value, Index index, PassOptions& passOptions) : value(value), index(index), effects(passOptions, value) {} + UsableInfo(Expression* value, Index index, PassOptions& passOptions) + : value(value), index(index), effects(passOptions, value) {} }; // a list of usables in a linear execution trace @@ -183,11 +184,13 @@ struct LocalCSE : public WalkerPass<LinearExecutionWalker<LocalCSE>> { if (iter != usables.end()) { // already exists in the table, this is good to reuse auto& info = iter->second; - set->value = Builder(*getModule()).makeGetLocal(info.index, value->type); + set->value = + Builder(*getModule()).makeGetLocal(info.index, value->type); anotherPass = true; } else { // not in table, add this, maybe we can help others later - usables.emplace(std::make_pair(hashed, UsableInfo(value, set->index, getPassOptions()))); + usables.emplace(std::make_pair( + hashed, UsableInfo(value, set->index, getPassOptions()))); } } } else if (auto* get = curr->dynCast<GetLocal>()) { @@ -227,8 +230,6 @@ struct LocalCSE : public WalkerPass<LinearExecutionWalker<LocalCSE>> { } }; -Pass *createLocalCSEPass() { - return new LocalCSE(); -} +Pass* createLocalCSEPass() { return new LocalCSE(); } } // namespace wasm |