summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2018-03-14 09:58:46 -0700
committerGitHub <noreply@github.com>2018-03-14 09:58:46 -0700
commit6bd81e541b7ae524f4c94fe91349f133f0007704 (patch)
tree06c8b50faaedaef3b1bb269a15c3413c8e5f6b39 /src
parentd52213c3f5e96bb3450721d96aa68d3c5e0865b6 (diff)
downloadbinaryen-6bd81e541b7ae524f4c94fe91349f133f0007704.tar.gz
binaryen-6bd81e541b7ae524f4c94fe91349f133f0007704.tar.bz2
binaryen-6bd81e541b7ae524f4c94fe91349f133f0007704.zip
fix liveness-traversal: an action can be either a get, a set, or an other, and we assumed a non-get is a set (caught by valgrind) (#1472)
Diffstat (limited to 'src')
-rw-r--r--src/cfg/liveness-traversal.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/cfg/liveness-traversal.h b/src/cfg/liveness-traversal.h
index f27c43f8e..8ba80e015 100644
--- a/src/cfg/liveness-traversal.h
+++ b/src/cfg/liveness-traversal.h
@@ -67,13 +67,15 @@ struct Liveness {
LocalSet start, end; // live locals at the start and end
std::vector<LivenessAction> actions; // actions occurring in this block
+#if LIVENESS_DEBUG
void dump(Function* func) {
if (actions.empty()) return;
std::cout << " actions:\n";
for (auto& action : actions) {
- std::cout << " " << (action.isGet() ? "get" : "set") << " " << func->getLocalName(action.index) << "\n";
+ std::cout << " " << (action.isGet() ? "get" : (action.isSet() ? "set" : "other")) << " " << func->getLocalName(action.index) << "\n";
}
}
+#endif // LIVENESS_DEBUG
};
template<typename SubType, typename VisitorType>
@@ -201,7 +203,7 @@ struct LivenessWalker : public CFGWalker<SubType, VisitorType, Liveness> {
auto& action = actions[i];
if (action.isGet()) {
live.insert(action.index);
- } else {
+ } else if (action.isSet()) {
live.erase(action.index);
}
}