From aab75ed890a3e491d00e652bbfbe19edd17d38cb Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Wed, 5 Feb 2020 15:40:04 -0800 Subject: 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. --- src/ir/hashed.h | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'src/ir/hashed.h') 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 -class HashedExpressionMap - : public std:: - unordered_map { -}; - // A pass that hashes all functions struct FunctionHasher : public WalkerPass> { -- cgit v1.2.3