From 1b6a1099f857d70005380cb4f980c9defeba4b22 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 7 Apr 2016 20:42:17 -0700 Subject: add missing checks on nested blocks in SimplifyExpressions --- src/passes/SimplifyLocals.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/passes/SimplifyLocals.cpp b/src/passes/SimplifyLocals.cpp index 5368701d7..0d59b8759 100644 --- a/src/passes/SimplifyLocals.cpp +++ b/src/passes/SimplifyLocals.cpp @@ -45,14 +45,19 @@ struct SimplifyLocals : public WalkerPass> { void visitBlock(Block *curr) { // note locals, we can sink them from here TODO sink from elsewhere? - derecurseBlocks(curr, [&](Block* block) {}, [&](Block* block, Expression*& child) { + derecurseBlocks(curr, [&](Block* block) { + // curr was already checked by walk() + if (block != curr) checkPre(block); + }, [&](Block* block, Expression*& child) { walk(child); if (child->is()) { Name name = child->cast()->name; assert(sinkables.count(name) == 0); sinkables.emplace(std::make_pair(name, SinkableInfo(&child))); } - }, [&](Block* block) {}); + }, [&](Block* block) { + if (block != curr) checkPost(block); + }); } void visitGetLocal(GetLocal *curr) { -- cgit v1.2.3