summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHeejin Ahn <aheejin@gmail.com>2019-10-10 20:38:44 -0700
committerGitHub <noreply@github.com>2019-10-10 20:38:44 -0700
commit4507ee5767b62095b29ca3b9c775475400f5423a (patch)
treead4e4012bf1248d48ff323f3691b9ac11ea5faf8 /src
parentf841dd1b33e4060de64b92e6c467450d7a1f77d8 (diff)
downloadbinaryen-4507ee5767b62095b29ca3b9c775475400f5423a.tar.gz
binaryen-4507ee5767b62095b29ca3b9c775475400f5423a.tar.bz2
binaryen-4507ee5767b62095b29ca3b9c775475400f5423a.zip
Don't instrument pops in InstrumentLocals (#2378)
`pop` is not a real instruction and automatically generated when reading binary and deleted when writing binary, so this does not work with instrumentation.
Diffstat (limited to 'src')
-rw-r--r--src/passes/InstrumentLocals.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/passes/InstrumentLocals.cpp b/src/passes/InstrumentLocals.cpp
index 27c3acde5..8c8cc2c9c 100644
--- a/src/passes/InstrumentLocals.cpp
+++ b/src/passes/InstrumentLocals.cpp
@@ -105,6 +105,13 @@ struct InstrumentLocals : public WalkerPass<PostWalker<InstrumentLocals>> {
}
void visitLocalSet(LocalSet* curr) {
+ // We don't instrument pop instructions. They are automatically deleted when
+ // writing binary and generated when reading binary, so they don't work with
+ // local set/get instrumentation.
+ if (curr->value->is<Pop>()) {
+ return;
+ }
+
Builder builder(*getModule());
Name import;
switch (curr->value->type) {