summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-validator.cpp
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2018-05-10 08:58:09 -0700
committerGitHub <noreply@github.com>2018-05-10 08:58:09 -0700
commit111b4f1950467d51a78211af183f4ae6398aac49 (patch)
tree7f53ab6389e2bcaacf761cbf33846ac0210bd098 /src/wasm/wasm-validator.cpp
parent6a9ececa2fc9eca99a12b65ca130612942babdce (diff)
downloadbinaryen-111b4f1950467d51a78211af183f4ae6398aac49.tar.gz
binaryen-111b4f1950467d51a78211af183f4ae6398aac49.tar.bz2
binaryen-111b4f1950467d51a78211af183f4ae6398aac49.zip
Optimize equivalent locals (#1540)
If locals are known to contain the same value, we can * Pick which local to use for a get_local of any of them. Makes sense to prefer the most common, to increase the chance of one dropping to zero uses. * Remove copies between a local and one that we know contains the same value. This is a consistent win, small though, around 0.1-0.2%.
Diffstat (limited to 'src/wasm/wasm-validator.cpp')
-rw-r--r--src/wasm/wasm-validator.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp
index 07f0a634b..7246a15a6 100644
--- a/src/wasm/wasm-validator.cpp
+++ b/src/wasm/wasm-validator.cpp
@@ -474,6 +474,7 @@ void FunctionValidator::visitCallIndirect(CallIndirect* curr) {
void FunctionValidator::visitGetLocal(GetLocal* curr) {
shouldBeTrue(curr->index < getFunction()->getNumLocals(), curr, "get_local index must be small enough");
shouldBeTrue(isConcreteType(curr->type), curr, "get_local must have a valid type - check what you provided when you constructed the node");
+ shouldBeTrue(curr->type == getFunction()->getLocalType(curr->index), curr, "get_local must have proper type");
}
void FunctionValidator::visitSetLocal(SetLocal* curr) {