summaryrefslogtreecommitdiff
path: root/src/ir/hashed.h
diff options
context:
space:
mode:
authorHeejin Ahn <aheejin@gmail.com>2020-02-05 15:40:04 -0800
committerGitHub <noreply@github.com>2020-02-05 15:40:04 -0800
commitaab75ed890a3e491d00e652bbfbe19edd17d38cb (patch)
tree324d482c863119bb19defe3cc8b5b638f6bc7be1 /src/ir/hashed.h
parent7be22c4d68270573ee010938aa8cd06be89e54d2 (diff)
downloadbinaryen-aab75ed890a3e491d00e652bbfbe19edd17d38cb.tar.gz
binaryen-aab75ed890a3e491d00e652bbfbe19edd17d38cb.tar.bz2
binaryen-aab75ed890a3e491d00e652bbfbe19edd17d38cb.zip
Fix LocalCSE's usable local selection (#2638)
Now that we have subtypes, we cannot reuse any local that contains the same expression, because that local's type can be a supertype. For example: ``` (local $0 anyref) (local $1 nullref) ... (local.set $0 (ref.null)) (local.set $1 (ref.null)) ;; cannot be replaced with (local.get $0) ``` This extends `usables` map's key to contain both `HashedExpression` and the local's type, so we can get the right usable local in presence of subtypes.
Diffstat (limited to 'src/ir/hashed.h')
-rw-r--r--src/ir/hashed.h19
1 files changed, 0 insertions, 19 deletions
diff --git a/src/ir/hashed.h b/src/ir/hashed.h
index fe0a0b958..3068966c5 100644
--- a/src/ir/hashed.h
+++ b/src/ir/hashed.h
@@ -38,25 +38,6 @@ struct HashedExpression {
: expr(other.expr), hash(other.hash) {}
};
-struct ExpressionHasher {
- HashType operator()(const HashedExpression value) const { return value.hash; }
-};
-
-struct ExpressionComparer {
- bool operator()(const HashedExpression a, const HashedExpression b) const {
- if (a.hash != b.hash) {
- return false;
- }
- return ExpressionAnalyzer::equal(a.expr, b.expr);
- }
-};
-
-template<typename T>
-class HashedExpressionMap
- : public std::
- unordered_map<HashedExpression, T, ExpressionHasher, ExpressionComparer> {
-};
-
// A pass that hashes all functions
struct FunctionHasher : public WalkerPass<PostWalker<FunctionHasher>> {